This project is due on 9/27 at midnight.
Submission Directory: project05 in your pair’s GitHub repository.
Your task is to design and implement a data representation of complete Acquire game states. The design choices are up to you.
Then you should implement your administrator API to progress through game states, using this data representation.
For a minimal external API, see task 2. Satisfying task 2 may or may not suffice for all other clients of this library.
You should also write a text file called admin-design.txt that describes the changes you needed to make to your administrator in the course of this project.
Your second task is to implement and deliver a test harness, dubbed admin-tester that responds to requests in the form of XML elements with responses. It should come with a subfolder, state-tests, with up to three test cases specified as a pair of files: inN.xml and outN.xml for N = 0, ..., 2. Each test case that exposes a flaw in some other code base gets you a bonus point. A test case that does not pass my reference implementation means a loss of one point.
The test harness must deal with four distinct kinds of requests. Each grammatically correct, valid, and semantically feasible request receives a State response; for others, the test harness issues an Error response.
setup = <setup player1=NN player2=NN player3=NN /> | <setup player1=NN player2=NN player3=NN player4=NN /> | <setup player1=NN player2=NN player3=NN player4=NN player5=NN /> | <setup player1=NN player2=NN player3=NN player4=NN player5=NN player6=NN /> place = <place row=Row column=Column> State </place> | <place row=Row column=Column hotel=Label> State </place> buy = <buy share1=Label> State </buy> | <buy share1=Label share2=Label> State </buy> | <buy share1=Label share2=Label share3=Label> State </buy> done = <done> State </done>
State = <state> Board Player ... </state> Error = <error msg=String />
Player = <player name=String cash=Cash> Share ... Tile ... </player> Board = <board> Tile ... Hotel ... </board> Hotel = <hotel name=Label>Tile Tile Tile ...</hotel> Tile = <tile column=Column row=Row /> Share = <share name=Label count=Nat /> Label = "American" | ... | "Worldwide" Row = "A" | ... | "I" Column = "1" | ... | "12" Cash = String, interpretable as a natural number (non-negative integer) Nat = String, interpretable as a natural number less than 26 NN = String, 20 chars or less
The response to a request is the state of the game that results from the execution of the required action on the specified state:
setup requests a brand new game state, which means an allocating of tiles to the named players;
place requests the placement of the specified tile on behalf of the current player and, if necessary, an action (founding, acquisition) on a specified hotel;
buy requests the acquisition of shares on behalf of the current player;
done requests the allocation of a replacement tile to the current player, if possible, and a switch to the next player in line.
If the state representation rejects a request, the response is an error message with an appropriate explanation. When the test harness receives such an error message from the state representation component, it throws away the remaining requests until STDIN is closed.
A State response specifies two kinds of information: the current state of the board and the current state of the players including the order of turns. The first player in a state representation is the "current player", i.e., the player whose turn it is.