Tic-Tac-Toe is a simple turn-based strategy game for two players, X and O. Players take turns marking empty spaces on a 3×3 grid, aiming to create a line of three of their symbols.
A player wins by placing three identical marks in a row, either horizontally, vertically, or diagonally. If all spaces on the board are filled and neither player has formed a winning line, the game ends in a draw.
- Two-player gameplay
- 3×3 game board
- Win detection for rows, columns, and diagonals
- Draw detection
- Reward-based outcome system
The game uses the following reward scheme:
| Outcome | Reward |
|---|---|
| Winner | +1 |
| Loser | -1 |
| Draw | 0 for both players |
Taking an illegal move immediately ends the game. In this case:
- The player who made the illegal move receives a reward of -1.
- All other players receive a reward of 0.
- Player X starts the game.
- Players alternate turns placing their mark on an empty cell.
- The first player to align three marks in a row, column, or diagonal wins.
- If the board fills up without a winner, the game ends in a draw.
- Making an illegal move immediately ends the game with the corresponding penalty.
| Status | Meaning |
|---|---|
| 0 | Running |
| 1 | Started |
| 2 | Win |
| 3 | Lose |
| 4 | Draw |
- 0 (Running): The process is currently active and in progress.
- 1 (Started): The process has been initiated and is preparing to run.
- 2 (Win): The process completed successfully with a winning outcome.
- 3 (Lose): The process completed with a losing or unsuccessful outcome.
- 4 (Draw): The process completed without a winner or loser, resulting in a tie.
