|
Methods defined here:
- __init__(self)
- Creates a new game of 2048 with two random 2s on the board.
- __str__(self)
- Creates a string representation of the game board.
- addRandom(self, value)
- Add a random tile to the board with the specified value.
The value must be a power of 2 between 2 and 65536.
Raises an RuntimeError if there are no free spaces left.
- getCell(self, row, col)
- Get the int value of the tile in (row, col).
Top left is 0,0. Bottom right is 3,3.
If there is no tile in that position, returns None.
- getScore(self)
- Return the current score in the game
- movesRemaining(self)
- Returns True if there are moves remaining; False otherwise
- pushDown(self)
- Push the tiles down.
- pushLeft(self)
- Push the tiles left.
- pushRight(self)
- Push the tiles right.
- pushUp(self)
- Push the tiles up.
- setCell(self, row, col, value)
- Set the int value of the tile in (row, col).
Top left is 0,0. Bottom right is 3,3.
The value must be a power of 2 between 2 and 65536.
Set the tile to None to remove the tile.
|