Skip to content

EteimZ/2048-rough-sketch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

2048 Rough Sketch

A rough implementation of 2048 in python.

Folder structure

src
├── main.py
└── utils.py

The src folder contains two files:

  • main.py: This is the main entry file to start the game.
  • utils.py: This contains functions used in the game of 2028.

Usage

git clone https://github.com/EteimZ/2048-rough-sketch
cd 2048-rough-sketch
python src/main.py
   0|   0|   0|   4
   0|   0|   0|   0
   2|   0|   0|   0
   0|   0|   0|   0
Please press key(w⬆|s⬇|a⬅|d➡|e to exit): 

Gameplay

Four keys are used to play the game w, s , a and d.

w moves the grid up.

   2|   0|   0|   4
   0|   0|   0|   0
   0|   0|   0|   0
   0|   0|   2|   0
Please press key(w⬆|s⬇|a⬅|d➡|e to exit): w

s moves the grid down.

   0|   2|   0|   0
   0|   0|   0|   0
   0|   0|   0|   0
   2|   0|   2|   4                                                                                                             
Please press key(w⬆|s⬇|a⬅|d➡|e to exit): s

a moves the grid left.

   2|   0|   0|   0                                                                                                               
   0|   0|   0|   0                                                                                                               
   0|   0|   0|   0                                                                                                               
   8|   0|   4|   0                                                                                                           
Please press key(w⬆|s⬇|a⬅|d➡|e to exit): a

d moves the grid right.

   0|   0|   0|   2                                                                                                               
   0|   0|   0|   0                                                                                                               
   0|   0|   2|   0                                                                                                               
   0|   0|   8|   4                                                                                                           
Please press key(w⬆|s⬇|a⬅|d➡|e to exit): d

Test

Tests have been implemented using doctest. Use the command below to run them.

python src/utils.py # Non verbose test
python src/utils.py -v # verbose test

About

My rough implementation of the game 2048

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages