Inspiration
We were playing TicTacToe against each other when we got the idea to make our own TicTacToe game. One of us had to leave early, so the other decided to leave the game too. But with our program, the person who was left behind could have continued playing, against the computer.
What it does
Our TicTacToe game allows the player to choose what letter they want to represent and how many rounds they want to play against the computer. Then the player enters a number 1-9 to choose what spot they want to put their letter in. The computer chooses a spot second. This keeps going until someone gets three in a row of their chosen letter or the whole board is full, resulting in a tie. The game is repeated for however many matches you chose, and then the wins are tallied up in the end to show the overall winner.
How we built it
We used the platform IntelliJ Idea and we used Java to make this project. First we talked about which elements of the widely known game we wanted to include in our project and then decided to have a bot to play against, to make the game more playable for people who are alone.
Challenges we ran into
One of the challenges we ran into was how to get the computer to choose a spot on the board to put its letter. We solved this with a Random object that came up with a random number 1-9 and put its letter there. Another challenge was when asking the player which letter they wanted to use, we had to put the exact casing to avoid errors. We fixed this by using the method equalsIgnoreCase. This fixed the issue.
Accomplishments that we're proud of
We're proud of getting the entire game code and documentation done in less than a day because we have done projects and competitions before where it would take up to a few days to work out the coding and also make sure the coding works.
What we learned
We learned about different types of arrays, like char, int, and boolean arrays as all were utilized in our program. We also learned how to use different types of loops like for and while loops to get the desired outcome.
What's next for Tic-Tac-Toe
Right now, the bot that plays against the player only chooses a random place on the board. In the future, we would like to code an algorithm that actually analyzes the choices that the player makes, and allows the bot to play based on those choices.
Log in or sign up for Devpost to join the conversation.