English, Technology, Web developmentTagged , , , , , , ,

Developing Game on The Web: Tic-Tac-Toe

So! This is yet another one of my project that I built while following the courses at FreeCodeCamp. It is a classic, the Tic-Tac-Toe game.

The game is simple enough, you can choose to whether play as X or O, then you can play against the computer. After you won (or lost, shame on you), the game will give you a notification and will bring you back to the main menu screen, so you can play another game. You can check it in action below (if you are having trouble viewing it, click on this link instead).

You might noticed that the CPU is very dumb. This is because I did not bother to implement the minimax algorithm to allow the CPU to take smart actions. You can click on the link to read more about minimax algorithm, but beware, it is a long read!

So, what I did was let the CPU put a mark on a randomly chosen available spots. That’s why most of the time, the CPU will make extremely retarded decision. If any of you would like to further improve this web I built, I would suggest you do so by implementing the minimax algorithm. Feel free to fork the codepen! (And leave a like, if you would be so kind 🙂 )

Overall, building this game was a good exercise for my front-end development skills. It’s nothing too complex really, and I am sure there are a lot of things that I could do better. If you want to give me a feedback, feel free to do so!

Leave a Reply