Appendix A: Case Study—Playing Checkers

In this appendix we will look at the logic in creating a checkers game. The intent is to demonstrate the logical need for an array to accomplish this mission. This example will provide several demonstrations on creating and updating a two-dimensional array. Arrays are commonly used in game development. It is not the intent of this example to provide the complete working code. There are many examples on the Web, if you are interested in the complete solution.

  1. 1. What is the first thing we do when we play checkers? Open the box and lay the board out on a table (Figure A-1 ).

    A420470_1_En_BookBackmatter_Fig1_HTML.jpg
    Figure A-1. Empty checkerboard ...

Get PHP Arrays: Single, Multi-dimensional, Associative and Object Arrays in PHP 7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.