Inspiration

This game was originally thought up to help one of the group member's friend's little brother for this math project. Since it is actually interesting to code and fun to play, we decided to make this into a Java game. We added some tweaks to the game and try to improve it (gameplay wise and visual wise).

What it does

Allows player to play a vs AI game of Tic Tac Toe; however the game has a special rule. The rules are :

  1. The first person chooses two numbers between 1 to 7
  2. Multiply those two numbers and find that number on the board. That will be your move
  3. For subsequent turns you can only change one number on the equation. Example : if your opponent's move is 1 x 5 you can either make 1 x 3 or 5 x 4 by switching either 1 or 5 and select it on the board. 4.. Second Player(AI) will determine the best move with alpha beta pruning algorithm.
  4. Game ends when someone cannot make a move to another square
  5. Score is calculated by the amount of 3 streak that a player has. If no one has a streak, the game is a draw

How we built it

We started out designing classes and coding them in Java. The first testing is player vs player (both human). After the pvp is successful, we move on to building the AI. There are 3 or 4 versions of the AI, and all of them are tested for efficiency (and whether it runs or not). Alongside the java code, there is also a GUI so it can be playable in PC, and there is also an iOS version of it.

Challenges we ran into

There are a lot... Some of them are :

  1. We decided to improvise and make the grid a hexagon, but that made the array complicated. So we discarded that idea
  2. Minimax (with alpha beta pruning) is hard to trace if we made a mistake. It took more than 5 hours to came up with the correct AI for the game
  3. Connecting the GUI with the Java classes is difficult because sometimes it gives an error. (or the form can't switch from the home screen)
  4. PVP mode can't be combined with vs AI in one form due to difference in classes

Accomplishments that we're proud of

-We made the AI to work and play our version of Tic Tac Toe

-Opening Screen/Graphic elements actually looks nice

What we learned

  1. Hexagons are complicated. Plan ahead
  2. We learn how to GUI in java
  3. Minimax is hard to trace. Trace by hand. Think more before coding
  4. DIY heuristic function (for static evaluation board)

What's next for Three-Four

  1. Improve GUI
  2. Error checking for user
  3. Improve the alpha beta algorithm so it can cover more depths (instead of only 2 or 3)
  4. If major bugs are fixed then launch it in the app store

Built With

Share this project:

Updates