- MAX_COLS and MAX_ROWS
- These define the maximum dimensions of the board.
- By default, the board is 4x4, but you can change the dimensions through the GUI by setting new rows and columns.
-
sims (Default: 359)
- The number of independent games to simulate with random moves.
-
depth (Default: 100)
- The maximum depth (number of moves) for each simulation.
You can override these defaults by providing parameters when calling the simulate_game()
function from the Tw48AiAssistant
class.
The game operates in three distinct stages, managed by the global variable STAGE, which helps track the current state of the gameplay logic. The stages are as follows:
-
Setting Up the Board
-
Performing Move
-
Adding the New Tile
The STAGE variable ensures that the game flow is orderly and prevents errors from invalid inputs or out-of-sequence operations. Each stage transitions smoothly to the next, maintaining a logical progression for the gameplay.