Teaching
6515 S '13
 
Projects
Presentations
SVN
 
Acquire
Acquire, Revised
Acquire Plan
Project 1
Project 2
Project 3
Project 4
Project 5
Project 6
Project 7
Project 8
Project 9
Project 10
Project 11
Project 12

Project 11

Due date: 4/08, 23:59

Objective 1: to implement changes to the player interactions

Objective 2: to plan for turning this interface into a remote interface


Task 1: After careful study, your company has decided to modify the interactions between the Acquire game supervisor and the players:

  1. setup Once all players have signed up with the administrator, the latter broadcasts the initial state of the game. Players can read but not manipulate the state they receive.
  2. take turn (without merger) To initiate any kind of turn, the administrator hands the players a proxy project with appropriate access to all aspects of the current state. Unless a merger takes place, the player simply tells the administrator which tile it wishes to place, which hotel to found (if any), and which shares it wishes to buy.
  3. take turn (with merger) If a merger takes place, the player must use the proxy object to call the administrator. The latter will then ask all players whether they wish to sell their shares in the acquired hotel(s). After all the players have been queried, the current player is informed of their decision and can then make its purchase decision. The purchase order is returned as the result of the turn.
  4. end of turn Both kinds of turns end with the assignment of a new tile to the current player (if possible), and a complete round of calls to all players to inform them about the new state of the game.
  5. end of game The administrator scores the end of the game when it discovers that the game has ended. It sends an appropriate message to all players.
The classification of turns into those that place singleton tiles or growth tiles versus merger tiles represents another change to the rules of the game, because players can now sell shares back to the administrator.

The table below specifies the game protocol via interaction diagrams. This protocol is closer to the way the physical game is played than what we have used so far.


 administrator 
  +
  |           player 
  |             +
  |   signUp    |     
  |<------------|     String signUp(String name,IExternalPlayer self)
  |    name     |     returns actual name used 
  |============>|     
  |             |
sign up

 administrator   player 
  |             |
  |    setup    |     
  |------------>|     void setup(IState s)
  |             |     send out list of with between 3 and 6 players
  |             |     IState: provide read access to the current state of game
start

 administrator   player1 ... playeri ... playern, it is playeri's turn
  |             |             |             |
  |         take turn         |             | 
  |-------------------------->|             | Tuple<Tile,Option<Hotel>,BuyOrder> takeTurn(ITurn t)
  |   tile, hotel, buy order  |             | the player places a tile, optionally involving
  |<==========================|             | a hotel, and buys some number of shares 
  |             |             |             |  
  |             |             |             | ITurn specifies a proxy object that enables 
  |             |             |             | the player to read-access the current State 
  |             |             |             | including the state of players 
  |             |             |             |  
  see end of turn 
turn without merger

 administrator   player1 ... playeri ... playern, it is playeri's turn
  |             |             |             |
  |         take turn         |             | Tuple<Tile,Option<Hotel>,BuyOrder> takeTurn(ITurn t)
  |-------------------------->|             | see above for ITurn 
  |             |             |             | 
  |      place(tile, hotel)   |             |  
  |<--------------------------|             | List<IPlayer> t.place(Tile, Hotel h)
  |             |             |             | place a tile and cause a merger where h is acquirer
  |             |             |             | return who keeps the shares for acquired hotels
  |             |             |             | 
  |          keep()           |             | 
  |-------------------------->|             | List<Boolean> keep(List<Hotel>) 
  |         true/false        |             | decide whether to keep the shares 
  |<==========================|             | of the specified hotels
  |             |             |             |
  ........................................... 
  |             |           keep()          |
  |---------------------------------------->|  
  |        true/false         |             |   from i to n, and 1 to i-1
  |<========================================|
  |   keep()    |             |             |
  |---------------------------------------->|  
  | true/false  |             |             |
  |<============|             |             |
  ........................................... 
  |             |             |             |
  |          place()          |             |  
  |==========================>|             | List<IPlayer> : playeri can now read-access
  |             |             |             | this new state of the players to see which one kept
  |      tile, hotel, buy     |             | or old its shares of the acquired hotel(s)
  |             |             |             |
  |        take turn(.)       |             |
  |<==========================|             | BuyOrder : the shares that the player wishes to buy 
  |             |             |             |
  see end of turn 
turn with merger

  condition: if the administrator has tiles left

 administrator   player1 ... playeri ... playern, it is playeri's turn
  |             |             |             |
  |  newTile    |             |             |
  |-------------------------->|             |  void newTile(Tile)
  |             |             |             |  assign player new tile 
  |             |             |             |
  |  inform     |             |             |
  |------------>|             |             |  void inform(IState) 
  |<==========================|             |  like setUp
  ...........................................    from 1 to n 
  |                 inform                  |
  |---------------------------------------->| 
  |<========================================|
  |             |             |             |
end of turn

 condition: the administrator has discovered that the game is over 

 administrator   player1 ... playeri ... playern 
  |             |             |             |
  | end of game |             |             |
  |------------>|             |             |  void endGame(IScore t, IState s)
  |<==========================|             |  inform players that the game is over 
  |             |             |             |   and of final score 
  ...........................................     from 1 to n 
  |             |             |             |
  |                 end of game             |
  |---------------------------------------->| 
  |<========================================|
  |             |             |             |
  |             |             |             |
end of game

The red "signatures" explain in a Java-like language what kind of information the calls and returns in this protocol are expected to carry. It applies to any code base, typed and untyped ones. Note that it is impossible to implement the protocol with Java because the decision of whether a player causes a merger is up to the player and not the administrator.

We will test your project with the game test harness (not tests) from project 9. From a semantic perspective, the tests require that your players always sell their shares when a hotel is required; in a real-world game, this is not the case. It is up to maintain the player query interface to the tree (and its externally visible results do not change).

Task 2: Design a data exchange protocol so that the above internal interface can be turned into a network (remote) interface.


last updated on Wed Apr 10 20:51:12 EDT 2013generated with Racket