summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/board.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/board.c b/lib/board.c
index 6543bcc..3eb7603 100644
--- a/lib/board.c
+++ b/lib/board.c
@@ -3,54 +3,54 @@
#include "board.h"
-Board* _setup_colors(Board *b) {
+Board _setup_colors(Board b) {
int i, j;
for (i = 0; i < SIZE; i++)
for (j = 0; j < SIZE; j++)
if (i % 2) // Odd rows start with white
if (j % 2)
- b[i][j]->color = WHITE;
+ b[i][j].color = WHITE;
else
- b[i][j]->color = BLACK;
+ b[i][j].color = BLACK;
else
if (j % 2)
- b[i][j]->color = BLACK;
+ b[i][j].color = BLACK;
else
- b[i][j]->color = WHITE;
+ b[i][j].color = WHITE;
return b;
}
-Board* _pawns(Board *b) {
+Board _pawns(Board b) {
return b;
}
-Board* _rocks(Board *b) {
+Board _rocks(Board b) {
return b;
}
-Board* _knights(Board *b) {
+Board _knights(Board b) {
return b;
}
-Board* _bishops(Board *b) {
+Board _bishops(Board b) {
return b;
}
-Board* _queens(Board *b) {
+Board _queens(Board b) {
return b;
}
-Board* _kings(Board *b) {
+Board _kings(Board b) {
return b;
}
-Board* _setup_pieces(Board *b) {
+Board _setup_pieces(Board b) {
return _pawns(_rocks(_knights(_bishops(_queens(_kings(b)))))); // :-)
}
-Board* _initial_setup(Board *b) {
+Board _initial_setup(Board b) {
return _setup_pieces(_setup_colors(b));
}
@@ -65,7 +65,7 @@ Board board_init() {
b[i][j].piece = NULL;
}
- return b;
+ return _initial_setup(b);
}
int board_delete(Board* b) {
nihil fit ex nihilo