aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2020-12-29 18:55:06 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commit4a8e687b14b50e3a2a4a3632f6553872f4c301d5 (patch)
tree105efe213f5d69eaa8d9a40531a4ccb72a1c793e /src
parentfd22e4cf3198c1e63cf26dd5fdce588a1e969ac1 (diff)
PTN code looks correct, minor tweaks and header guards
Diffstat (limited to 'src')
-rw-r--r--src/ctaklm.c24
1 files changed, 18 insertions, 6 deletions
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 <stdlib.h>
#include <stdio.h>
#include <state.h>
+#include <ptn.h>
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]);
}