I’m currently translating an implementation of a checkers game from Ruby into Java. I want to know how to best represent a fixed 8 x 8 board of either checkers objects or null spaces, as necessary. In Ruby I simply designated the board as an array of arrays and leveraged Ruby’s dynamic nature to included Checker objects where I needed them and use the otherwise nill value in the rest of my methods. I’ve attempted to use an ArrayList of ArrayLists, but I’m having problems with that approach and, since it’s re-sizeability is a big feature, it feels like the wrong structure for my situation. Any help is appreciated.
Steve G.
Since on a checker board, only the black squares matter, you’ve really got an 8*4 board. You can represent this by a single, two-dimensional, 8*4 array of