-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAtoms.h
68 lines (44 loc) · 1.28 KB
/
Atoms.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
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
#ifndef Atoms_h
#define Atoms_h
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
/** Struct definitions **/
/* Holds the dimensions */
struct dim {
int xDim;
int yDim;
};
/* all the data in an atom */
struct atom {
char player;
int x;
int y;
int limit;
int atoms;
struct atom *next;
};
/* the starting point of the list */
struct root {
struct atom *first;
int length;
};
/** Methods **/
/* Takes in dimensions */
struct dim *enter_dim(int x, int y);
/* Creates the list with 0 items */
struct root *createList();
/* Creates atom with info of grid space */
struct atom *createAtom(char player, int x, int y, int limit);
/* gives limits to grid spaces */
int assignLimit(int x, int y);
/* Checks if atom is present in gridspace, returns grid info if true, null if false */
struct atom *atomPresent(struct root *list, int x, int y);
/* Delete grid spaces and spreads atoms around according to limit */
void deleteAtom(struct root *list, struct atom *position);
/* When an atom is added, adds if grid space empty, or does other stuff */
bool addAtom(struct root *list, char player, int x, int y, bool chain);
void delete_list(struct root *list);
/* Shows the board */
void printBoard(struct root *list, struct dim *dim);
#endif /* Atoms_h */