Last month, I was busy with my defense and the graduating administration stuff. Thankfully, things have been slowing down this month and I finally got some time to kill (and by kill I mean update my blog and my shared MATLAB fun toolbox). So, I though a lot about what games to create last week and decided to do ‘Othello’.
Othello is a pretty common game. It is about placing black and white chip in a 8×8 board but when you place your chip, your chip must block the opposing-color chip so that the opposing chip swaps into your color. The game play itself is pretty simple but there are a lot of strategies in it and it is pretty fascinating. That’s why I decided to create this game.
Using my TicTacToe m-file as the template for its gameplay algorithm and it GUI, I finally finished this code (the Othello code) last night. Unfortunately, I haven’t have the time to search for the best AI (Artificial Intelegence) algorithm for the computer as the opponent. So I just made the computer to choose a move that give the most swapping for every turn. No strategic move or anticipation for the next turn. That’s why the computer will be fairly easy to beat if you know the basic strategy of playing Othello (for example, trying to get the box at the board’s edge and so on). However, I’m planning to improve it later on (and I hope I do:D). For now, I’m just gonna wrap it up and here is the screenshot of my Othello code:
To make it nicer, I incorporated a simple animation when the color swapping takes place. The chips will gradually change color from white to black or vice versa. Here is the video of me playing my code to show you the animation that I incorporated in my code. I’m sorry for the bad quality though, because I took this using my cellphone. (Yeah, I’m too lazy to find a decent screencapturing software).
As usual, this code is downloadable from my MATLAB Fun Toolbox page. Your critics and comments are extremely wanted, especially for the AI of the computer. Lastly, I want to say that I hope you enjoy the game:D.
Update for this post: MATLAB Othello and MATLAB Snake – A Better Video Demo