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

permtoindex_tests.c (325B)


      1 #include "../test.h"
      2 
      3 int64_t permtoindex(uint8_t *, int64_t);
      4 
      5 void run(void) {
      6 	char str[STRLENMAX];
      7 	uint8_t a[100];
      8 	int64_t n, i, p;
      9 
     10 	fgets(str, STRLENMAX, stdin);
     11 	n = atoll(str);
     12 	for (i = 0; i < n; i++) {
     13 		fgets(str, STRLENMAX, stdin);
     14 		a[i] = atoi(str);
     15 	}
     16 
     17 	p = permtoindex(a, n);
     18 	printf("%" PRId64 "\n", p);
     19 }