From 4a8e687b14b50e3a2a4a3632f6553872f4c301d5 Mon Sep 17 00:00:00 2001 From: tslil Date: Tue, 29 Dec 2020 18:55:06 -0500 Subject: PTN code looks correct, minor tweaks and header guards --- src/ctaklm.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ctaklm.c b/src/ctaklm.c index 3585bec..f6ccfe8 100644 --- a/src/ctaklm.c +++ b/src/ctaklm.c @@ -1,16 +1,28 @@ -#include #include #include +#include int main(int argc, char **argv) { - reset_game(); + reset_state(5); enum ACTION_RESULT res = try_place(0, 0x0001, STONE_FLAT); res = try_place(1, 0x0001, STONE_FLAT); - const uint8_t drops[1] = {1}; - res = try_move(1, M_LEFT, 1, drops); + const uint8_t d[1] = {1}; + res = try_move(1, M_LEFT, 1, d); - printf("Result: %d\n",res); - printf("%o %o \n",colours[0],celldat[0]); + uint8_t location; + enum STONE_VARIANT stone; + enum PTN_PARSE_RESULT pr = parse_place(5, "Cb3", &location, &stone); + + printf("Place <%d>: stone %d at (%d,%d)\n",pr,stone,location%5,location/5); + + enum MOVE_DIRECTION direction; + uint8_t steps; + uint8_t drops[5]; + pr = parse_move(5, "c2+", &location, &direction, &steps, drops); + + printf("Move <%d>: from (%d,%d) step %d sequence [%d,%d,%d,%d,%d]\n", + pr,location%5,location/5, + steps,drops[0],drops[1],drops[2],drops[3],drops[4]); } -- cgit v1.3.1