4 — The Game State
Due Wednesday, 20 October 2021, 11:59:59pm
Delivery Place the product of this week’s milestone into your repo as follows:
for the Programming Task, place
player-game-state.PP into Common/
referee-game-state.PP into a new Trains-level folder called Admin/
for the Design Task, place player-interface.md into Planning/
for the Visualization task, place xvisualize and Vis/ into a repo directory named 4
Since Python’s naming system is badly designed and its convention interfere with the specified name, Pythonistas may substitute _ for - in these file names.
All previous comments on code files apply.
Programming Task Design and implement two game state data representations: one for referees and one for players. An external representation of the second one will make up the key piece of information that flows from the referee to the players every time a referee grants a player a turn. The difference is spelled out explicitly in The Game: Trains.
given a player game state, determine all connections that can still be acquired;
given a referee game state, and a connection, decide whether it is legal to acquire this connection for the currently active player;
given a referee game state, produce a player game state that represents the knowledge of the currently active player.
The player will also communicate with the tournament manager. See Trains.Com, a Plan. You do not need to address this aspect yet.
Design Task The player components must communicate with the
referee, which manages and arbitrates the game. This communication
involves both function/method calls and orderings of those. (Recall
this is called a protocol.) Since outsiders will create AI
plauers to this interface, it must be spelled out precisely and in
detail. Hint To start your brainstorming—
An API is a documentation of a logical interface to a code library and its calling conventions.
Design the API for a player component. The document, named player-interface.PPmd should be a module in your language whose body is a wish list (signatures, interpretations, purpose statements).
Two pages should suffice. Less is more.
Keep in mind our Trains.Com, a Plan when you work on designs.
Visualization Task Create a visualization harness named
xvisualize. The harness consumes its JSON input—