The View
— introduction
— the rules
— the data
— faq
— [the view]
— the hunt —
courtesy Richard Buckland, John Shepherd, and many tutors
Marks: 100 (worth 8%)
Due: 23:59 Sunday 20th January 2019
Submit: give cs2521 assign2view
(No submissions accepted after 23:59 Monday 21nd January 2019)
Objectives
- to give you experience in implementing Graph-based ADTs
- to give you practice in implementing a well-defined interface
Background
The ultimate goal for this assignment is to write AIs that can play the “Fury of Dracula” game. The interface for the AIs is very simple: the Game Engine invokes the AI, waits for a certain amount of time while the AI thinks about its move (possibly suggesting several moves), and then takes the last move suggested by the AI. The AIs clearly need to know about the game state in order to decide on a move. Their access to the game state is via an appropriate View ADT: hunters use the HunterView ADT, and Dracula uses the DraculaView ADT. Both of these ADTs are layered on top of a generic GameView ADT. Your task in this phase of the assignment is to implement a version of these ADTs that your AIs can use.
Setting Up
Make a directory for working on this assignment, change into that directory, and run the command:
2521 fetch assign2view
If you’re working from home, you can download the view.zip file and then work on your local machine.
This will extract the following files in your directory:
Makefile
- a set of dependencies used to control compilation
game.h
- definitions of Game constants; interface to game engine
game_view.h
- interface to the GameView ADT
game_view.c
- skeleton implementation of GameView ADT
test_game_view.c
- main program containing a few tests for GameView ADT
dracula_view.h
- interface to the DraculaView ADT
dracula_view.c
- skeleton implementation of DraculaView ADT
test_dracula_view.c
- main program containing a few tests for DraculaView ADT
hunter_view.h
- interface to the HunterView ADT
hunter_view.c
- skeleton implementation of HunterView ADT
test_hunter_view.c
- main program containing a few tests for HunterView ADT
places.h
- interface to Places ADT
places.c
- partial implementation of Places ADT
map.h
- interface to Map/graph ADT
map.c
- partial implementation of Map ADT
past_plays
- some sample
past_plays
strings
Note that the Places and Map ADTs are slightly modified versions of the ADTs from the Week 4 Lab. They are very similar to, but not the same as, those ADTs; make sure you read them carefully before using them. You are not required to use the Map ADT, but it will probably save you some time. You are allowed to modify it (both .h and .c files) if you wish.
IMPORTANT NOTE
For this stage of the assignment, you must implement the supplied ADT interfaces completely unchanged (otherwise you’ll fail auto-testing). However, for the next stage of the assignment you can augment these ADTs as much as you like. You might want to maintain two versions of each View: one to submit for this stage of the assignment, and the other to hold the functions that you think would be most useful for your AI.
What to do: GameView
You have two tasks for this part of the exercise:
- design and build an implementation of the GameView ADT,
- write a comprehensive test suite to ensure that the ADT is working correctly
The first task requires you to complete the game_view.c
file.
You should not modify the game_view.h
file.
If you decide to use other ADTs,
these should be #include
‘d in the game_view.c
file,
not in game_view.h
.
Read game_view.h
carefully
to ensure that you understand
what each function is supposed to do.
Then, design data structures to support this,
then implement the functions
on top of these data structures.
You are free to use the supplied Map ADT,
and you are free to use
any other ADTs that you think will help.
Note that if you use other ADTs:
- you will need to add them into the Makefile, and
- you will need to submit them.
If you modify the Map ADT, you will also need to submit the modified version.
The second task requires you
to think about all of the cases
that your GameView ADT needs to handle
and come up with as many tests
as you can think of
to ensure that all cases are checked.
The supplied test_game_view.c
file
provides some tests,
to give an idea of what’s required,
but they are by no means comprehensive.
You should add as many
as you think are needed
to check that your ADT is working properly.
This is in your own best interests,
since, if you submit a buggy ADT to The Hunt
to support your AI,
then your AI will (by making enough invalid moves)
eventually be disqualified for that game,
and you will miss out on performance marks.
What to do: HunterView
and DraculaView
You have two tasks for this part of the exercise:
-
design and build an implementation of the HunterView and DraculaView ADTs
-
write a comprehensive test suite to ensure that both ADTs are working correctly
The HunterView and DraculaView provide views of the game state appropriate to either a hunter player or the Dracula player. They provide much the same functionality as the GameView ADT, but with some specialisations towards the needs and/or capabilities of the relevant players.
Some assumptions in the design of these ADTs:
-
they will be used by AIs in their
decide_{dracula,hunter}_move
function -
no AI will use the GameView ADT directly
-
the HunterView and DraculaView ADTs should use GameView in their implementation
-
the DraculaView ADT will only be used by the Dracula AI, and only when it’s Dracula’s turn
-
the HunterView ADT will be used by the Hunter AI, and will be used for all of the Hunter players
-
a Hunter AI can work out which Hunter player it’s currently running as by using the
hv_get_player()
function
You should use the same strategy for the design, implementation and testing of your HunterView and DraculaView ADTs, as you used in developing your GameView ADT, i.e.
-
read the
player_view.h
file to understand what each function is supposed to do, -
design a data structure that can support the required operations (will include a GameView value)
-
implement each of the functions specified in the
player_view.h
interface, using the skeletonplayer_view.c
file provided -
you may use other ADTs in implementing either or both of the playerView ADTs
-
these ADTs may not require much code of their own, since they rely on most of the work being done by the GameView ADT
-
once implemented, design a comprehensive set of tests, add them to the appropriate
test_player_view.c
file -
test, re-code, repeat … maybe with the occasional stop for eat and sleep
Once you have implemented and thoroughly tested all three ADTs, move on to the submission step.
Submission
You should submit all your Views and tests (and any additional ADTs) at the same time. Only one member of each Fury of Dracula group needs to submit.
To submit:
-
ssh into your CSE account (you can’t submit via the web)
-
change into the directory containing all of your files
-
test your submission with this command:
2521 dryrun assign2view files...
The above command will allow you to check that you are submitting sufficient files to at least enable your submission to compile. The dryrun tests your code against the provided tests.
-
submit your work with this command:
give cs2521 assign2view files...
You should also be able to submit via WebCMS.
Dryrun source code can be found in /web/cs2521/19t0/assignments/dracula/dryrun.view/.
Assessment
60 marks are derived from automated performance testing, where we check your implementation is complete and correct.
20 marks are subjective assessment of your code style.
20 mark is from manual and automated assessment of your tests.