Thursday, March 5, 2009

iPhone Journal 0xD


Once again, I exceeded my expectations. I finished all of the movement and jumping code, allowed for the "CINGO" move, added the ability to promote diamond pieces reaching the other side of the board, and even added a current player indicator and two counters that display the amount of pieces that each player has captured. I have allowed the iPhone to determine when a player has won, but this code does not yet take into account all possible ways to win, just the simplest.
Nevertheless, the game logic is essentially done and I now need to start working on a feature that I have used for only one application, and then did not fully understand: data persistence. I will also have to start implementing the three other views that the application will have when it is done: a new game panel for setting game preferences and beginning a new game, the change appearance panel that will allow the appearance of the pieces and board to be changed, and the information panel, which will display game instructions in a simple, readable format. I will most likely work on these in reverse order so that I will gradually become more comfortable with the code involved.
By the way, please do not judge my ability at CINGO from the video at the top of this post; it is intended to demonstrate all of the features I have currently implemented as quickly as possible, and not to demonstrate my strategic skill.

iPhone Journal 0xC

I have made immeasurable progress today! I planned to write the code for tapping a piece to select it and then tapping a different spot to move it there. In fact, I was able to finish this in the morning and early afternoon. I then limited piece selection to pieces of the correct color based on whose turn it is in the game. I implemented all of the code necessary to allow a piece to make multiple jumps but not multiple moves and then expanded the code to limit movement options based on piece type. Finally, I added the ability to capture enemy pieces by jumping over them and learned how to use Xcode's integrated debugger when my application froze and complained about memory access errors (I was trying to deallocate memory to free up RAM and ended up releasing several pointers that pointed to memory I actually needed). In addition to this movement code, I also added a button that switches the current player after a turn is complete to allow multiple jumps while not giving the user a hint as to jumps being available. A direct screenshot from my physical iPhone is presented below (Note that the white, circular pieces appear more distinct when viewed on the iPhone screen):


When I get back to work at a more reasonable time of day, I will try to finish the game-logic by allowing the "CINGO" move to be made (capturing a surrounded piece), will allow diamond pieces to become mixed pieces by reaching the other side of the board, will add code to keep track of captured pieces, and will make certain that it is actually possible to win.
After that, I will begin to work on a captured piece indicator, a current player indicator, and data persistence so that the game will be saved if quit, but I will certainly not have time to finish implementing these features. I also hope to add a short movie demonstration of moving pieces that I will add to my next journal.