-
Notifications
You must be signed in to change notification settings - Fork 3
/
HunterView.c
104 lines (86 loc) · 2.81 KB
/
HunterView.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// HunterView.c ... HunterView ADT implementation
#include <stdlib.h>
#include <assert.h>
#include "Globals.h"
#include "Game.h"
#include "GameView.h"
#include "HunterView.h"
// #include "Map.h" ... if you decide to use the Map ADT
struct hunterView {
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
int round;
int currentPlayer;
int score;
////////////////////////////////////////////
///////Structs
//Individual arrays for each of size 5;(0,1,2,3 = hunters)4=drac
int *health;
int *location;
//possibly location of traps and vamps?
};
// Creates a new HunterView to summarise the current state of the game
HunterView newHunterView(char *pastPlays, PlayerMessage messages[])
{
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
HunterView hunterView = malloc(sizeof(struct hunterView));
hunterView->hello = 42;
return hunterView;
}
// Frees all memory previously allocated for the HunterView toBeDeleted
void disposeHunterView(HunterView toBeDeleted)
{
//COMPLETE THIS IMPLEMENTATION
free( toBeDeleted );
}
//// Functions to return simple information about the current state of the game
// Get the current round
Round giveMeTheRound(HunterView currentView)
{
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
return currentView->round;
}
// Get the id of current player
PlayerID whoAmI(HunterView currentView)
{
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
return currentView->currentPlayer;
}
// Get the current score
int giveMeTheScore(HunterView currentView)
{
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
return currentView->score;
}
// Get the current health points for a given player
int howHealthyIs(HunterView currentView, PlayerID player)
{
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
return currentView->health[player];
}
// Get the current location id of a given player
LocationID whereIs(HunterView currentView, PlayerID player)
{
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
return currentView->location[player];
}
//// Functions that return information about the history of the game
// Fills the trail array with the location ids of the last 6 turns
void giveMeTheTrail(HunterView currentView, PlayerID player,
LocationID trail[TRAIL_SIZE])
{
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
}
//// Functions that query the map to find information about connectivity
// What are my possible next moves (locations)
LocationID *whereCanIgo(HunterView currentView, int *numLocations, int road, int sea)
{
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
return NULL;
}
// What are the specified player's next possible moves
LocationID *whereCanTheyGo(HunterView currentView, int *numLocations,
PlayerID player, int road, int rail, int sea)
{
//REPLACE THIS WITH YOUR OWN IMPLEMENTATION
return NULL;
}