-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.h
83 lines (59 loc) · 2.83 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
/*
* Game.h
*
* Created on: 28 áîàé 2019
* Author: shake
*/
#ifndef GAME_H_
#define GAME_H_
#include "Cell.h"
#include "linkedList.h"
/*generate an empty board*/
Cell** createBoard(int n, int m);
/*check if a value is possible in this row*/
int validRow(int row, int column, int z, int n, int m, Cell** board);
/*check if a value is possible in this column*/
int validColumn(int row, int column, int z, int n, int m, Cell** board);
/*check if a value is possible in this block*/
int validBlock(int row, int column, int z, int n, int m, Cell** board);
/*check if a value is possible in this cell*/
int validNum(int row, int column, int z, int n, int m, Cell** board);
/*check which values are possible in this cell*/
void possibleNums(int row, int column, int n, int m, Cell** board);
/*change each cell that holds value to fixed*/
void turnToFixed1(int n, int m, Cell** board);
void turnToFixed(int n, int m, Cell** board);
/*returns the number of empty cells in the current board*/
int emptyCells(int n, int m, Cell** board);
/* checking if the board is erroneous */
int checkBoard(int n, int m, Cell** board);
/*clear all not fixed cells*/
void eraseNotFix(int n, int m, Cell** board);
/* set value z to cell x,y */
int set(int* xyz, Cell** board, Cell**clone, int mode);
/*return which value the user should set in this cell*/
void hint(int n, int m, int* xyz, Cell** board, Cell** solution);
/*check if the current board is solvable*/
int validate(int n, int m, Cell** board, Cell** solution);
/*free any memory that allocated to this board*/
void freeBoard(int n, int m, Cell** board);
/*copy values of origin board to destination board
*if any cell is fixed in origin,it will be fixed in destination*/
void cloneCopy(Cell** dest, Cell** orig, int n, int m);
/*start the game*/
void game(linkedList* reun);
/*empty all cells from cell[i][j] to the last cell */
void zeroPoint(int n, int m, Cell** board, int i, int j);
/*check the validity of all cells, if cell is erroneous, mark it as such*/
void markErrors(int n, int m, Cell** board);
/*fill all obvious cells*/
void autoFill(int n, int m, Cell** board, Cell** clone, linkedList* reun);
/*return the number of empty cells in the board, and save an array of those cells*/
int howManyEmpty(int n, int m, Cell** board, next* emptyCells);
/*add generate's changes to the undo/redo list*/
void generateToReun(int n, int m, Cell** boardBef, Cell** boardAft, linkedList* reun);
/*generate a board with y filled cells*/
void generate(int n, int m, int x, int y, Cell** board, Cell** clone, Cell** solution, linkedList* reun);
void guess(int n, int m, float tresh, Cell** board, Cell** clone, linkedList* reun);
void guessHint(int n, int m, Cell** board, Cell** clone, linkedList* reun, int x, int y);
#endif /* GAME_H_ */