2048 game, played via CLI on Python 3 IDLE
-
Save cli2048.py in a directory of your choice.
-
Open Python IDLE and enter the following:
import os
os.chdir(r'c:\location\of\cli2048py') # please edit string to the correct path
from cli2048 import Game
g = Game() -
A game has begun! View the board with:
g.show()
-
Play 2048 using the commands below. Tip: Alt+P cycles through previously entered commands.
g.up()
g.down()
g.left()
g.right()
Enjoy.
-
The default grid is 4x4. To play on a nxn grid, initialise the game with:
g = Game(n)
-
You can turn debug mode on and off, which displays number spawn locations and whether any numbers have moved.
g.debug = True
g.debug = False #default