The grades for the use case of project 4 are quite lenient. Please study this sample solution carefully so you can improve on your submissions. I have added meta-comments for you to see which elements I use.


		The Turn in an Ingenious Game [need title]
		   Matthias Felleisen [need author]

A game turn is a series of activities. It is thus best to use sequence
diagrams to sketch out what happens. 

the human scenario [subtitle, followed by short comment]

See the attached sequence diagram for our
understanding of how players take turns during an Ingenious game. The "man
in charge, dubbed administrator, tells a player that
it is his turn, granting the player access to both the game board and the
bag of unused game tiles. The player inspects the boards to determine where
to place tiles and places tiles as long as he is allowed and able to do
so. Other players observe, and their scores are visible so that the player
can take them into account during his planning.

the software scenario

Since the player software is third-party software, we must protect the
central data structures from abuse (intentional cheating, accidental
misuse). While it is easy to grant 'read-only' access to the players'
scores, the board itself demands protection. We therefore introduce a proxy
object, dubbed turn, that controls all access to the game board
during a turn. 

See the attached sequence diagram for how the
turn is constructed, how it is handed to the player, how the player use it
to inform itself, and how it informs the turn of its tile placement
decisions. The turn proxy must also hand the player bonus tiles (up to
six), as required by the rules of the game. 

the turn interface, and the use case

When it is a player's turn, the administrator creates a turn proxy and
hands it, together with the other players' scores, to the player. 

* The creation of the turn requires enough information to decide whether a
  tile placement is legal; which score the player receives for a tile
  placement and whether this enables bonus placements (one or more);  and
  which tiles the player receives in return for placing a tile. 

* At a minimum, the player must use the turn to place a tile and to receive
  one in return. This suggests a method for the turn of the following

  	 placeTile : TileColor x Coordinate TileColor x Coordinate -> Tile 
	 // placeTile(t1,c1,t2,c2) means that a tile t labeled with colors
	 // t1 and t2 is placed at hexagons c1 and c2. The return value is 
	 // the tile that the player obtains in return. 

* To determine whether a placement is legal, the turn may impose contracts
  on the placeTile method, and these contracts may demand additional

* Once the turn is over, the administrator must 'disable' the turn so that
  the player can no longer use it to interact with the board. 
  [fake, but see how this interacts with choice of language]
  Since we haven't decided yet whether to use a memory-managed or an unsafe
  language, we have two possibilities. In an unsafe language, the
  administrator code can call a destroy method. In a memory -managed
  language, the turn object should come with a method that disallows all
  further interactions:

  	  end : -> void 
	  // disable all future interactions 

  and the administrator should call this method when the player's take-turn
  method returns.  


This sample homework use the 'pre' style to show how a simple type writer description suffices. No fancy type setting required!