-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.h
28 lines (25 loc) · 1.17 KB
/
header.h
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
#include <stdbool.h>
typedef struct WaterJug {
int capacity;
int fullness;
}WaterJug;
typedef struct ListElement {
struct ListElement *next;
WaterJug *waterJugL;
WaterJug *waterJugS;
}ListElement;
struct ListElement* pourLargeIntoSmall(struct WaterJug *source, struct WaterJug *dest); //c needs to be told when it's a pointer
struct ListElement* pourSmallIntoLarge(struct WaterJug *source, struct WaterJug *dest);
struct ListElement* newListElement(struct WaterJug *waterJug1, struct WaterJug *waterJug2);
ListElement* newListElement(WaterJug *waterJug1, WaterJug *waterJug2) ;
WaterJug *newWaterJug(int cap, int full);
ListElement* addHead(struct ListElement *head, struct ListElement *obj);
ListElement* addTail(struct ListElement *head, struct ListElement *obj);
ListElement* fillSmall(ListElement *listElement);
ListElement* fillLarge(ListElement *listElement);
ListElement* emptyLarge(ListElement *listElement);
ListElement* emptySmall(ListElement *listElement);
int checkGoalState(ListElement *currentElement);
ListElement* generateStates(ListElement *currentElement);
void addToListAndSolve(ListElement *headElement, ListElement *currentElement);
int decideNextAction();