I built a tic tac toe program using swing a few years ago, so I decided to upgrade it to an ultimate tic tac toe program, which would be a lot harder

What it does

It's a 9x9 board of tic tac toe, where you will play against a bot in a game of ultimate tic tac toe. After each game ends, it'll show you a fun fact.

How I built it

I used swing in java to display the board. If the mouse pressed an open box, it'd play an O. If it was already filled, I created an if statement to make the user pick another square. Then, I created a lot of if statements for the win conditions. Then, I created a random number generator to choose a random fact from the fact list I created.

Challenges I ran into

I had to center the X's and the O's, and that took a lot of testing. I also thought about the best way to check for win conditions. Also, I'd make typos, and then sometimes, it wouldn't see if someone already got three in a row, so I had to fix that, which took a lot of debugging. I also had to think of what to do after a player gets one square. I decided that the best way to do it was to just fill the rest of the square, so that the bot and player cannot play in that square anymore.

Accomplishments that I'm proud of

I ended up finishing the program! It took a lot of testing, because I ran a lot of problems. This was also my first program over 200 lines!

What I learned

Over the course of three days, I learned a lot more about java swing. I had to do a bit of research to see how to test for mouse clicks, and more.

What's next for Ultimate TicTacToe

I am thinking of creating a bot which will try to find the best possible move, in order to challenge the player a lot more.

Built With

Share this project: