Finally got ver 1.00 of my first game - TicTacToe completed. As usual, it's a NIB-less design. I have put everything in one "main.m" but it shouldn't be too difficult for you to split into separate files if required.
Link to full source code listed below, I tried to make the code looks tidy and put in as many comments as possible within limited time. Drop me some comments on the blog or email me if you need any further info.
Well, actually the 2 players mode has been fully working for a few days. It's just that in the single player mode, computer player wasn't "smart" enough until now.
Some information about the game:
1) I use "buttons" instead of "touch" events like the others
2) Originally I used NSMutableArray for "gameArray" (to store board status) and "checkWinArray" (to check each of the 8 possible winning conditions), but wasn't very comfortable about it. In the end both switched back to use simple arrays.
3) Original plan was to show a separate view for users to pick single/two player mode, but couldn't get it to work, so just use the UIAlertView.
1) Doesn't support device rotation "yet" --> will fix that later if I can find some time
2) Won't save application status if interrupted --> will fix that later if I can find some time
3) No music/sound --> I have to admit that I have read some examples from books/net about how to play music, but haven't actually try any, this will be for future versions.
I am not very sure if there's any memory leak as I am still not experienced with it, please let me know if you found any!! Please also kindly let me know if you found any bug or problem with it.
Oh yes, one more very important thing: So far, I wasn't able to beat the computer player in single player mode. Let me know if any of you can find a way to win her!!!
[UPDATE 1] Please see this post for TicTacToe V2.00
[UPDATE 2] Please see this post for TicTacToe V2.1 (Memory Leak Fixed)
Note: I quite like the "Take a kid fishing or hunting license" by Nicholas Vellios (http://www.vellios.com). To make it easier for people living in big cities like me, I slightly modified a bit and call it "Take your kids, family or love ones for a few hours of outdoor activity license"...ha ha...
Source Code for TicTacTow Ver 1.00 (Updated)