#ifndef __GAMEBOARD_H__
#define __GAMEBOARD_H__
-enum { GTSpace=0x00, GTWall=0x01, GTBox=0x02, GTBoxSpot=0x04 };
+enum { GTSpace=0x00, GTWall=0x01, GTBox=0x02, GTBoxSpot=0x04, GTNull=0x08, GTMan=0x10 };
enum { PMInvalid, PMWalk, PMPush };
+struct UndoMove
+{
+ int dx, dy, type;
+};
+
class GameBoard
{
public:
int MovePlayerS(void);
int MovePlayerE(void);
int MovePlayerW(void);
+ bool IsBoxNOfPlayer(void);
+ bool IsBoxSOfPlayer(void);
+ bool IsBoxEOfPlayer(void);
+ bool IsBoxWOfPlayer(void);
+ bool UndoLastMove(int &, int &, int &);
private:
- int Move(int & var, int direction, char, char);
+ int Move(int dx, int dy, char, char);
public:
int playerX, playerY; // Player X/Y are zero-based
int width, height;
char * board;
+ const char * name;
private:
char * initialBoard;
int initialX, initialY;
int boardLength;
+ int numMoves;
+ UndoMove undo[8192]; // 8K moves ought to be enough for anybody
};
#endif // __GAMEBOARD_H__