Software Construction Assignment 5: Players |
Due: May 1, 2018 @ 10pm. Please include a README.txt that has both partners' names and email addresses. |
Design an interface (using whatever the most suitable construct in
your programming language of choice is) that represents players. It
should have the following operations:
get-name ;; -> string ;; Returns the players name initialize ;; color? (listof color?) -> void? ;; Called to indicate a game is starting. ;; The first argument is the player's color ;; and the second is all of the players' ;; colors, in the order that the game will be played. place-pawn ;; board? -> pawn-loc? ;; Called at the first step in a game; indicates where ;; the player wishes to place their pawn. The pawn must ;; be placed along the edge in an unoccupied space. play-turn ;; board? (set/c tile?) natural? -> tile? ;; Called to ask the player to make a move. The tiles ;; are the ones the player has, the number is the ;; count of tiles that are not yet handed out to players. ;; The result is the tile the player should place, ;; suitably rotated. end-game ;; board? (set/c color?) -> void? ;; Called to inform the player of the final board ;; state and which players won the game. The board, tile, pawn-loc, and color data definitions are yours to define as you see fit, but they must conform to some guidelines. The board should describe where the tiles are, and what orientation they are in. The board should also describe where each pawn is and what color it is. The pawn location should describe where a pawn is on the board and the possible colors are blue, red, green, orange, sienna, hotpink, darkgreen, and purple. The tile is never a dragon tile; it covers only tiles that can actually be played. Design and implement the following strategies as automatic players that implement the interface above:
The amount of symmetry in a tile is the number of different ways it can be placed. For example, the first tile in the tile list has only one way to be placed (in a given spot), no matter how it is rotated, the pathways are all the same. The last tile, in constrast has four different ways it might be placed, as all four rotations produce different pathways across the tile. Run a tournament to find out how these strategies perform. Is there a clear winning strategy? Is there a total ordering of the three strategies? Some hints on testing:
|
Software Construction |