Skip to content

ABD-01/py2048

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

2048

Description

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.

board

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.

Beginnig the Game

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.

Moves

  • Use WASD keys to controls the moves. (Both upper and lower case can be used)

    keys

  • A move is said to be invalid if none of the number is able to move.Eg:

    image

    Here moves w and a are invalid

  • After each valid move, a number 2 is randomly inserted in an empty position

Ending

  • The Game ends if the win number is created. Hence you win the game.

    image

  • Else if no possible moves are left the Game ends. Hence you lose the game.

    image

  • If you want to quit in the middle of the Game press qor Q. You will be prompted : Do you want to Exit the game ?

    image

    Type y or yes and hit ENTER to quit.

    If you don't want to quit just hit ENTER and the game will continue.

About

Python version of the Game 2048 with variable board size.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages