On this page:
3.1 Revised Board Representation
3.2 Revised Game Protocol
3.3 Turn Checker
3.4 Handin Procedure

3 Santorini Checker and Player with Cards

Due: March 7

For this part, you must produce both a player program and a turn-checking program.

Building on Santorini Player, we’ll add support for the following cards from the “Simple Gods” set:

Note that these choices keep two aspects of the game the same: none of the cards require information about the game history, and all cards only extend the set of possible moves for a player (i.e., they don’t disallow moves that would be allowed without a card). Then again, since a token can be forced by Minotaur to level 3 without winning, checking for a winning board now depends on the immediately preceding board.

In a game, each player will have a distinct card, and a player’s turn is affected only by the player’s own card.

3.1 Revised Board Representation

To accommodate player cards, we redefine players from Board Representation, and we define two new terms:

All other definitions are the same modulo references to the revised term player.

For example, it player 1 has the Artemis card and player 2 has the Prometheus card, the JSON representation of

image

is

  {"turn":18,

   "players":[{"tokens":[[2,3],[4,4]],"card":"Artemis"},

              {"tokens":[[2,5],[3,5]],"card":"Prometheus"}],

   "spaces":[[0,0,0,0,2],[1,1,2,0,0],[1,0,0,3,0],[0,0,3,0,0],[0,0,0,1,4]]}

3.2 Revised Game Protocol

To accommodate player cards in the Game Protocol, we change the setup phase. Your Santorini player program will first receive a JSON array of one of the following shapes:

For example, to start a where player 1 has the Artemis card and player 2 has the Prometheus card, the player 1 program will receive

  [{"card":"Artemis"},

   {"card":"Prometheus"}]

A suitable response could be the following, which is sent on to the player 2 program:

  [{"card":"Prometheus"},

   {"tokens":[[2,3],[4,4]],"card":"Artemis"}]

If so, the player 2 program might reply like this:

  [{"tokens":[[2,3],[4,4]],"card":"Artemis"},

   {"tokens":[[2,5],[3,5]],"card":"Prometheus"}]

3.3 Turn Checker

Besides updating your player program to work with cards, write a turn-checking program. The turn-checking program should loop through the following steps until the attempt to read a string in the first step produces an end-of-file:

The same as for the player protocol, we’ll try your turn checking with JSON inputs that each fit on a single, newline-terminated input line.

As a class, we will collect a shared database of tests here:

http://crystalis.cs.utah.edu:2004/

Please don’t upload lots of automatically generated tests. Instead, add hand-crafted tests for interesting cases. Note that your name is associated to any test that you upload (using a password that has been mailed to you), so we’ll all know whether you’re contributing reasonably, over-contributing, or just taking advantage of everyone else’s contributions.

3.4 Handin Procedure

As usual, email the instructor an archive or a pointer to an archive (such as a link to Google Drive) that contains your source and a compiled version of your player and turn-checker programs. The compiled version should run on the CADE lab1-X.eng.utah.edu machines. Include a "README.txt" file that describes the path within your archive for the player and turn-checker executables.