Get ready for a game of Tic-Tac-Toe with two adjustable difficulty levels!
First, choose your preferred difficulty level:
Level 1 (Easy): The computer randomly selects an empty cell without checking your moves. Can you outsmart it?
Level 2 (Intermediate): The computer is a bit smarter here. It checks if you’re about to complete a line when you already have 2 “X” and only need one more cell to win. If it detects this situation, it plays in the cell you need to complete the line before you do. It’s a tough opponent!
Difficulty level is hardcoded at the beginning of main.py.
Here’s how to play:
Start with a numbered game board from 1 to 9. This helps you choose your move.
- Your turn! You’ll be asked for your move. Enter the number of the spot where you want to place your X.
- The game board is updated to display your move, and the available spots are renumbered.
- We’ll check if the game is over. If someone has won or it’s a draw, we’ll let you know.
- If the game isn’t over, the cycle continues with your move and the computer’s move based on your chosen difficulty level.
- When the game concludes, we’ll display the results. If you’re up for another round, you can play again.
- If you’ve had your fill of Tic-Tac-Toe, you can exit the game.
Enjoy the game!