summaryrefslogtreecommitdiffstats
path: root/klotski.h
blob: 60b91088b03d62d5c13f624e1ed160bbd5a0ad26 (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
48
49
50
#ifndef _KLOTSKI_H
#define _KLOTSKI_H_

#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include "grid.h"
#include "piece.h"

using std::vector;
using std::queue;

extern string err_msg[4];
extern string piece_tag[];

/* check if Z piece spans last column */
bool checkSoln(Grid);

/* validate piece */
int checkPiece(int, int, Piece);

/* take in a grid and return a string representation of it */
string *fillBoard(Grid);

/* take 1D grid, create 1D representation of it, and print it */
void printGrid(Grid);

/* load grid from a file */
Grid loadGrid(char **);

/* can piece move to left? If so, have many spaces */
int canMoveLeft(string [], int, int, Piece);

/* can piece move to right? If so, have many spaces */
int canMoveRight(string [], int, int, Piece);

/* can piece move up? If so, have many spaces */
int canMoveUp(string [], int, int, Piece);

/* can piece move down? If so, have many spaces */
int canMoveDown(string [], int, int, Piece);

/* fill in a queue with grids to be checked */
int possibleMoves(Grid, queue<Grid> &);

#endif