Classic 2048 - 4x4 Board Game

Classic 2048 Game Tips & Tricks

ক্ল্যাসিক ২০৪৮ গেইম টিপস ও ট্রিকস 

আজকে আমি ২০৪৮ গেইম এর এন্ড্রয়েড সংস্করণ এর প্রথম ভার্সন রিলিজ দিয়েছি নাম – CLASSIC 2048

Image result for get it on google play

২০৪৮ গেইম – মূলতঃ  ৪ x ৪ বোর্ডের একটি গেইম যেটা জোড় সংখ্যার যোগফলের উপর ভিত্তি করে তৈরি করা হয়েছে। খেলার শুরুতে টাইলসের নাম্বার থাকে ২ পরবর্তীতে একই সংখ্যার টাইলস গুলো কে একত্র করে করে বড় বেজোড় সংখ্যা গুলো তৈরি করা যায়। তবে একত্র করার রুল কিন্তু একটাই শুধুমাত্র সেইম নাম্বার এর টাইলসকেই একত্র করা যাবে। এরকম একত্র করে করে ২০৪৮ সংখ্যার একটি টাইলস বানাতে পারলেই কেল্লাফতে!

তবে, আমার রিলিজ করা গেইমটি ২০৪৮ টাইলস এর পরেও খেলা চালিয়ে যাওয়ার ব্যবস্থা রেখেছি। আর মুভ ফিরিয়ে নেয়ার কোন ব্যবস্থা রাখা হচ্ছে না। যাতে করে স্কোরের স্বচ্ছতা বজায় থাকে। ২০৪৮ গেইম এর হিস্টোরি কিন্তু বেশীদিনের না। ইতালির একজন গেইম ডেভেলপার এইতো সেদিন( ২০১৪ সালের দিকে) এই গেইমটি আবিষ্কার করেন। তিনি জাভাস্ক্রিপট আর সি এস এস দিয়েই গেইম এর ডেমো বানিয়ে সবাই কে তাক লাগিয়ে দেন!

গেইমটির এডিক্টিভ বৈশিষ্ট্যের কারণই হলো সহজ গেইম প্লে। সিমপ্লি সোয়াইপ আপ, ডাউন, লেফট ও রাইট করে করেই গেইমে মোটামুটি অনেক দূর যাওয়া যায়। গেইমটিতে হাই স্কোর করার জন্যে কিছু টিপস এবং ট্রিকস আপনাদের সামনে এই আর্টিকেলে তুলে ধরবো।

কর্নার গেইম!

Screenshot from 2018-11-11 01-54-44যে কোন একটি কর্নারকে টার্গেট করে, ওই কর্নারে বোর্ডের সবচেয়ে বড় টাইলসকে মুভ করে এই স্ট্রাটেজি কাজে লাগাতে পারেন। আমি সাধারণত নিচের যে কোন একটা কর্নারকে টার্গেট করে এর পরে ছোট থেকে বড় ক্রমানুসারে সাজানোর চেষ্টা করি। এইটা খুবই কাজে দেয় তবে, একটা জিনিস মাথায় রাখতে হবে তা হলো কোন ক্রমেই যাতে সবচেয়ে বড় সংখ্যার টাইলসটি যাতে কর্নার থেকে সরে না যায়। গেলে মহা বিপদ এবং বেশীর ভাগ ক্ষেত্রে রিকোভার করা আর পসিবল হয় না

তাই, ‘সবসময় চেষ্টা করতে হবে একদম কর্নারের টাইলস এ সবচেয়ে বড় সংখ্যাটি যেন স্থির থাকে।’ 

প্রটেক্ট কর্নার

আগেই যেটা বললাম শুধু মাত্র এদিক ঐদিকে সোয়াইপ করে আপনি হয়ত হাইয়েস্ট ২৫৬ রিচ করতে পারবেন। কিন্তু ২০৪৮ রিচ করা অনেক কঠিন হবে। কর্নার টাইলসের হাইয়েস্ট ভ্যালু এর টাইলস কে প্রটেক্ট করার আরেকটা টেকনিক হলো এর আশে পাশের টাইলস গুলোকে ও বড় করে তোলা। তখন, ওই কর্নার পিসের মুভ করার পসিবলিটি কমে যায়।

তাড়াহুড়ো না করা

