From 9e698917cb5b332cdbf1969ddfe3840239106c8d Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 5 Oct 2023 09:31:02 +0200 Subject: Implemented compose; some cleanup --- src/cube.h | 51 ++++++--------------------------------------------- 1 file changed, 6 insertions(+), 45 deletions(-) (limited to 'src/cube.h') diff --git a/src/cube.h b/src/cube.h index e5434e3..fcc76dc 100644 --- a/src/cube.h +++ b/src/cube.h @@ -1,52 +1,13 @@ -typedef enum { - U = 0, U2, U3, D, D2, D3, - R, R2, R3, L, L2, L3, - F, F2, F3, B, B2, B3 -} move_t; +/* TODO: ifdef for different implementations */ +#include "cube_array.h" -typedef enum { - UF_i = 0, UL_i, UB_i, UR_i, DF_i, DL_i, DB_i, DR_i, - UF_m, UL_m, UB_m, UR_m, DF_m, DL_m, DB_m, DR_m, - RU_i, RF_i, RD_i, RB_i, LU_i, LF_i, LD_i, LB_i, - RU_m, RF_m, RD_m, RB_m, LU_m, LF_m, LD_m, LB_m, - FU_i, FR_i, FD_i, FL_i, BU_i, BR_i, BD_i, BL_i, - FU_m, FR_m, FD_m, FL_m, BU_m, BR_m, BD_m, BL_m -} trans_t; - -typedef struct { - uint8_t c[8]; - uint8_t e[12]; -} cube_t; +/* For moves and transformations, see constants.h */ +typedef uint8_t move_t; +typedef uint8_t trans_t; extern cube_t solvedcube; -/* -The functions readcube() and writecube() use the following format. - -Each edge is represented by two letters denoting the sides it belongs to -and one number denoting its orientation (0 oriented, 1 mis-oriented). -Similarly, each corner is represented by three letters and a number -(0 oriented, 1 twisted clockwise, 2 twisted counter-clockwise). -Edge orientation is relative to the F / B axis, corner orientation is -relative to the U / D axis. - -The pieces are ordered such that the solved cube looks like this: - -UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 -UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 - -Whitespace (including newlines) between pieces is ignored when reading -the cube, and a single whitespace character is added between pieces -when writing. - -The cube after the moves R'U'F looks like this: - -FL1 BR0 DB0 UR1 UF0 UB0 DL0 FR0 UL1 DF1 BL0 DR0 -UBL1 DBR1 UFR2 DFR2 DFL2 UBL2 UFL2 DBL0 - -More formats might be supported in the future. -*/ - +/* For the textual representation of the cube, see utils/FORMAT.txt */ cube_t readcube(char *); void writecube(cube_t, char *); -- cgit v1.3