-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame.h
88 lines (66 loc) · 2.57 KB
/
game.h
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/** @file game.h
* @brief game header file.
*
* This header contains the prototypes for the game module.
*
* @author Itay Keren (itaykeren)
* @author Rotem Bar (rotembar)
*
*/
#ifndef SUDOKU_GAME_H
#define SUDOKU_GAME_H
/* -- Includes -- */
#include "linked_list.h"
#include "main_aux.h"
/** @brief Returns a new empty sudoku board of the appropriate size.
* @return an empty sudoku board
*/
cell** generate_empty_board();
/** @brief Copies a given sudoku board.
* @param source_board to be copied, remains unchanged.
* @param new_board to which source_board will be copied.
* @return void.
*/
void copy_board(cell** source_board, cell** new_board);
/** @brief Prints a given sudoku board.
* @param board to be printed.
* @param mode game mode to print board according to relevant restrictions.
* @return void.
*/
void print_board(cell** board, char mode);
/** @brief Returns and prints sudoku board to be edited in edit mode (loaded from file or newly 9X9 generated)
* returns NULL if function fails.
* @param parsedCommand after user input was parsed.
* @param mode game mode to print boart according to relevant restrictions.
* @return sudoku board.
*/
cell** edit_command(char* parsedCommand[4], char mode);
/** @brief Returns and prints sudoku board to be solved in solve mode (loaded from file)
* returns NULL if function fails.
* @param parsedCommand after user input was parsed.
* @param mode game mode to print board according to relevant restrictions.
* @return sudoku board.
*/
cell** solve_command(char* parsedCommand[4], char mode);
/** @brief frees allocated memory of given sudoku board
* @param board sudoku board to be free.
* @return void.
*/
void free_board(cell** board);
/** @brief frees given command and exists the game
* @param command to be free.
* @return void.
*/
void exit_game(char* command);
/** @brief executes user-entered game command.
* prints appropriate massages and updating board and moves list when required.
* @param parsedCommand after user input was parsed.
* @param board sudoku board to be updated.
* @param user command.
* @param counter amount of cells filled with values parsedCommand.
* @param mode game mode to executes game commands according to relevant restrictions.
* @param lst moves list to be updated after a move which changed board status.
* @return void
*/
void execute_command(char* parsedCommand[4], cell** board, char* command, int counter, char mode, list* lst);
#endif /*SUDOKU_GAME_H*/