Java代写 | Implement PSynthesisPP as A Computer Game In Java

本次德国代写主要为Java GUI游戏相关的assignment

Implementation

Implement PSynthesisPP (see game rules) as a computer game in Java.

 

  1. general
  2. All classes and interfaces belong to a package starting with psynthesispp.
  3. The given classes and interfaces of the package preset may not be changed.

However, it is allowed to extend the following classes directly (for more information see the corresponding section of the project description).

Viewer           May be extended with additional functions. Existing functions must not be changed.

ArgumentParser          May be extended by further parameters.

Extension by inheritance is allowed for all classes, enumerations and interfaces of the package psynthesispp.preset.

Methods of the player classes (see Player and Main Program) may only use instances of exactly the classes from psynthesispp.preset as arguments and return values. Therefore, if you want to extend Move, Hexagon, etc., you should not use inheritance but embedding these classes in wrapper or container classes.

  1. Comment the source code in detail. Use JavaDoc for the Application Programming Interface (API) and comment as usual.
  2. Use Ant to automatically compile the program and create the documentation.

 

  1. game board

Create a game board class with the following features.

  • The interface preset.Playable is implemented.
  • A playfield has size k, with 1 ≤ k ≤ 5.
  • There is a constructor that is passed only the playfield size as int. Needed to be able to test the game board in an automated way.
  • valid moves are detected.
  • If no further move can be accepted, e.g. because the game is already finished, but an attempt is still made to make a move, this must be responded to with an IllegalStateException.
  • The first accepted move always belongs to the red player.
  • A move is an object of the class preset.Move. A move always has one of the following formats.
  • The type preset.MoveType.End and no references.
  • The type preset.MoveType.Surrender and no references.
  • The type preset.MoveType.Prepare and a reference to an object of the class psynthesispp.preset.Hexagon for a move in the preparation rounds.
  • The type preset.MoveType.Empty and no references for an empty move in the action phase.
  • The type preset.MoveType.Activate and a reference to an ArrayList of Integer for the move Activate in the action phase.

List entry with index 0 determines the number of seeds, entry with index 1 ≤ i ≤ k determines the number of trees of size i to be activated. The list does not have to contain k + 1 elements, for non-existing element the value 0 is assumed.

  • The typepreset.MoveType.Plant and a reference to an ArrayList of psynthesispp.preset.HexagonTuple for the move plants in the action phase.
  • The type preset.MoveType.Grow and a reference to an ArrayList of psynthesispp.preset.Hexagon for the move Grow in the action phase.
  1. h) The interface preset.Viewable is implemented.

 

 

  1. input and output
  2. a) Create a class that implements the preset.Viewer interface.

This class should allow to get all the information needed to view a game board object without allowing access to the attributes of the game board object.

The viewer() method of the game board returns a matching object of this class. For this reason, the game board class must contain all the necessary functionality to implement the functions of the psynthesispp.preset.Viewer interface.

  1. b) Create a text input class that implements the preset.Requestable interface.

The method request(MoveType) requests a move, in one line, from standard input and returns a matching psynthesispp.preset.Move-object.

Use the static method parse(String, MoveType) of the Move class to convert the string read in from standard input into a Move object.

The method parse throws a psynthesispp.preset.MoveFormatException if the read-in fails. This exception must be responded to in a meaningful way.

  1. c) Design an interface for the output of the board. Use the preset.Viewer interface to pass information about the game board to the displaying class.
  2. d) Create a graphical input/output class. This class implements thepreset.Requestable interfaces and the output interface you wrote, and uses an object of a class that implements the psynthesispp.preset.Viewer interface for simple graphical output.

Make sure that the display of the game board, active and passive supplies, etc. is adapted to the size of the window and scales along when the window is resized. All information about the state of the game must be the graphical output (e.g. winner at the end of the game).

Note

Do not invest too much time in the design, because it will not be evaluated.