Java Reference
In-Depth Information
14.4
Add a menu item 'Select board size' to one of the menus. When selecting it, a
dialogue appears, prompting the user for the numbers of rows and columns.
On closing the dialogue, the board size is reset to the new values and the
blocks are arranged in the original configuration.
14.5
Change the way the user selects a move as follows: the direction panel is
removed. To make a move the user clicks on a block B .Ifthe empty place is in
the same row or column as B , then all blocks between the empty place and
B are moved, including B . The empty place then is at the former position of
B . Note that this requires changes in or re-implementation of many classes.
14.6
Implement the following GUI. There is a rectangular grid with n
m cells.
Initially the cells are empty. A red chip is placed into one of the cells. Then the
chip can be moved to another, different, cell. A yellow chip is put into the cell
of the previous position of the red one. There are always at most two chips
on the grid. The game can be restarted with an empty grid. See Figure 14.4.
×
14.7
Implement the following game (tic-tac-toe light). There is a rectangular grid
with n
3. Initially the cells are empty. Two players, called RED and
BLACK, take turns to place chips of their colour into empty cells. RED begins.
The game is over if one player has three chips next to one another in one row
or all cells are occupied. The game can be restarted with an empty grid. See
Figure 14.5.
×
n cells, n
Search WWH ::




Custom Search