-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsudoku_undo.h
40 lines (24 loc) · 884 Bytes
/
sudoku_undo.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
#ifndef SUDOKU_UNDO_H
#define SUDOKU_UNDO_H
#include <stdbool.h>
#include "sudoku_board.h"
#include "sudoku_utility.h"
struct SudokuBoard;
/**
* Struct representing a single change to a sudoku board.
*/
struct HistoryStep {
Coord2D location; /**< row/column of the square that changed */
char newValue; /**< value of the square after change */
char oldValue; /**< value of the square before changed */
};
typedef struct HistoryStep HistoryStep;
struct HistoryStruct;
typedef struct HistoryStruct *History;
History createHistory(struct SudokuBoard *owner);
void freeHistory(History *historyPtr);
void addUndoStep(History history, struct Coord2D *square, int value);
bool undoStep(History history, size_t stepsToUndo);
bool redoStep(History history, size_t stepsToRedo);
void invalidateSubsequentRedoSteps(History history);
#endif // !SUDOKU_UNDO_H