cube-solver/cube.h
2022-08-01 19:16:24 -05:00

62 lines
1.2 KiB
C

#ifndef __CUBE_H__
#define __CUBE_H__
#define FACE_COUNT 6
#define INDEX_COUNT 9
#define COLOR_WHITE 0
#define COLOR_YELLOW 1
#define COLOR_GREEN 2
#define COLOR_BLUE 3
#define COLOR_RED 4
#define COLOR_ORANGE 5
#define FACE_BOTTOM 0
#define FACE_TOP 1
#define FACE_FRONT 2
#define FACE_BACK 3
#define FACE_LEFT 4
#define FACE_RIGHT 5
#define TRANSITIONS_PER_ROTATION 20
struct Cube {
int faces[FACE_COUNT][INDEX_COUNT];
};
struct CubeTransition {
int old_face;
int old_index;
int new_face;
int new_index;
};
struct Cube generate_cube();
void print_cube(struct Cube* c);
static void transition_cube(struct Cube* cube, struct CubeTransition* transitions);
void u(struct Cube* c);
void d(struct Cube* c);
void f(struct Cube* c);
void b(struct Cube* c);
void l(struct Cube* c);
void r(struct Cube* c);
void up(struct Cube* c);
void dp(struct Cube* c);
void fp(struct Cube* c);
void bp(struct Cube* c);
void lp(struct Cube* c);
void rp(struct Cube* c);
void u2(struct Cube* c);
void d2(struct Cube* c);
void f2(struct Cube* c);
void b2(struct Cube* c);
void l2(struct Cube* c);
void r2(struct Cube* c);
#endif