From: Scott Worley Date: Thu, 31 Dec 2015 07:13:51 +0000 (-0800) Subject: Include guards & move non-header stuff out of header. X-Git-Url: http://git.scottworley.com/slidingtile/commitdiff_plain/82d6eed523b5c102d826b66e21c03f5577199714 Include guards & move non-header stuff out of header. --- diff --git a/sliding_tile_lib.cc b/sliding_tile_lib.cc index e69de29..4b422c1 100644 --- a/sliding_tile_lib.cc +++ b/sliding_tile_lib.cc @@ -0,0 +1,20 @@ +#include "sliding_tile_lib.h" + +signed char adjacent[BOARD_SIZE][5] = { + 1, 4, -1, -1, -1, + 0, 2, 5, -1, -1, + 1, 3, 6, -1, -1, + 2, 7, -1, -1, -1, + 0, 5, 8, -1, -1, + 1, 4, 6, 9, -1, + 2, 5, 7, 10, -1, + 3, 6, 11, -1, -1, + 4, 9, 12, -1, -1, + 5, 8, 10, 13, -1, + 6, 9, 11, 14, -1, + 7, 10, 15, -1, -1, + 8, 13, -1, -1, -1, + 9, 12, 14, -1, -1, + 10, 13, 15, -1, -1, + 11, 14, -1, -1, -1, +}; diff --git a/sliding_tile_lib.h b/sliding_tile_lib.h index 7b16a51..7e6004b 100644 --- a/sliding_tile_lib.h +++ b/sliding_tile_lib.h @@ -1,20 +1,8 @@ +#ifndef _SLIDING_TILE_LIB_H +#define _SLIDING_TILE_LIB_H + const int BOARD_DIM = 4; const int BOARD_SIZE = BOARD_DIM * BOARD_DIM; -signed char adjacent[BOARD_SIZE][5] = { - 1, 4, -1, -1, -1, - 0, 2, 5, -1, -1, - 1, 3, 6, -1, -1, - 2, 7, -1, -1, -1, - 0, 5, 8, -1, -1, - 1, 4, 6, 9, -1, - 2, 5, 7, 10, -1, - 3, 6, 11, -1, -1, - 4, 9, 12, -1, -1, - 5, 8, 10, 13, -1, - 6, 9, 11, 14, -1, - 7, 10, 15, -1, -1, - 8, 13, -1, -1, -1, - 9, 12, 14, -1, -1, - 10, 13, 15, -1, -1, - 11, 14, -1, -1, -1, -}; +extern signed char adjacent[BOARD_SIZE][5]; + +#endif /* _SLIDING_TILE_LIB_H */