]> git.lizzy.rs Git - plan9front.git/blob - sys/src/games/sudoku/sudoku.h
mkfiles: do not rely on path containing the . element
[plan9front.git] / sys / src / games / sudoku / sudoku.h
1 enum{
2         Brdsize         = 9,
3         Psize           = Brdsize * Brdsize,
4         Alldigits       = 0x1FF,
5         Digit           = 0x0000000F,
6         Solve           = 0x000000F0,
7         Allow           = 0x0001FF00,
8         MLock           = 0x00020000,
9
10         Line            = 0,
11         Thickline       = 1,
12         Border          = Thickline*4,
13         Square          = 48,
14         Maxx            = Square*9 + 2*Border,
15         Maxy            = Maxx + Square,
16 };
17
18 typedef struct Cell {
19         int digit;
20         int solve;
21         int locked;
22 } Cell;
23
24 Cell    brd[Psize];
25 Cell    obrd[Psize];
26 int             board[Psize];
27
28 /* game.c */
29 int getrow(int cell);
30 int getcol(int cell);
31 int getbox(int cell);
32 void setdigit(int cc, int num);
33 int boxcheck(int *board);
34 int rowcheck(int *board);
35 int colcheck(int *board);
36 int setallowed(int *board, int cc, int num);
37 int chksolved(int *board);
38 void attempt(int *pboard, int level);
39 void clearp(void);
40 void makep(void);
41
42 /* sudoku.c */
43 void drawbar(int digit, int selected);
44 void drawcell(int x, int y, int num, Image *col);
45 void drawblink(int cell);
46 char *genlevels(int i);
47
48 /* levels.c */
49 void fprettyprintbrd(Cell *board);
50 void fprintbrd(int fd, Cell *board);
51 void floadbrd(int fd, Cell *board);
52 void printboard(Cell *board);
53 int loadlevel(char *name, Cell *board);
54 void savegame(Cell *board);
55 int loadgame(Cell *board);