Reformat code with help of utility functions

This commit is contained in:
Ole Morud
2023-03-26 19:14:59 +02:00
committed by Ole Morud
parent 44c2ae5290
commit 4155ed3e87
4 changed files with 120 additions and 84 deletions

View File

@@ -11,8 +11,8 @@ typedef ptrdiff_t index_t;
#define BOARD_SIZE ((index_t)(8 * 8))
#define WHITE 1
#define BLACK -1
#define WHITE ((tile_t)1)
#define BLACK ((tile_t)-1)
#define E ((tile_t)0) ///< empty tile
#define K ((tile_t)1) ///< king

View File

@@ -1,9 +1,11 @@
#include "common.h"
int64_t get_sign(int64_t n);
bool tile_empty(tile_t t);
index_t abs_index(index_t i);
index_t column(index_t i);
index_t row(index_t i);
tile_t abs_tile(tile_t t);
tile_t get_color(tile_t t);
bool same_color(tile_t a, tile_t b);
bool opposite_color(tile_t a, tile_t b);