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
29
30
31
32
33
34
|
#include <stdio.h>
#include <tak.h>
int main(int argc, char **argv) {
reset_state(5);
enum E_RESULT r = try_place(0, C_BLACK, STONE_FLAT);
r = try_place(1, C_BLACK, STONE_FLAT);
uint8_t drops[5] = {1,0,0,0,0};
r = try_move(1, M_LEFT, 1, drops);
uint8_t location;
enum STONE_VARIANT stone;
r = parse_place(5, "Cb3", &location, &stone);
printf("Place <%d>: stone %d at (%d,%d)\n",r,stone,location%5,location/5);
enum MOVE_DIRECTION direction;
uint8_t steps;
r = parse_move(5, "3c2+12", &location, &direction, &steps, drops);
printf("Move <%d>: from (%d,%d) step %d sequence [%d,%d,%d,%d,%d]\n",
r,location%5,location/5,
steps,drops[0],drops[1],drops[2],drops[3],drops[4]);
char buf[10];
generate_move(5, 2+5*1, M_UP, 1, drops, buf);
printf("Generated move: %s\n",buf);
generate_place(5,1+5*2, STONE_CAPSTONE, buf);
printf("Generated place: %s\n",buf);
}
|