summaryrefslogtreecommitdiff
path: root/include/coordinate.h
blob: 3a6a287613184ed06a26526bd34957ecf0b92930 (plain)
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
#ifndef _COORD
#define _COORD

#include "types.h"

/*
 * Does not check if s is a valid string representing. If input is
 * untrusted, use coord_is_valid(char*) to check it.
 */

Coord coord_init(char*);

/*
 * Returns 0 if c is the null coordinate
 */
int coord_is_null(Coord);

/*
 * Returns 0 if the coordinate is between a1 and h8.
 */
int coord_is_valid(char*);

/*
 * Returns the null Coordinate
 */
Coord coord_null();

/*
 * Set Coord column
 */
Coord coord_set_col(Coord, char);

/*
 * Set Coord row
 */
Coord coord_set_row(Coord, char);

/*
 * Get Coord row
 */
char coord_get_row(Coord);

/*
 * Get Coord column
 */
char coord_get_col(Coord);

/*
 * Returns the next coordinate. Useful for traversing the board forwards.
 */
Coord coord_next(Coord);

/*
 * Returns the previous coordinate. Useful for traversing the board backwards.
 */
Coord coord_prev(Coord);

#endif
nihil fit ex nihilo