Thursday, March 5, 2009

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.

1 comment: