Teaching
670 S '07
 
Projects
Presentations
Programming
 
Squadron Scramble
Aircrafts
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 13

Project 9

Due date: 3/16 : NOON

Running a Turn, Enforcing Contracts

Task 1: [POINTS: 20] Your first task is to equip your implementations of turn and play-one-turn with behavioral and temporal contracts as described in the Contracts Specifications. The goal of these contracts is to prevent ill-behaved players from crashing the server or from upsetting its basic internal invariants.

You may either implement the contracts manually or through the use of a contract system for your language. A contract error must signal an exception from which the overall program may recover. Note: you are better off learning how to use a contract system than writing your own. As far as I know, all chosen languages provide some basic contract system though none of them provide sound ones.

Task 2: [POINTS: 20] Your second task is to equip your test harness of Project 7 with capabilities for checking test cases concerning contract violations. That is, if the (proxy-)player violates the contract with turn or play-one-round, the test harness must report the violation on stdout. See MESSAGE3.txt for the revised and extended language of test cases.



SEQUENCE DIAGRAM

               TESTER      
                |
< - I/O : 1 --->| 
                |  create()
           pp = |-----------------------------------> ProxyPlayer 
                |                                         |
                |                                         |
                |  create / run-one-turn()                |
                |----------> Administrator                |
                |              |                          |
                |              | create()                 |
                |          t = |----------> Turn          |
                |              |              |           |
                |              |------------------------->|  take-turn(t)
                |              |              |           |  
                |              |              |           | < --- I/O : 2 --->
                |              |              |           |  
                |              |              |<----------| get-a-card-from-deck() 
                |              |              |<----------| get-cards-from-stack(n)
                |              |              |           |  
                |              |<=========================| done 
                |              |              |        ======
                |              |              |        ======
                               |------------->|             end()
                               |            =====
                               |            =====
< - I/O : 3 --->|
  
                
I/O 1: TESTER reads a _xtrn_ with all the necessary items
       for the Administrator from standard input. 
I/O 2: ProxyPlayer reads as many _mesg_ from standard input as there are
       and then one _done_. 
       The _mesg_s are turned into appropriate method calls. After
       it reads _done_, the ProxyPlayer finishes its turn and returns the
       specified information. 
I/O 3: TESTER writes either a CONTRACT _resp_, a TIMING _resp_, or 
         bool  %% is this the end of the battle?
         borc  %% the return card (or false)
         slst  %% the discards 
         from  %% did the player take the cards from the stack or the deck?
         atta  %% (possibly empty) series of attacks
       to standard output, then closes the port.

The formats of the external representations is a minor revision of the
old XML data definitions, including MESSAGES2. 

For your convenience, they are collected in one file: MESSAGES3.


Task 3: [POINTS: 0, see below] The third task is to develop test cases for your administrator that ensure that it can deal with esac-type test cases as before and that is also deals with CONTRACT and TIMING errors properly.

POINTS: The base score for Task 2 is 0 points. We will run our own test administrator for all test harnesses on our test cases. We will also run all submitted test cases on our test harness.

(1) You will receive a point for each test case that discovers an error in our interaction module. If distinct test cases discover the same error in someone else's code, you don't get more than one point. (2) You will lose one point for each test case that contains an error. (3) You will not receive fewer than 0 points (though we will display the negative points in the chart).

Task 4: [POINTS: 5] When the game administrator hands a turn to a player, the latter should protect its integrity with contracts about the cards that it may receive information about through the turn. Formulate such contracts in plain English and explain how we can get some of the necessary information already and what we would need to add to get the rest. See EXERCISE in Contracts Specifications.


last updated on Tue Jun 9 22:03:19 EDT 2009generated with PLT Scheme