Bringing on the Board Games
Java FX technology provides you with a powerful tool to build your own full-screen games.
Understanding the Code
The code shown in Figure 1 creates a board layout.
Source Code
..... for(row in [0..9]) { rownumber = row; var y = bind dim - (sqSide + row * sqSide) + shifty; for (col in [0..9]){ //rows going forward LEFT -> RIGHT if (row mod 2 == 0) { sq = Squ{ xPos:bind col * sqSide + sqSide; yPos: bind y i: count } } else { sq = Squ{ xPos: bind dim - ( col * sqSide); yPos: bind y i: count } }//end else insert sq into blocks; count = count + 1 }//end each col for loop }//end each row for loop .....
Figure 1: Board.fx Class Snippet
Squares are created for each cell on the board sq in Board.fx, from either left to right or right to left based on the row number.
Source Code
if (row mod 2 == 0) { } else { }
Figure 2: Left-ro-Right or Right-to-Left Cell Order
Customizing the Code
If you want to reuse this code to create another board with rows oriented in the same direction, modify this code to create a cell in the same line.
Source Code
for(row in [0..9]) { rownumber = row; var y = bind dim - (sqSide + row * sqSide) + shifty; for (col in [0..9]){ //rows going forward LEFT -> RIGHT //all of them now. sq = Squ{ xPos:bind col * sqSide + sqSide; yPos: bind y i: count insert sq into blocks; count = count + 1 }//end each col for loop }//end each row for loop
Figure 3 shows the changed attributes in the game's Board.fx class.

Figure 3: Game in Progress