nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

inverse_move_tests.c (605B)


      1 #include "../test.h"
      2 
      3 extern char *movestr[];
      4 
      5 int64_t readmoves(const char *, size_t n, size_t m,
      6     uint64_t *, uint64_t *, uint8_t [n], uint8_t [m]);
      7 uint8_t inverse_move(uint8_t);
      8 
      9 void run(void) {
     10 	uint64_t inv, nor;
     11 	int64_t tot;
     12 	uint8_t moves[2];
     13 
     14 	char moves_string[STRLENMAX];
     15 
     16 	fgets(moves_string, STRLENMAX, stdin);
     17 	tot = readmoves(moves_string, 2, 0, &nor, &inv, moves, NULL);
     18 	if (nor != 1 || tot != 1) {
     19 		printf("Test error reading moves\n");
     20 		return;
     21 	}
     22 
     23 fprintf(stderr, "Read move %" PRIu8 " = %s\n", moves[0], movestr[moves[0]]);
     24 
     25 	printf("%s\n", movestr[inverse_move(moves[0])]);
     26 }