- About The Project
- Getting Started
- Game Rules
- Testing Examples
- File Descriptions
- Contact
- Acknowledgements
A command line 2048 game to practice programming skills, specificaly newly learned skills in the NumPy library and using Test Driven Development techniques with PyTest.
In order to run the application, install and do the following in an Ubuntu Linux Environment.
Update System
sudo apt-get update
Install Python and Pip3
- Python 3.8
sudo apt install python3.8
- pip3
sudo apt-get update
Clone the repo
git clone https://github.com/frank-quoc/2048.git
Install required libraries from requirement.txt
- Numpy 1.19.4
- PyTest 6.2.1
pip3 install -r requirements.txt
Run the game in the Ubuntu Command Line from the ~/final/src/ directory.
python3 game.py
- This is a 4 x 4 grid game with the ultimate goal of achieving the elusive 2048 tile.
- Every turn, either a 2 (90% chance) or a 4 (10% chance) will appear.
- Tiles will slide to the farthest possible position in a certain direction chosen by the player.
- If two tiles of the same value collide, they will merge into their respective sums.
- Three consecutive tiles will only have the two of the farthest direction merge.
- Your score goes up by the value of the tiles that merge. Enjoy!!!
UP
To go up, press 'w" and then enter.
'a' to go left and then enter.
Press 's' and then enter to go down.
'd' and then enter for right.
To run tests, simply use the coding editor of your choice. The following directions are done on VS Code.
- Press in Ctrl-` to open up your command terminal.
- Activate the virtual env:
source venv_2048 - Navigate (
cd) to~/final/tests/folder - Run every test:
pytest test_board.py
- Or, run individual test by typing in the specific test module or test class in "" after -k. Example:
pytest test_board.py -k "test_shift_matrix_left"
- images: Gameplay Images
- 2048_version_1: Unfinished version (no NumPy implementation).
- 2048_v1.py: First version of the game.
- board.py: Board for first version.
- Final: Final version.
- src: Source Folder
- board.py: Board for final version.
- game.py: Final version of the game (Run game here).
- tests: Testing folder.
- test_board.py: Testing file.
- requirements.txt: Required libraries to download.
- venv_2048: Virtual Environment to run tests.
- src: Source Folder
Frank Ho - @cuLyTech
Project Link: https://github.com/frank-quoc/2048
2048 python numpy by @github.com/wbars






