Teaching
670 S '05
 
Projects
Presentations
Programming
 
Carcassonne
Tiles
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 5

Due date: 2/11 @ noon

Objective: to create a test suite; to implement a testing framework if needed


The following table displays 11 graphs and their construction:

image of graphconstruction of graph
image
abbey1.ss
add tile "11" at (-1,0) with orientation 180
add tile "14" at (-1,1) with orientation 270
add tile "9" at (-1,2) with orientation 90
add tile "9" at (0,2) with orientation 180
add tile "9" at (1,2) with orientation 90
add tile "8" at (1,1) with orientation 0
add tile "6" at (1,0) with orientation 90
add tile "1" at (0,1) with orientation 0
image
abbey2.ss
add tile "1" at (1,1) with orientation 90
add tile "9" at (2,0) with orientation 0
add tile "9" at (2,1) with orientation 90
add tile "9" at (2,2) with orientation 0
add tile "8" at (1,2) with orientation 180
add tile "8" at (0,2) with orientation 90
add tile "6" at (-1,0) with orientation 270
add tile "5" at (-1,2) with orientation 270
add tile "4" at (-1,1) with orientation 270
add tile "2" at (1,0) with orientation 90
add tile "1" at (0,1) with orientation 0
image
abbey3.ss
add tile "16" at (2,1) with orientation 90
add tile "2" at (2,2) with orientation 0
add tile "2" at (2,0) with orientation 270
add tile "2" at (1,0) with orientation 90
add tile "1" at (0,2) with orientation 270
add tile "1" at (1,2) with orientation 180
add tile "1" at (1,1) with orientation 90
add tile "1" at (0,1) with orientation 0
image
castle1.ss
add tile "10" at (0,-1) with orientation 180
image
castle2.ss
add tile "14" at (1,-1) with orientation 180
add tile "14" at (0,-2) with orientation 90
add tile "14" at (-1,-1) with orientation 0
add tile "3" at (0,-1) with orientation 0
add tile "1" at (0,1) with orientation 0
image
castle3.ss
add tile "14" at (1,-1) with orientation 180
add tile "10" at (1,0) with orientation 0
add tile "8" at (0,-1) with orientation 90
image
castle5.ss
add tile "14" at (2,-2) with orientation 180
add tile "8" at (2,-1) with orientation 270
add tile "8" at (1,-2) with orientation 90
add tile "4" at (1,-1) with orientation 0
add tile "8" at (0,-1) with orientation 90
image
road0.ss
add tile "21" at (1,0) with orientation 90
add tile "2" at (2,0) with orientation 90
add tile "8" at (2,1) with orientation 180
add tile "8" at (1,1) with orientation 90
add tile "1" at (0,1) with orientation 0
add tile "2" at (-1,0) with orientation 270
image
road1.ss
add tile "19" at (1,0) with orientation 0
add tile "2" at (-1,0) with orientation 270
add tile "1" at (0,1) with orientation 90
image
road2.ss
add tile "19" at (2,0) with orientation 0
add tile "17" at (2,1) with orientation 180
add tile "7" at (1,3) with orientation 180
add tile "20" at (1,2) with orientation 270
add tile "22" at (1,1) with orientation 0
add tile "20" at (1,0) with orientation 0
add tile "14" at (0,2) with orientation 90
add tile "1" at (0,1) with orientation 0
add tile "2" at (-1,0) with orientation 270
image
road3.ss
add tile "22" at (0,2) with orientation 270
add tile "22" at (1,2) with orientation 180
add tile "22" at (1,1) with orientation 90
add tile "22" at (0,1) with orientation 0

Task 1: Each of these graphs contains regions, some counting as complete, some as incomplete. Turn each of these cases into a test case for complete-region. You will naturally use insert-tile to construct these graphs, so you will test this function implicitly. [POINTS: 6]

Task 2: Next turn each of the completed regions of these graphs into a test case for score. [POINTS: 6]

Task 3: Finally, use the graphs to test potential-locations-for-tile. [POINTS: 6]


In order to test the functions that find followers in a completed region and find places where players can place followers, I have found it convenient to develop a function that adds followers to graphs, regardless of whether it is legal or not to place them there at the moment:



   (define graph-tile<%>
    (interface (tile<%>) ;; the interface for the graph 
      ...  
      place-follower ;; Position Follower -> Void
      ;; effect: occupy the specified position on _this_ tile with the follower
      ;; ASSUME: the tile position is available 
      ... 
      ))


Using this function/method, you can modify the above graphs as follows:

image of graphconstruction of graph
img place RED follower at (0,1) INNER
img place RED follower at (0,1) INNER
img place BLUE follower at (0,-1) INNER
img place RED follower at (0,0) NORTH
img place BLUE follower at (0,-1) INNER
place BLUE follower at (0,-2) SOUTH
img place RED follower at (0,0) NORTH
place RED follower at (1,0) NORTH
place blue follower at (0,-1) INNER
img place RED follower at (0,0) NORTH
place RED follower at (2,-1) INNER
img place BLUE follower at (-1,0) EAST
img place BLUE follower at (-1,0) EAST
place RED follower at (1,0) EAST
img place BLUE follower at (-1,0) EAST
place RED follower at (1,0) EAST
place RED follower at (2,0) WEST
img place BLUE follower at (0,0) EAST
img place BLUE follower at (0,0) EAST
place BLUE follower at (2,0) EAST
place RED follower at (2,0) WEST
place BLACK follower at (2,0) SOUTH
img place BLUE follower at (0,+1) EAST

Task 4: Use the first set of graphs and the above to test the function that finds all the followers on the given region. That is, first extract the recently completed regions, then find all the followers on these regions. [POINTS: 6]

For potential-locations-for-followers, you can reuse the above, making sure that your methods don't reuse positions. Also, use generate the graphs below for additional scenarios:

img place RED follower at (0,0) EAST
img place RED follower at (0,0) EAST
img place BLUE follower at (2,1) INNER
img place RED follower at (1,0) NORTH

Task 5: Use these last two sets of graphs above to test the function potential-locations-for-followers, which figures out where followers can be placed. [POINTS: 6]


Product: Mail a tar bundle with your revised implementation and the client test in a single directory. Formulate one test suite per method or function; document the test suites and test cases so that readers know what they test. -- Explain in a README file whether the construction of the client test discovered any errors, and if so, what kind.


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