#include #include #include "print.h" #include "piece.h" /* Printing related functions */ void print_piece(Piece p) { putchar(piece_character(p)); } void print_square(Square s) { puts("+-+\n|"); if (s.piece == NULL) switch (s.color) { case WHITE: putchar(' '); break;; case BLACK: putchar('/'); break; default: perror("Wait... what?\n"); exit(EXIT_FAILURE); } else print_piece(*s.piece); puts("|\n+-+"); return; } void print_board(Board *b) { int i, j; for (i = 0; i < SIZE; i++) { for (j = 0; j < SIZE; j++) { print_square(*b[i][j]); } putchar('\n'); } }