官术网_书友最值得收藏!

The GameBoard class

Now that we have a way to represent pieces in memory, the next logical step is to create a way to represent an entire board of playing pieces.

The game board is a two-dimensional array of GamePiece objects, and we can build in some additional functionality to allow our code to interact with pieces on the game board by their X and Y coordinates.

The GameBoard class needs to:

  • Store a GamePiece object for each square on the game board
  • Provide methods for code using the GameBoard to update individual pieces, by passing calls through to the underlying GamePiece instances
  • Randomly assign a piece type to a GamePiece
  • Set and clear the "Filled with water" flags on individual GamePieces
  • Determine which pipes should be filled with water, based on their position and orientation, and mark them as filled
  • Return lists of potentially scoring water chains to code using the GameBoard
主站蜘蛛池模板: 喀喇沁旗| 高要市| 教育| 恭城| 新蔡县| 秀山| 彩票| 合水县| 隆化县| 佛山市| 呼图壁县| 普陀区| 博兴县| 韶关市| 丰台区| 商都县| 卢湾区| 抚州市| 康定县| 西充县| 论坛| 娱乐| 古交市| 西乌珠穆沁旗| 雅江县| 柘城县| 诸城市| 东阳市| 渝中区| 砚山县| 仁怀市| 苏州市| 丰城市| 邢台县| 拉萨市| 德安县| 安徽省| 梨树县| 黄平县| 凤城市| 莱芜市|