aboutsummaryrefslogtreecommitdiff
path: root/src/ctaklm.c
blob: f6ccfe8d4d4979b8124f59c8ab17f45131b65e67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>

#include <state.h>
#include <ptn.h>

int main(int argc, char **argv) {
  reset_state(5);

  enum ACTION_RESULT res = try_place(0, 0x0001, STONE_FLAT);
  res = try_place(1, 0x0001, STONE_FLAT);
  const uint8_t d[1] = {1};
  res = try_move(1, M_LEFT, 1, d);

  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]);
}