The Fury of Dracula

The Hunt

introductionthe rulesthe datafaqthe view[the hunt]
courtesy Richard Buckland, John Shepherd, and many tutors

Marks: 100 (worth 7%)
Due: 23:59 Sunday 3th February 2019
Submit: give cs2521 assn2hunt

Objectives

Background

The aim for this part of the 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, giving it an appropriate View, 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 Game Engine then takes the move, records it, updates its own game state, and then move on to the next AI (in the order specified in the Rules). The interface for your AIs is very simple: they take a View as input, and send a new location and a message as their output.

Setting Up

Make a directory for working on this Assignment, change into that directory, and run the command:

2521 fetch assign2hunt

IMPORTANT NOTE

The GameView, DraculaView and HunterView ADTs supplied in this package don’t actually do anything; they’re the skeleton versions we supplied in Phase 1. If you want to preserve your current versions of these, copy them somewhere safe before running this command.

If you’re working from home, you can download the hunt.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
player.c
a very simple main program to drive your AIs
dracula.h
interface to the Dracula AI
dracula.c
skeleton implementation of the Dracula AI
hunter.h
interface to the Hunter AI
hunter.c
skeleton implementation of the Hunter AI
game_view.h
interface to the GameView ADT
game_view.c
skeleton implementation of the GameView ADT
dracula_view.h
interface to the DraculaView ADT
dracula_view.c
skeleton implementation of the DraculaView ADT
hunter_view.h
interface to the HunterView ADT
hunter_view.c
skeleton implementation of the HunterView ADT
places.h
interface to the Places ADT
places.c
partial implementation of the Places ADT
map.h
interface to the Map/graph ADT
map.c
partial implementation of the Map ADT

The GameView, DraculaView and HunterView ADTs supplied in this package don’t actually do anything; they’re the skeleton versions we supplied in Phase 1. If you want to preserve your current versions of these, copy them somewhere safe before running this command.

If you have working Views from the first part of the assignment that you’re happy with, use them. If you didn’t get the Views working, or if you’d prefer to use ours:

2521 fetch assign2huntviews

This will provide you updated versions of GameView, HunterView, DracView, and Map. These views are provided as-is; if it breaks, you get to keep the pieces. (These were written by students of COMP1927 14s2, but we’re pretty confident they work: we’ve used them for a few years, and most of the kinks have been ironed out.)

Note that many of above files are provided simply as a convenience, and you can replace them with your own versions if you want. The only interfaces that you need to honour precisely as given are those for the AIs (i.e. hunter.h and dracula.h. If you plan to include other ADTs with your code, you’ll need to add dependencies to the Makefile to ensure that they’re compiled.

If you run make after copying your own View ADTs into place you should see something like the following:

make
2521 3c    -c -o dracula.o dracula.c
2521 3c  -DI_AM_DRACULA -c player.c -o player_dracula.o
2521 3c    -c -o dracula_view.o dracula_view.c
2521 3c    -c -o game_view.o game_view.c
2521 3c    -c -o map.o map.c
2521 3c    -c -o places.o places.c
2521 3c   dracula.o player_dracula.o dracula_view.o game_view.o map.o places.o   -o dracula
2521 3c    -c -o hunter.o hunter.c
2521 3c  -c player.c -o player_hunter.o
2521 3c    -c -o hunter_view.o hunter_view.c
2521 3c   hunter.o player_hunter.o hunter_view.o game_view.o map.o places.o   -o hunter

Ultimately, it produces two executable files: ./dracula, which contains the Dracula AI; and ./hunter, which contains the Hunter AI. They both work similarly (not surprising, since they come from the same source code file): they create a View based on a pastPlays string, they then invoke the decide-a-move function, and finally print out the last move and message that function produced. For example:

./dracula
Move: CD, Message: Mwuhahahaha
./hunter
Move: TO, Message: Have we nothing Toulouse?

Note that we supply our own player.c when we run your AIs in the tournament. It does essentially the same thing as above, but additionally knows how to communicate with the Game Engine, and enforces a time limit on the AI. You can modify the supplied player.c as much as you want. In particular, you could change the pastPlays and messages that are used to build the View to test out how your AI will respond.

What to Do

The interface you need to deal with is very simple: there are two functions to decide the next move that a player should make:

void decide_hunter_move (HunterView state);
void decide_dracula_move (DraculaView state);

… along with a function to register potential moves:

void register_best_play (char *play, player_message message);

The register_best_play() function is already written for you, so all you need to do is implement the decide_..._move() functions, along with any auxiliary functions and ADTs that they require. The play is the two-letter code for some place on the Map of Europe (e.g. LO for London); the message can be any text string up to length MESSAGE_SIZE-1 chars.

First, think about a strategy for each kind of player and what info is needed to use that strategy. If that information is already provided by your existing View ADTs, simply use them; otherwise implement new ones. Then, use these View ADTs as a basis for implementing the two decide_..._move() functions. Finally, submit your work to The Hun0t. Repeat the previous two steps until you are satisfied with your AIs’ performance.

The Hunt

Periodically (at least daily), we will run a batch of Fury of Dracula games, using whatever AIs have been submitted (this is what we call a “Hunt”). These games will be monitored and marks awarded to the participating AIs based on (a) whether they work at all, (b) whether they follow the rules, and (c) how well they play the game.

How each session works:

Note that each game uses one ./hunter from one group to play all four Hunter roles (i.e. the same AI will be used to play Lord Godalming, Dr. Seward, Van Helsing, and Mina Harker). Also, we will ensure that your Hunter AI always plays against a Dracula AI from another group.

Since the marks are based on performance in the Hunts, it’s in your best interest to submit working AIs as soon as possible. Even submitting an AI that simply moves to a random reachable location is worth something (not much admittedly, but better than zero, which is what no AI or a non-functioning AI will score). You can submit as many times as you like; the most recent submission will be chosen for each Hunt.

More details on how you find out about the performance of your AIs in the hunt will be available shortly.

Submission

You should submit your Makefile, along with all of the .c and .h files that are needed to produce your players. This will include, at least:

If you change map.h, map.c, places.h, places.c, you should also include those in your submission. Also include any other ADTs that you develop that are needed for your Views or AIs.

You will need to set up your Makefile to ensure that it includes all of the appropriate files in the dependencies and rules. If your Makefile doesn’t work properly, your players won’t be included in the next tournament, even if all of the code is correct.

All submissions are made on behalf of the group, no matter which member of the group makes the submission. If several group members make submissions, only the most recent submission will be used.

To submit: