How to Develop an iPad Board Game App: Part 2/2

In this second and final part of the series, you will keep score, add some nice animations, and add a computer opponent. In the end, you’ll have a complete and fun game. By Colin Eberhardt.

Leave a rating/review
Save for later
Share
You are currently viewing page 4 of 4 of this article. Click here to view the first page.

Where To Go From Here?

If you are interested in taking this application further, investigate Alpha-beta pruning. Alpha-beta pruning is an optimization to minimax, allowing it to search much deeper into the game tree without incurring as much computational overhead..

For a bit of fun, create two computer players by duplicating the line of code above in SHCViewController.m and watch your iPad play itself! In addition to being entertaining, it's also a great way to test that computer players with an increased depth of tree search actually play better than ones with a shallow tree depth.

By watching the two computer players, you will notice that the computer will decide on its move very quickly in the first few and the last few moves of the game. At these points, there are fewer potential moves for the computer to analyze, so it makes up its mind a lot more quickly!

Another great enhancement would allow the user to change the difficulty level. Higher values of maxDepth will make the computer smarter — and make the game more challenging!

If you wanted to see the completed project in all its glory, you can download the completed project here. Alternately, you can get the code from the project's GitHub repository, which has commits for each 'build and run' step of the tutorial.

I hope you enjoyed this tutorial. If you have any questions or comments, please join the forum discussion below!

Colin Eberhardt

Contributors

Colin Eberhardt

Author

Over 300 content creators. Join our team.