h48

A prototype for an optimal Rubik's cube solver, work in progress.
git clone https://git.tronto.net/h48
Download | Log | Files | Refs | README | LICENSE

invertmoves_tests.c (459B)


      1 #include "../test.h"
      2 
      3 #define MAXMOVES 20
      4 
      5 int64_t readmoves(const char *, int, uint8_t *);
      6 void writemoves(uint8_t *, int, char *);
      7 void invertmoves(uint8_t *, uint8_t, uint8_t *);
      8 
      9 void run(void) {
     10 	char movestr[STRLENMAX], outstr[STRLENMAX];
     11 	uint8_t moves[MAXMOVES], ret[MAXMOVES];
     12 	int c;
     13 
     14 	fgets(movestr, STRLENMAX, stdin);
     15 	c = readmoves(movestr, MAXMOVES, moves);
     16 
     17 	invertmoves(moves, c, ret);
     18 	writemoves(ret, c, outstr);
     19 
     20 	printf("%s\n", outstr);
     21 }