On this page:
1 Implement Your Administrator
2 Build a new test harness
6.0.0.1

Project 5: 9/27

This project is due on 9/27 at midnight.

Submission Directory: project05 in your pair’s GitHub repository.

1 Implement Your Administrator

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.

2 Build a new test harness

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>

requests

State = <state> Board Player ... </state> Error = <error msg=String />

responses

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

common data

The response to a request is the state of the game that results from the execution of the required action on the specified state:

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.