diff --git a/game.c b/game.c new file mode 100644 index 0000000..29d61eb --- /dev/null +++ b/game.c @@ -0,0 +1,50 @@ +/* + * File: game.c + * Author: Jeremy Rand + * Date: July 23, 2014 + * + * This file contains the implementation of the game logic. + */ + + +#include "game.h" + + +void initGame(void) +{ +} + + +void slideInDirection(tDir dir) +{ +} + + +tScore currentScore(void) +{ + return 0; +} + + +tScore nextTarget(void) +{ + return 0; +} + + +bool isGameWon(void) +{ + return false; +} + + +bool isGameLost(void) +{ + return false; +} + + +char *tileStringForPos(tPos x, tPos y) +{ + return ""; +} diff --git a/game.h b/game.h new file mode 100644 index 0000000..e468faa --- /dev/null +++ b/game.h @@ -0,0 +1,41 @@ +/* + * File: game.h + * Author: Jeremy Rand + * Date: July 23, 2014 + * + * This file has the external definitions for the game interface. + */ + + +#include +#include + + +#define BOARD_SIZE 4 + +#define DIR_DOWN (BOARD_SIZE + 2) +#define DIR_UP (-(DIR_DOWN)) +#define DIR_RIGHT 1 +#define DIR_LEFT -1 + + +typedef int8_t tDir; +typedef uint8_t tPos; +typedef uint32_t tScore; + + +void initGame(void); + +void slideInDirection(tDir dir); + +tScore currentScore(void); + +tScore nextTarget(void); + +bool isGameWon(void); + +bool isGameLost(void); + +// Positions are 1 based so the top-left corner is (1, 1) and the bottom-right +// corner is (BOARD_SIZE, BOARD_SIZE). +char *tileStringForPos(tPos x, tPos y);