summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaúl Benencia <rul@kalgan.cc>2015-03-28 19:42:26 -0300
committerRaúl Benencia <rul@kalgan.cc>2015-03-28 19:42:26 -0300
commitc9f4b4e74b34e9532f72019db4b597ee24d30b6f (patch)
tree860ce9588d633bef9bb90e548f01da85b84419a1
parentcf31f0866ef4f33890a56a48631a2440e801ba6c (diff)
clean board printing
-rw-r--r--lib/print.c5
-rw-r--r--main.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/print.c b/lib/print.c
index 8bf63fb..d584fcc 100644
--- a/lib/print.c
+++ b/lib/print.c
@@ -53,6 +53,7 @@ void print_piece(Piece p) {
}
void print_square(Square s) {
+ printf("| ");
if (s.piece == NULL)
if (s.color == WHITE)
putchar(' ');
@@ -60,6 +61,8 @@ void print_square(Square s) {
putchar('/');
else
print_piece(*s.piece);
+
+ putchar(' ');
}
/*
@@ -77,9 +80,7 @@ void print_board(Board b, Color side) {
printf("%c ", current_row);
// Print the square
- printf("| ");
print_square(board_get_square(b, c));
- putchar(' ');
// Shall we move forward or backwards?
c = _next_coord(c, side);
diff --git a/main.c b/main.c
index 7c70e7c..45a6970 100644
--- a/main.c
+++ b/main.c
@@ -6,8 +6,10 @@
int main() {
Board b = board_init();
+
print_board(b, WHITE);
print_board(b, BLACK);
+
board_delete(b);
return 0;
nihil fit ex nihilo