Question: The game StopGate is played on a checkerboard with a set of dominoes; each domino is large enough to cover two checkerboard squares. One player

The game StopGate is played on a checkerboard with a set of dominoes; each domino is large enough to cover two checkerboard squares. One player places a domino horizontally on the checkerboard, covering any two squares. The other player then places a domino vertically to cover any other two squares. When a player has no more moves available, that player loses. Create a computerized version of the game in which the player places the horizontal pieces and the computer randomly selects a position for the vertical pieces. (Game construction will be simpler if you allow the player to select only the left square of a two-square area and assume that the domino covers that position plus the position immediately to the right.) Use a different color for the player’s dominoes and the computer’s dominoes. Display a message naming the winner when no more moves are possible. Figure 15-45 shows a typical game after the player (blue) and computer (black) have each made one move, and near the end of the game when the player is about to win—the player has one move remaining, but the computer has none. Save the file as StopGate.java.

Stop Gate Stop Gate Figure 15-45 A typical game of StopGate just after play begins and near the end of the game

Stop Gate Stop Gate Figure 15-45 A typical game of StopGate just after play begins and near the end of the game

Step by Step Solution

3.39 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javaawt import javaxswing import javaawtevent import javaawtColor Player moves horizontally Computer moves vertically public class StopGate extends JFrame implements MouseListener final int ROW... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming 8th Questions!