aboutsummaryrefslogtreecommitdiff
path: root/voerbak/board.h
blob: 9b4c2f615e497b4411883220659b0feef3c02b88 (plain)
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
#pragma once
#include <stdbool.h>

/**
 * @brief Structure to store a board
 *
 * @param width Board width
 * @param height Board height
 * @param length Board state array length (width * height)
 * @param board Board state array
 */
typedef struct {
	int width;
	int height;
	int length;
	int* board;
} Board;

/**
 * @brief Create new board
 *
 * @param width Board width
 * @param height Board height
 *
 * @return Empty board
 */
Board* createBoard(int, int);

/**
 * @brief Print the board array
 */
void printBoard(Board*);

/**
 * @brief Check if the board is full (draw)
 *
 * @return `true` board is full
 */
bool boardFull(Board*);

/**
 * @brief Drop a disc into the board
 *
 * @return `true` if drop was successful, `false` if column full
 */
bool dropFisje(Board*, int, int);