diff options
author | Raúl Benencia <rul@kalgan.cc> | 2015-03-28 17:04:01 -0300 |
---|---|---|
committer | Raúl Benencia <rul@kalgan.cc> | 2015-03-28 17:04:01 -0300 |
commit | 922eef24c4ee4116c51eaf175b55f71e94fce6c4 (patch) | |
tree | 68072d9e30b42952dc66692adf16fb45c52fb96e /include | |
parent | a7f2a09bce2d94c236469843d0815803edbf3574 (diff) |
use coordinates
Diffstat (limited to 'include')
-rw-r--r-- | include/coordinate.h | 42 | ||||
-rw-r--r-- | include/print.h | 7 |
2 files changed, 45 insertions, 4 deletions
diff --git a/include/coordinate.h b/include/coordinate.h index 52e7cf0..bc63122 100644 --- a/include/coordinate.h +++ b/include/coordinate.h @@ -4,9 +4,45 @@ #include "types.h" /* - * This functions will NOT alloc memory for the Coord pointer + * Does not check if s is a valid string representing. If input is + * untrusted, use coord_is_valid(char*) to check it. */ -int coord_init(Coord*, char, char); -int coord_init_from_str(Coord*, char*); + +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 c, char col); + +/* + * Set Coord row + */ +Coord coord_set_row(Coord c, char row); + +/* + * 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 diff --git a/include/print.h b/include/print.h index c17459f..0fcbe3a 100644 --- a/include/print.h +++ b/include/print.h @@ -5,6 +5,11 @@ void print_piece(Piece); void print_square(Square); -void print_board(Board); + +/* + * Pretty print the board. The Color parameter let you choose the + * orientation. Use WHITE for a white player perspective, BLACK otherwise. + */ +void print_board(Board, Color); #endif |