Java代写:CS2003 Othello

代写游戏Othello,也就是黑白棋。

Requirement

As I mentioned in class, I am the director of the computer gaming and simulation major at TU. So, as you guessed, I think we should build a game.

This year, I am in the mood to play a classic board game called Othello (I strongly recommend you look this up on the web). Othello is a two-player that is played on an 8X8 board. There are 64 identical game pieces, called discs, which are white on one side and black on the other. Players take turns placing discs on the board with their own color facing up.

The game starts with four pieces placed in a diagonal pattern in the center of the board (see below)

The first player to move is the black player. The player may only place a piece in a position that there exists at least one straight line between the new piece and another black piece with one or more white pieces between them For example, the gray pieces in the figure below show the eligible places that black can move

Once black piece is placed, all of the white pieces that lie in a straight line between the new piece and a black piece are flipped. For example, one possible move for black is shown below.

Players take alternating turns. If a player does not have a legal move, they can pass their turn to the other player. The game ends when 1) the board is filled or 2) neither player has a legal move. The winner is determined by the player with the most pieces turned up with their color.

Now, I understand that you likely do not know how to use graphics, so I want to simplify the problem for you. Instead of graphics, I would like you to use ASCII art. Below is an example of the board above in ASCII art. I am using the B to indicate a black piece and W to indicate a white piece.

Your job will be to construct a game that has the following functionality:

  1. When started, the program should draw the board using ASCII art.
  2. Next the black player should be asked for a move. I suggest allowing them to enter the board location as an X and Y value. They may also pass or quit.
  3. Your code should prevent them from making illegal moves and from entering bad data.
  4. After they select a valid position, your code will flip the correct pieces and redisplay the board. At this point it is the next players turn.
  5. Your code should determine if the game is over and declare the winner. Then ask if they would like to play again.
  6. You must include Javadoc comments for the public classes and methods in your code. These should include parameters and return annotations. You must also perform proper exception handling.
  7. Submit your assignment as a single ZIP file (no RAR files) to Harvey by the due date.

This is a lengthy and fairly difficult assignment. Don’t hesitate to talk to either myself or your TA if you run into trouble. You will be graded on proper use of class structure, documentation, the operation of the software, and your coding style. Keep in mind the things I’ve talked about in the lectures concerning use of constants, classes, methods, etc