Assignment 5 – Santorini: implementing a somewhat intelligent player and designing a referee
1 Reading
2 Build and test
3 Design

Assignment 5 – Santorini: implementing a somewhat intelligent player and designing a referee

Due Wednesday 10/31 11:59pm

1 Reading

Read this.

2 Build and test

Implement a Santorini player based on the interface you designed for assignment 4. Feel free to change the interface if you discover it is not suitable, but document these changes.

After you implement the player, wrap it in a test harness that reads JSON from STDIN and outputs JSON to stdout.

Your test harness should expect as input a sequence of commands encoded in JSON values of the shape:

["Place",Color,Initial-Board]

or

["Play",Board]

where

Color is either "blue" or "white;

Initial-Board is a valid Board as described in assignment 3 but without any buildings and without workers with color Color or without any workers at all;

Board is a valid Board as described in assignment 3 but with the extra restriction that there can be no workers at levels 3 and 4.

When your component consumes:

A ["Place",Color,Initial-Board], it should reply with a JSON list that contains two pairs of numbers, each between 0 and 4. The pairs correspond to placement positions for the workers 1 and 2 of the player in that order. A worker should be placed in the first unoccupied corner clock-wise starting from the top-leftmost corner of the board.

A ["Play",Board], it should reply with a JSON list of JSON values of the form [Worker,Directions], both as specified in assignment 3. The list should contain all the possible rule-respecting plays that do not allow the other player to win the game with their next move.

Your component should assume that every sequence of commands will consist of a "Place" command followed by a number of "Play" commands. Your component is not responsible to reply to invalid inputs including sequences of commands that do not follow the above pattern.

Deliverables: In your team’s GitHub repository, create a directory "Deliverables/5/5.2/" and deposit there your executable called “player-test-harness”, and input and expected output files for five tests. Your tests should correspond to sequences of valid commands as described above with well-defined outcomes. Moreover your executable should terminate after the input stream is closed as described in assignment 1. If you made changes to your player interface from assignment 4, deposit in the same directory a revised “design.my-language’s-extension" file.

3 Design

Design a Santorini referee component. The referee has to be able to receive two instances of your player component that implements the interface for players you have designed and manage a game of Santorini between these two players. If the referee detects that a player is attempting to violate the rules of the game it should abort the game and notify the cheating player that they lost and the other player that the won.

Your design document should include three parts (i) its interface that describes the operations the component provides together with their contracts and purpose statements, (ii) its dependencies that describe which operations of other components in your implementation the component intents to use and (iii) its knowledge that describes what information it needs to possess and maintain about the game.

As before describe the design in a mix of your programming language of choice and English comments. Also be careful to define every term that you introduce even if you use it in the English language parts of the design.

Deliverables: In your team’s GitHub repository, create a directory "Deliverables/5/5.3/" and deposit there a “design.my-language’s-extension" file.