অনেক সময় আমরা অবচেতন মনেই অনেক তাড়াহুড়ো করা শুরু করে দিই। এই গেইমের সোয়াইপ জেস্টার তাড়াহুড়ো করার প্রবণতা কে আরও বাড়িয়ে দেয়। বেশীর ভাগ ক্ষেত্রেই তাড়াহুড়োর কারণে অনেক ভালো ফরমেশন ও মুহূর্তে নষ্ট হয়ে যেতে পারে। তাই, ঠাণ্ডা মাথায় ধীরে সুস্থে খেলাটাই বুদ্ধিমত্তার পরিচায়ক।

শেষ রো ফিলাপ করে রাখা

আপনি যে কর্নারকে টার্গেট করে খেলছেন সেটার একটি রো কে ফিক্সড করার জন্যে এই ট্রিকটা ভালো কাজে দিবে। সবসময় চেষ্টা করবেন, ওই রো যাতে সবসময় ভরা থাকে। খালি হওয়ার সুযোগ দেখতে পেলেই সাথে সাথে ভরাট করে দিলে, বড় সংখ্যার মুভমেন্ট অনেকাংশে কমে যাবে।

বড় নাম্বার কে তাড়া না করা

সবসময় বড় নাম্বার কে তাড়া করে বেশিদূর জাওয়া পসিবল না। আপনাকে অবশ্যই সামগ্রিকভাবে চিন্তা করতে হবে। একটু প্ল্যানিং করে খেললেই খুব সহজেই ১০২৪ + স্কোর করে এমনকি ২০৪৮ রিচ করে ফেলতে পারেন। তাই, বড় নাম্বার কে তাড়া না করে সুন্দর ভাবে গেইম প্ল্যান সেটআপ করে নিবেন।

এক সাথে অনেক গুলো টাইলস মিলানো

এটা সবচেয়ে বেশী ইফেক্টিভ, যখনই সুযোগ পাবেন, এক সাথে কয়েকটা মিলানোর সাথেই সাথেই সুযোগ কাজে লাগাবেন। কয়েকটা টাইলস একসাথে মিলাতে পারলে দেখবেন বোর্ড ফাকা হয়ে যাবে। ফলে, আপনি সহজে আপনার প্ল্যান কাজে লাগাতে পারেবেন।

এছাড়াও, আপনার যদি কোন টিপস বা ট্রিকস থাকে তাহলে কমেন্টে জানাতে পারেন। 😉

সবশেষে, গেইম খেলার আমন্ত্রণ রইলো। নিচের লিংক থেকে গেইমটি আপনার এন্ড্রয়েড ডিভাইসে ইন্সটল করে ফিডব্যাক জানাতে ভুলবেন না।

https://play.google.com/store/apps/details?id=com.wasi0013.classic2048

 

 

How to run Multiple Terminal Sessions on Linux VPS Server

maxresdefault

In this article, I will introduce you with one of the handy tool for your vps servers. It is an extremely useful app for maintaining multiple terminal sessions through just one window! This Command Line Utility is called Screen.

You may think of it as a Manager who manages different terminal sessions for you using shell. You don’t even need a X Server to run it!

How to Install Screen?

You can install it by typing the following commands:

sudo apt update 
sudo apt install screen

The above command should work on distros like Ubuntu 16.04 LTS, Xubuntu or, debian etc. If you have a different distro find appropriate installation information for it.

Common Commands of Screen

Try running the following command after successful installation:

screen

The output of the above command will be oddly surprising! You will see some texts about screen and you will be in terminal again!

Actually, the screen is running now! you can verify it by pressing `​ctrl+a ?` the output will be:

                       Screen key bindings, page 1 of 2.

                       Command key:  ^A   Literal ^A:  a

  break       ^B b         license     ,            removebuf   =         
  clear       C            lockscreen  ^X x         reset       Z         
  colon       :            log         H            screen      ^C c      
  copy        ^[ [         login       L            select      '         
  detach      ^D d         meta        a            silence     _         
  digraph     ^V           monitor     M            split       S         
  displays    *            next        ^@ ^N sp n   suspend     ^Z z      
  dumptermcap .            number      N            time        ^T t      
  fit         F            only        Q            title       A         
  flow        ^F f         other       ^A           vbell       ^G        
  focus       ^I           pow_break   B            version     v         
  hardcopy    h            pow_detach  D            width       W         
  help        ?            prev        ^H ^P p ^?   windows     ^W w      
  history     { }          quit        \            wrap        ^R r      
  info        i            readbuf     <            writebuf    >         
  kill        K k          redisplay   ^L l         xoff        ^S s      
  lastmsg     ^M m         remove      X            xon         ^Q q      

                  [Press Space for next page; Return to end.]

 

well, ctrl+a is a shortcut for different screen commands and the above output lists all of them! Feel free to explore all of them, as they will be quite handy!

I really liked this digital ocean’s tutorial of Screen commands. Read it if you want to learn the basics of screen

Helpful Resources:

How to create a .torrent file to share files or directories with a self hosted Private Tracker in Linux

What is Torrent File?

Torrent File contains metadata of file system and directories that you want to distribute using the BitTorrent File Distribution System. Along with the meta data it also contains list of trackers. The Network location of trackers are noted in the tracker list.

According to wikipedia:

BitTorrent tracker is a special type of server, one that assists in the communication between peers using the BitTorrent protocol. In peer-to-peer file sharing, a software client on an end-user PC requests a file, and portions of the requested file residing on peer machines are sent to the client, and then reassembled into a full copy of the requested file. The “tracker” server keeps track of where file copies reside on peer machines, which ones are available at time of the client request, and helps coordinate efficient transmission and reassembly of the copied file. Clients that have already begun downloading a file communicate with the tracker periodically to negotiate faster file transfer with new peers, and provide network performance statistics; however, after the initial peer-to-peer file download is started, peer-to-peer communication can continue without the connection to a tracker.

Alright, now that we know about torrent file and trackers lets just jump right into it 🙂

You will need:

  • A Computer to use it as a server. A LINUX based VPS Server is recommended though.  You can get one from Linode. It is quite cheap and very stable (around 5$ per month)
    Use my referral to get free credits:
    https://www.linode.com/?r=00453cca3ebd20582030ca874fbdd626a88b66cd
  • For this tutorial I’m gonna use Ubuntu 16.04 LTS, but you can choose any debian based distro and it should work.
  • Idea of Basic Linux commands & file structure

Setting up a VPS on Linode

You can use the Linode Promo code: DOCS10 to get 10$ credit on a new account! Linode’s documentation is great! It will get you started in minutes. Once you complete this return to this article.
Note: It is always a good idea to secure your vps server as much as possible. So, use a strong password for the root user and, optionally you can install packages like fail2ban, ufw etc.  You can also follow this instructions if you like.

Install Dependencies

Once, you are done with initial vps setup. Follow the following instructions to install the necessary packages for creating our own torrent tracker. Here we will be using bittornado & ctorrent for creating tracker and torrent file respectively. We will also use screen command to run multiple terminal sessions. To install all of them you can run the following command:

apt install bittornado ctorrent screen

Start the tracker

Now that, we have screen installed, we can create a new screen terminal session by running the command:

screen

You will be redirected to a new terminal prompt. You can check out the various screen commands by pressing ctrl+A ? (press ‘enter’ or, hit ‘return’ to exit the help menu)

In the new screen session, you can start your tracker by running the following commands:

mkdir ~/.bttrack
bttrack --port 6969 --dfile ~/.bttrack/dstate --logfile ~/.bttrack/tracker.log --nat_check 0 --scrape_allowed full

The first command will create a new hidden directory in your home folder called ​bttrack and the second command will start your own private torrent tracker!

Detach the screen session by pressing ctrl+A d

It will switch you back to the terminal and keep the tracker running in background screen terminal session which you can resume later if you wish.

Upload your File/Directory to VPS

You will have to upload the file/directory that you wish to share using .torrent file on your vps, In order to seed it from your vps using your private tracker. There are numerous ways to upload files on vps, I prefer ssh though.

If you have enabled ssh login to your server from your local computer. You can share your file with a single scp command from your local computer:

scp -r <source_file_path_of_your_local_directory>  <user>@<ip_address>:<destination_file_path>

example from my local computer I typed:

scp -r  ~/Desktop/MyFile/torrent_this.mp4 root@127.000.000.001:/MyFile/torrent_this.mp4

Here I’m uploading my ​ torrent_this.mp4 file to my vps using ssh. Note that, my username is root and ip address is 127.000.00.001 you will have to put your  username & ip address instead of those.

Creating .torrent file using ctorrent

So far, we have enabled our tracker and uploaded the file we wished to share using torrent. Now, lets make the .torrent file using ctorrent, the command is quite simple!

ctorrent -t -u "http://YOUR_SERVER_IP:6969/announce" -s torrent_file_name.torrent file_or_folder_for_torrent

It will create a .torrent file in the current directory! Voila!

Seed your .torrent file

to seed your .torrent file. Just run the command screen from the torrent file/directory location and run the command:

screen ctorrent torrent_file_name.torrent

It will start to seed your torrent file.  Press ctrl+A d to detach the screen session and keep seeding in background. Now you can distribute your .torrent file.

People will be able to download it and seed it using any torrent client!

 

Python Nested List Comprehension for…in goes from left to right!

The Confusion

Scenario: You were asked to write the equivalent list comprehension of the following code:
for i in range(6):
    for j in range(i):
        j
Before, starting with the above one we try the simplest one:
t = []
for i in range(6):
   t.append(i**2)
We already know the syntax of list comprehension is as follows: expression for expr in sequence1 So, for the above code we write:
 [i**2 for  i in range(6)]
You might have already started to smell the confusion, didn’t you? If not Read on… 🙂 Now, if I ask you to write the list comprehension for the first example code, you might end up with the following:
[ j for j in range(i) for i in range(6)]
when you execute the above code: Surprise, surprise! You will get a  NameError instead!
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'i' is not defined

What went wrong?

The nested fors in the list comprehension are evaluated from left to right. So, the correct list comprehension is:
[j for i in range(6) for j in range(i)]
In  the official documentation they explained it thoroughly!
List comprehensions have the form:
 [ expression for expr in sequence1
              for expr2 in sequence2 ...
              for exprN in sequenceN
              if condition ]
The for…in clauses contain the sequences to be iterated over. The sequences do not have to be the same length, because they are not iterated over in parallel, but from left to right; this is explained more clearly in the following paragraphs. The elements of the generated list will be the successive values of expression. The final if clause is optional; if present, expression is only evaluated and added to the result if condition is true. To make the semantics very clear, a list comprehension is equivalent to the following Python code:
for expr1 in sequence1:
    for expr2 in sequence2:
    ...
        for exprN in sequenceN:
             if (condition):
                  # Append the value of
                  # the expression to the
                  # resulting list.
  credit: https://stackoverflow.com/questions/52565893/nameerror-in-python-nested-for-loops-of-list-comprehension

Hello World! – A Brief History of Time

A few days ago, I answered a question on Quora. I thought it worth sharing! Let me walk you through those first few years of my programming career! Its been a lot of fun!

When did I Start Programming?

I started coding from 2012. It was the year when I enrolled for my Bachelors on Premier University Chittagong My first Computer was a Pentium III desktop with a 15 inch CRT monitor, 80 GB HD and, 512 MB Ram. I used to call it Ancient Karl. I have upgraded it with a brand new mother board, Dual Core CPU, 160 GB HD & 1 GB ram later!

What was My First Programming Language?

I Started with C & a few week later Python. After 1.5 hrs of wrestle, I successfully compiled my first C Program. I didn’t pay attention how things work and jumped right into coding (the way we play video games without reading instruction 😛 ) I was also way too noob for googling solutions for programming problems back then! Hence, I was going through folders of Turbo C to find the proper header (i.e stdio.h). After trying all headers starting with S, I finally managed to run my Hello World Program!

My First Interaction with Linux

There was a guy in my university who used to boot on a different OS from a USB stick on those University desktops! It was kinda cool. Although, I was a introvert so couldn’t ask him about it. Later we became friend and, he told me all about it, It was Ubuntu.  He was very fond of Python.

When I installed Ubuntu 12.04 LTS for the first time on my computer. I found python IDLE so amazing! I fall in love with python at first sight. Linux became my primary OS and, python my primary Language ever since.

Competitive Programming

I was introduced with SPOJ at February 14, 2014. I used to like it a lot because, it was the only platform that I knew that time that supports python based problem solving. I started to solve acm programming problems using C++, C & Python.
C++ & C were tough nuts to crack. Yet, used to solve 1 or 2 programs a day. After that, explored Javascript basics along with Java. I quit Java after writing my first applet (Hello World)

Various Projects & Programming Languages that I explored

I switched to C# for developing desktop application. It was cumbersome for me to make desktop app connected via online db. Hence, focused on web programming using PHP (with MYSQL). I didn’t like PHP Syntax was searching for alternatives from Day 1, found a brand new web framework Meteor (it was 0.7 or 0.8) that time. Exploring it learnt a bit more of JS. Never gave up practicing python in the mean time, as it was part of my daily life. Python was so easy and, always resonated my inner thoughts quite well. I used to use python codes more like algorithm/ building blocks. Wrote my first Meteor app Also, met a creepy Language named brainfuck that time which had only 8 commands! Yet, I found it so fascinating wrote a tutorial about it in my native language. I believe brainfuck changed my perspective and developed a new sense of coding. I felt that my thought process has changed!

Instead of solving problems, I started to look for multiple solutions to one problem

Enjoyed matrix manipulation on MATLAB, but found numpy (Python Module) more convenient for me. For text processing I used to be a fan of AWK & SED along with grep. Android devices caught my attention when I enrolled for a National 500 apps Application Developer Trainer Program!
Learnt many new things of Java. Used to code on eclipse that time. Wrote some android apps and, got selected as ICT Certified Trainer among the trainees. Wrote One of my brain teaser app. Meanwhile, started to explore phaser.js another Javascript Framework. Made Flappy Bird clone using that framework. And, another game. I was exploring Django (Python Framework) that time. Functional programming seemed interesting as well, hence ended up learning clisp basics. I started to write more and more python codes and, small django apps.

Another favorite pet project of mine is my Phaser-Piano. You can try it online!
I have played some musics on the app and uploaded them on sound cloud just to have some fun with it!
Feel free to check the full playlist here!

 

Dreamcatcher IT – The Journey Begins !

Today, I’m pretty excited! In the name of Almighty Allah, we are starting a new venture! Stand up and chase your dreams. Life is meant to be a challenge where we all have to struggle or fight with the things we want to earn. Obstacles, challenges, rough time will come. We will stand strong and overcome all cause its our dream and we are passionate about it! Wish us luck and keep us in your dua.

 

Dreamcatcher IT – envision Dreams

 

Dreamcatcher IT is a global information technology company located in Chittagong, Bangladesh. We’re a group of disruptive thinkers, craving for latest technologies to create exemplary solutions for startups, mid sized companies, enterprises and even individuals who want to make their own personal website, software or corporate identity.

We are constantly investigating new technologies for managing and growing your websites and web-stores keeping in mind the budget. Our approach is different than most, because we take the time to learn your business inside-and-out before we make a single technology choice. We have started our journey with the goal to find and accumulate a new pool of talented developers with a dream to become the top destination for IT professionals in Bangladesh. We provide winning solutions with our innovative, passionate & responsive teams. We always work to make our customers WIN. We focus on open and transparent long term relationships, embracing your goals as our own.

 

Stand up and chase your dreams. Life is meant to be a challenge where we all have to struggle or fight with the things we want to earn. Obstacles, challenges, rough time will come. We will stand strong and overcome all cause its our dream and we are passionate about it!

Interested to know more about the services we provide? Please, drop an email or, visit our website

Follow our facebook page!

Check out the following links and learn more about the services we provide:

 

Thanks you!

Good company in a journey makes the way seem shorter. — Izaak Walton

post

How to take Password input in Python

Did you know? There is a python module in Python Standard Library called getpass. The purpose of this library is to securely take input from user!

The module is very handy for sensitive inputs such as passwords / keys or any kind of credentials.

Simplest example of getpass could be this:

import getpass
password = getpass.getpass("enter password:")

The code is pretty straight forward! This password prompt will act similarly to unix password prompt, and it won’t echo user inputs (i.e. the key presses) hence, the password you type won’t be visible to end users. The best thing about this module is it is cross platform. So, you can use it on Windows, Linux or Mac.

There are only two functions listed in  The official documentation.
These are:

  •  getpass() – password prompt
  • getuser() – collects username from different environment variables

But, there are more than that, let me show you 😉

>>> import getpass
>>> dir(getpass)
['GetPassWarning', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_raw_input', 'contextlib', 'fallback_getpass', 'getpass', 'getuser', 'io', 'os', 'sys', 'termios', 'unix_getpass', 'warnings', 'win_getpass']

If you inspect carefully you will notice there are two more functions listed in the __dir__

  • unix_getpass( )
    unix_getpass(prompt='Password: ', stream=None)
     Prompt for a password, with echo turned off.
     
     Args:
     prompt: Written on stream to ask for the input. Default: 'Password: '
     stream: A writable file object to display the prompt. Defaults to
     the tty. If no tty is available defaults to sys.stderr.
     Returns:
     The seKr3t input.
     Raises:
     EOFError: If our input tty or stdin was closed.
     GetPassWarning: When we were unable to turn echo off on the input.
     
     Always restores terminal settings before returning.
  • win_getpass( )
    Help on function win_getpass in module getpass:
    
    win_getpass(prompt='Password: ', stream=None)
     Prompt for password with echo off, using Windows getch().

The docstring of these functions tells it all doesn’t it? 🙂

Note that, the win_getpass function uses the Windows getch() so, it requires the msvcrt module.