Inspiration
We were inspired by our projects in our COMP110 classes, battleship and Wordle. We wanted to make something similar to these and within our skillsets, and settled on tic tac toe.
What it does
There are 2 players that take turns placing an 'X' or an 'O' in a 3x3 grid. They continue until someone wins by getting 3 in a row horizontally, vertically, or diagonally, or if the board fills up resulting in a draw.
How we built it
We used python in Visual Studio Code. We created functions for creating the game board, the player taking a turn, and checking if a player won the game. We created the constants XGUESS, OGUESS, and SQUARE to be emojis that fill up the game board. The main function is what runs through the entire game printing out the text to the users. It makes sure to check for conditions of a win or a draw and updates the turn numbers.
Challenges we ran into
- The game board wouldn't save the emojis for X and O placed from previous turns.
- It would print out "Sorry, that spot is taken" even if the spot wasn't taken.
- Checking for a win would result in a win when there wasn't a win because when we checked if there were 3 spots in a row that were equal, it would return true since the 3x3 grid was initialized with all 0s, the same value.
- The game would result in a draw before the board was completely filled up.
Accomplishments that we're proud of
We are proud of solving all of the challenges above, but especially challenge number 1 because it gave us the most issues and took us the longest to solve.
What we learned
We learned mostly about how to problem solve. We also learned about the possibility 3x3 arrays and accessing its elements through a double bracket notation.
What's next for Tic Tac Toe Project
The next step for this project would be to transfer it over to something like pygame which would allow for more user interactivity and a better, more professional looking UI than just having the output in the terminal.
Built With
- python
- vscode
Log in or sign up for Devpost to join the conversation.