EteimZ / 2048-rough-sketch

My rough implementation of the game 2048

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:MIT License


Languages

Language:Python 100.0%