The game's objective is to slide numbered tiles on a grid to combine them to create a tile with the number 2048 (in default case).
Here is a Python version of the game.
Note : My program is made to work in Ubuntu based environments. Avoid using it on Wndows
There are two files 2048.py
which is like the main program and essentials.py
which contains my own user defined functions used for implementation of the program.
The program reads command line arguments as input
python 2048.py --size <board dimensions> --win <max value>
or
python 2048.py -n <board dimensions> -w <max value>
If no arguments are passed python 2048.py
then the board dimension are set to 5 x 5 and the winning criteria is set to no. 2048
If the entered value for win is not a power of 2 then it will rounded to lowest power of 2 greater than or equal to win. Eg: python 2048.py -w 476
then Win criteria is 512
The Game starts with two 2's at random position.
-
Use WASD keys to controls the moves. (Both upper and lower case can be used)
-
A move is said to be invalid if none of the number is able to move.Eg:
Here moves
w
anda
are invalid -
After each valid move, a number
2
is randomly inserted in an empty position
-
The Game ends if the win number is created. Hence you win the game.
-
Else if no possible moves are left the Game ends. Hence you lose the game.
-
If you want to quit in the middle of the Game press
q
orQ
. You will be prompted :Do you want to Exit the game ?
Type
y
oryes
and hitENTER
to quit.If you don't want to quit just hit
ENTER
and the game will continue.