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

io_trans.h (525B)


      1 STATIC uint8_t readtrans(const char [static NISSY_SIZE_TRANSFORMATION]);
      2 STATIC void writetrans(uint8_t, char [static NISSY_SIZE_TRANSFORMATION]);
      3 
      4 STATIC uint8_t
      5 readtrans(const char buf[static NISSY_SIZE_TRANSFORMATION])
      6 {
      7 	uint8_t t;
      8 
      9 	for (t = 0; t < 48; t++)
     10 		if (!strncmp(buf, transstr[t], 11))
     11 			return t;
     12 
     13 	return UINT8_ERROR;
     14 }
     15 
     16 STATIC void
     17 writetrans(uint8_t t, char buf[static NISSY_SIZE_TRANSFORMATION])
     18 {
     19 	if (t >= 48)
     20 		memcpy(buf, "error trans", 11);
     21 	else
     22 		memcpy(buf, transstr[t], 11);
     23 	buf[11] = '\0';
     24 }