-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_aux.c
59 lines (50 loc) · 1.32 KB
/
game_aux.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* @file game_aux.c
* @author Taraxtix (taraxtix.github.io)
* @brief Implements the auxiliary game functions
* @copyright Copyright (c) 2022
*/
#include "game_aux.h"
#include "game.h"
#include "game_examples.h"
#include "game_private.h"
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
/* ************************************************************************ */
/* AUXILIARY ROUTINES */
/* ************************************************************************ */
void game_print(c_game g)
{
assert(g);
printf(" ");
for (uint j = 0; j < (g->nb_cols); j++)
{
printf("%d", j);
}
printf("\n");
printf(" ");
for (uint j = 0; j < (g->nb_cols); j++)
{
printf("-");
}
printf("\n");
for (uint i = 0; i < game_nb_rows(g); i++)
{
printf("%d |", i);
for (uint j = 0; j < game_nb_cols(g); j++)
{
printf("%c", _square2char(g, i, j));
}
printf("|\n");
}
printf(" ");
for (uint j = 0; j < (g->nb_cols); j++)
{
printf("-");
}
printf("\n");
}
/* ************************************************************************** */
game game_default() { return game_new(DFLT_SIZE, DFLT_SIZE, dflt_squares); }