From 067ba55add258ab03db328234168af66c4ad87c3 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 10 Nov 2023 17:07:42 +0100 Subject: Towards a definitve API --- TODO.txt | 62 ++++----- benchmark/bench.c | 83 ------------ benchmark/bench.sh | 21 --- benchmark/cube-bench.c | 147 --------------------- cube.c | 6 - cube.h | 68 +++++----- old/061_coord_eo/00_solved.in | 1 + old/061_coord_eo/00_solved.out | 1 + old/061_coord_eo/01_U.in | 1 + old/061_coord_eo/01_U.out | 1 + old/061_coord_eo/02_U2.in | 1 + old/061_coord_eo/02_U2.out | 1 + old/061_coord_eo/03_U3.in | 1 + old/061_coord_eo/03_U3.out | 1 + old/061_coord_eo/04_D.in | 1 + old/061_coord_eo/04_D.out | 1 + old/061_coord_eo/07_R.in | 1 + old/061_coord_eo/07_R.out | 1 + old/061_coord_eo/08_R2.in | 1 + old/061_coord_eo/08_R2.out | 1 + old/061_coord_eo/10_L.in | 1 + old/061_coord_eo/10_L.out | 1 + old/061_coord_eo/13_F.in | 1 + old/061_coord_eo/13_F.out | 1 + old/061_coord_eo/14_F2.in | 1 + old/061_coord_eo/14_F2.out | 1 + old/061_coord_eo/15_F3.in | 1 + old/061_coord_eo/15_F3.out | 1 + old/061_coord_eo/16_B.in | 1 + old/061_coord_eo/16_B.out | 1 + old/061_coord_eo/17_B2.in | 1 + old/061_coord_eo/17_B2.out | 1 + old/061_coord_eo/18_B3.in | 1 + old/061_coord_eo/18_B3.out | 1 + old/061_coord_eo/20_scrambled.in | 3 + old/061_coord_eo/20_scrambled.out | 1 + old/061_coord_eo/coord_eo_tests.c | 26 ++++ old/benchmark/bench.c | 83 ++++++++++++ old/benchmark/bench.sh | 21 +++ old/benchmark/cube-bench.c | 147 +++++++++++++++++++++ .../results/results-2023-10-31-18-54-37.txt | 32 +++++ .../results/results-2023-10-31-19-13-49.txt | 32 +++++ .../results/results-2023-11-01-20-55-21.txt | 32 +++++ .../results/results-2023-11-03-23-08-50.txt | 18 +++ .../results/results-2023-11-03-23-10-40.txt | 32 +++++ .../results/results-2023-11-04-10-22-43.txt | 32 +++++ .../results/results-2023-11-04-10-23-11.txt | 32 +++++ .../results/results-2023-11-04-10-23-43.txt | 32 +++++ .../results/results-2023-11-04-10-24-08.txt | 32 +++++ .../results/results-2023-11-04-10-52-05.txt | 32 +++++ .../results/results-2023-11-04-10-53-06.txt | 32 +++++ .../results/results-2023-11-04-10-57-46.txt | 32 +++++ .../results/results-2023-11-10-15-49-45.txt | 28 ++++ old/benchmark/results/results.txt | 28 ++++ test/020_move/300_multimove_solved.in | 2 + test/020_move/300_multimove_solved.out | 1 + test/020_move/301_multimove_scrambled.in | 2 + test/020_move/301_multimove_scrambled.out | 1 + test/061_coord_eo/00_solved.in | 1 - test/061_coord_eo/00_solved.out | 1 - test/061_coord_eo/01_U.in | 1 - test/061_coord_eo/01_U.out | 1 - test/061_coord_eo/02_U2.in | 1 - test/061_coord_eo/02_U2.out | 1 - test/061_coord_eo/03_U3.in | 1 - test/061_coord_eo/03_U3.out | 1 - test/061_coord_eo/04_D.in | 1 - test/061_coord_eo/04_D.out | 1 - test/061_coord_eo/07_R.in | 1 - test/061_coord_eo/07_R.out | 1 - test/061_coord_eo/08_R2.in | 1 - test/061_coord_eo/08_R2.out | 1 - test/061_coord_eo/10_L.in | 1 - test/061_coord_eo/10_L.out | 1 - test/061_coord_eo/13_F.in | 1 - test/061_coord_eo/13_F.out | 1 - test/061_coord_eo/14_F2.in | 1 - test/061_coord_eo/14_F2.out | 1 - test/061_coord_eo/15_F3.in | 1 - test/061_coord_eo/15_F3.out | 1 - test/061_coord_eo/16_B.in | 1 - test/061_coord_eo/16_B.out | 1 - test/061_coord_eo/17_B2.in | 1 - test/061_coord_eo/17_B2.out | 1 - test/061_coord_eo/18_B3.in | 1 - test/061_coord_eo/18_B3.out | 1 - test/061_coord_eo/20_scrambled.in | 3 - test/061_coord_eo/20_scrambled.out | 1 - test/061_coord_eo/coord_eo_tests.c | 26 ---- 89 files changed, 800 insertions(+), 386 deletions(-) delete mode 100644 benchmark/bench.c delete mode 100755 benchmark/bench.sh delete mode 100644 benchmark/cube-bench.c create mode 100644 old/061_coord_eo/00_solved.in create mode 100644 old/061_coord_eo/00_solved.out create mode 100644 old/061_coord_eo/01_U.in create mode 100644 old/061_coord_eo/01_U.out create mode 100644 old/061_coord_eo/02_U2.in create mode 100644 old/061_coord_eo/02_U2.out create mode 100644 old/061_coord_eo/03_U3.in create mode 100644 old/061_coord_eo/03_U3.out create mode 100644 old/061_coord_eo/04_D.in create mode 100644 old/061_coord_eo/04_D.out create mode 100644 old/061_coord_eo/07_R.in create mode 100644 old/061_coord_eo/07_R.out create mode 100644 old/061_coord_eo/08_R2.in create mode 100644 old/061_coord_eo/08_R2.out create mode 100644 old/061_coord_eo/10_L.in create mode 100644 old/061_coord_eo/10_L.out create mode 100644 old/061_coord_eo/13_F.in create mode 100644 old/061_coord_eo/13_F.out create mode 100644 old/061_coord_eo/14_F2.in create mode 100644 old/061_coord_eo/14_F2.out create mode 100644 old/061_coord_eo/15_F3.in create mode 100644 old/061_coord_eo/15_F3.out create mode 100644 old/061_coord_eo/16_B.in create mode 100644 old/061_coord_eo/16_B.out create mode 100644 old/061_coord_eo/17_B2.in create mode 100644 old/061_coord_eo/17_B2.out create mode 100644 old/061_coord_eo/18_B3.in create mode 100644 old/061_coord_eo/18_B3.out create mode 100644 old/061_coord_eo/20_scrambled.in create mode 100644 old/061_coord_eo/20_scrambled.out create mode 100644 old/061_coord_eo/coord_eo_tests.c create mode 100644 old/benchmark/bench.c create mode 100755 old/benchmark/bench.sh create mode 100644 old/benchmark/cube-bench.c create mode 100644 old/benchmark/results/results-2023-10-31-18-54-37.txt create mode 100644 old/benchmark/results/results-2023-10-31-19-13-49.txt create mode 100644 old/benchmark/results/results-2023-11-01-20-55-21.txt create mode 100644 old/benchmark/results/results-2023-11-03-23-08-50.txt create mode 100644 old/benchmark/results/results-2023-11-03-23-10-40.txt create mode 100644 old/benchmark/results/results-2023-11-04-10-22-43.txt create mode 100644 old/benchmark/results/results-2023-11-04-10-23-11.txt create mode 100644 old/benchmark/results/results-2023-11-04-10-23-43.txt create mode 100644 old/benchmark/results/results-2023-11-04-10-24-08.txt create mode 100644 old/benchmark/results/results-2023-11-04-10-52-05.txt create mode 100644 old/benchmark/results/results-2023-11-04-10-53-06.txt create mode 100644 old/benchmark/results/results-2023-11-04-10-57-46.txt create mode 100644 old/benchmark/results/results-2023-11-10-15-49-45.txt create mode 100644 old/benchmark/results/results.txt create mode 100644 test/020_move/300_multimove_solved.in create mode 100644 test/020_move/300_multimove_solved.out create mode 100644 test/020_move/301_multimove_scrambled.in create mode 100644 test/020_move/301_multimove_scrambled.out delete mode 100644 test/061_coord_eo/00_solved.in delete mode 100644 test/061_coord_eo/00_solved.out delete mode 100644 test/061_coord_eo/01_U.in delete mode 100644 test/061_coord_eo/01_U.out delete mode 100644 test/061_coord_eo/02_U2.in delete mode 100644 test/061_coord_eo/02_U2.out delete mode 100644 test/061_coord_eo/03_U3.in delete mode 100644 test/061_coord_eo/03_U3.out delete mode 100644 test/061_coord_eo/04_D.in delete mode 100644 test/061_coord_eo/04_D.out delete mode 100644 test/061_coord_eo/07_R.in delete mode 100644 test/061_coord_eo/07_R.out delete mode 100644 test/061_coord_eo/08_R2.in delete mode 100644 test/061_coord_eo/08_R2.out delete mode 100644 test/061_coord_eo/10_L.in delete mode 100644 test/061_coord_eo/10_L.out delete mode 100644 test/061_coord_eo/13_F.in delete mode 100644 test/061_coord_eo/13_F.out delete mode 100644 test/061_coord_eo/14_F2.in delete mode 100644 test/061_coord_eo/14_F2.out delete mode 100644 test/061_coord_eo/15_F3.in delete mode 100644 test/061_coord_eo/15_F3.out delete mode 100644 test/061_coord_eo/16_B.in delete mode 100644 test/061_coord_eo/16_B.out delete mode 100644 test/061_coord_eo/17_B2.in delete mode 100644 test/061_coord_eo/17_B2.out delete mode 100644 test/061_coord_eo/18_B3.in delete mode 100644 test/061_coord_eo/18_B3.out delete mode 100644 test/061_coord_eo/20_scrambled.in delete mode 100644 test/061_coord_eo/20_scrambled.out delete mode 100644 test/061_coord_eo/coord_eo_tests.c diff --git a/TODO.txt b/TODO.txt index 30a9242..27ff198 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,43 +1,30 @@ -## Big change - -* Add tests for multiple moves - -### More for moves - -* define macro to loop over moves e.g. #define FOREACHMOVE(action) - -### API goals: - -* manipulate move sequences (invert, unniss, cleanup, mirror / transform...) -* solvers (optimal, generic, coordinates) -* print cube (in various formats) -* print ptables (or layout data in such a way that can be printed - easily, e.g. first bytes are null-terminated strig and can be - printed by user) - -### Solvers - -* Actually do A*, no fixed depth -* Use threading (see below) -* Return strings, newline separated (see nissy_ffi) -* Instead of depth, I need the following parameters: - int minmoves - int maxmoves - a parameter for all solutions / nmax / optimal / -O n -* How to make the above nicer? can it be done with a minimal - amount of parameters (e.g. at most 2)? - -### Rename to libnissy - -* prefix public functions with libnissy_ or something similar -* move() that takes a string (alg) as input +## Roadmap + +See the sections below for details + +* Implement some simple solver +* Extend cube and moves to include centers +* More complex optimal solvers, pruning tables +* Benchmarks +* Multithreading (build-time option number of threads) +* Other optimizations +* NISS +* Move manipulation utilities +* Coordinate solvers and other steps +* More output formats +* Adapters for other languages (at least python) +* More documentation (or keep all in cube.h?) +* Rename to libnissy +* Release 1.0 ## Solving -### Generic solver +### Simple (slow, light) solver +* Decide on API for solve() (see above) +* solve generic becomes private, use cube_fast_t instead of cube_t +* write simple solver based on generic * tests: solve full cube (max 7-8 moves?) -* more tests: eo and other stuff * benchmarks ### Coordinates @@ -110,8 +97,10 @@ What about symcoord? ## Improvements and other things +* Rename to libnissy (prefix public functions with nissy_?) * add centers (and moves...) * for CO: move to bits 5 and 6, no need for padding bit +* manipulate move sequences (invert, unniss, cleanup, mirror / transform...) * NISS: Add mask to moves (e.g. U | NISS where NISS = 32 or something); adapt readmoves and writemoves. * Consider adding centers and other moves (for avx2: centers in the @@ -121,6 +110,9 @@ What about symcoord? ascii art (color = 1 letter) twizzle binary https://www.experiments.cubing.net/cubing.js/spec/binary/ reid? +* print ptables (or layout data in such a way that can be printed + easily, e.g. first bytes are null-terminated strig and can be + printed by user) ## "Front-end" diff --git a/benchmark/bench.c b/benchmark/bench.c deleted file mode 100644 index 2c3358f..0000000 --- a/benchmark/bench.c +++ /dev/null @@ -1,83 +0,0 @@ -#include -#include -#include -#include -#include - -#include "../cube.h" - -#define MOVES 100000000 -#define TRANS 100000000 -#define COMPOSE 100000000 -#define INVERSE 100000000 - -double -bench(cube_t (*run)(int64_t), int64_t n, char *name) -{ - char str[1000]; - cube_t cube; - struct timespec start, end; - double tdiff, tdsec, tdnano; - - printf("\n"); - fflush(stdout); - - if (run == NULL) { - printf("> %s: nothing to run!\n", name); - fflush(stdout); - return -1.0; - } - - printf("> %s: running benchmark...\n", name); - fflush(stdout); - clock_gettime(CLOCK_MONOTONIC, &start); - - cube = run(n); - writecube("H48", cube, str); - str[3] = 0; - printf("> %s: resulting cube, first piece: %s\n", name, str); - fflush(stdout); - - clock_gettime(CLOCK_MONOTONIC, &end); - tdsec = end.tv_sec - start.tv_sec; - tdnano = end.tv_nsec - start.tv_nsec; - tdiff = tdsec + 1e-9 * tdnano; - printf("> %s: %.4fs\n", name, tdiff); - fflush(stdout); - - return tdiff; -} - -int main() { - double tmoves, ttrans, tcompose, tinverse; - - printf( - "Benchmarks settings:\n" - "MOVES:\t%d\nTRANS:\t%d\nCOMPOSE:\t%d\nINVERSE:\t%d\n", - MOVES, TRANS, COMPOSE, INVERSE - ); - fflush(stdout); - - srand(time(NULL)); - - tmoves = bench(run_moves, MOVES, "moves"); - ttrans = bench(run_trans, TRANS, "trans"); - tcompose = bench(run_compose, COMPOSE, "compose"); - tinverse = bench(run_inverse, INVERSE, "inverse"); - - printf( - "\nBenchmark summary:\n" - "moves: %d moves in %.4fs (%.4f MTPS)\n" - "trans: %d transformations in %.4fs (%.4f MTPS)\n" - "compose: %d compositions in %.4fs (%.4f MCPS)\n" - "inverse: %d inverses in %.4fs (%.4f MIPS)\n" - "Total time: %.4f\n", - MOVES, tmoves, MOVES / (1e6 * tmoves), - TRANS, ttrans, TRANS / (1e6 * ttrans), - COMPOSE, tcompose, COMPOSE / (1e6 * tcompose), - INVERSE, tinverse, INVERSE / (1e6 * tinverse), - tmoves + ttrans + tcompose + tinverse - ); - - return 0; -} diff --git a/benchmark/bench.sh b/benchmark/bench.sh deleted file mode 100755 index cc31c1e..0000000 --- a/benchmark/bench.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -CC="cc -std=c99 -O3 -D$CUBETYPE" -if [ "$CUBETYPE" = "CUBE_AVX2" ]; then - CC="$CC -mavx2" -fi - -BENCHBIN="benchmark/run" -BENCHDIR="benchmark/results" -CUBEOBJ="cube.o" - -$CC -D_POSIX_C_SOURCE=199309L -o $BENCHBIN benchmark/bench.c $CUBEOBJ || exit 1 - -d="$(date +'%Y-%m-%d-%H-%M-%S')" -mkdir -p "$BENCHDIR" -$BENCHBIN | tee "$BENCHDIR/results-$d.txt" "$BENCHDIR/results.txt" - -echo "" -echo "Results saved to $BENCHDIR/results.txt" - -rm -rf $BENCHBIN $CUBEOBJ diff --git a/benchmark/cube-bench.c b/benchmark/cube-bench.c deleted file mode 100644 index 26d12a4..0000000 --- a/benchmark/cube-bench.c +++ /dev/null @@ -1,147 +0,0 @@ -/****************************************************************************** -Section: benchmarks - -Here you can find some simple functions that can be used to benchmark the -rest of the code. -******************************************************************************/ - -#define RANDOMCUBES 157 - -static void -setup_randomcubes(cube_fast_t *cubes) -{ - int i; - - for (i = 0; i < RANDOMCUBES; i++) - cubes[i] = run_moves(i*4); -} - -cube_t -run_moves(int64_t n) -{ - cube_fast_t fast; - int64_t m, i; - - fast = solvedcube(); - m = n / 18; - - for (i = 0; i < m; i++) { - fast = _move_U(fast); - fast = _move_U2(fast); - fast = _move_U3(fast); - fast = _move_D(fast); - fast = _move_D2(fast); - fast = _move_D3(fast); - fast = _move_R(fast); - fast = _move_R2(fast); - fast = _move_R3(fast); - fast = _move_L(fast); - fast = _move_L2(fast); - fast = _move_L3(fast); - fast = _move_F(fast); - fast = _move_F2(fast); - fast = _move_F3(fast); - fast = _move_B(fast); - fast = _move_B2(fast); - fast = _move_B3(fast); - } - - for (i = m * 18; i < n; i++) - fast = _move_F(fast); - - return fast; -} - -cube_t -run_trans(int64_t n) -{ - cube_fast_t fast; - int64_t m, i; - - fast = run_moves(33); - m = n / 18; - - for (i = 0; i < m; i++) { - fast = _trans_UFr(fast); - fast = _trans_ULr(fast); - fast = _trans_UBr(fast); - fast = _trans_URr(fast); - fast = _trans_DFr(fast); - fast = _trans_DLr(fast); - fast = _trans_DBr(fast); - fast = _trans_DRr(fast); - fast = _trans_RUr(fast); - fast = _trans_RFr(fast); - fast = _trans_RDr(fast); - fast = _trans_RBr(fast); - fast = _trans_LUr(fast); - fast = _trans_LFr(fast); - fast = _trans_LDr(fast); - fast = _trans_LBr(fast); - fast = _trans_FUr(fast); - fast = _trans_FRr(fast); - fast = _trans_FDr(fast); - fast = _trans_FLr(fast); - fast = _trans_BUr(fast); - fast = _trans_BRr(fast); - fast = _trans_BDr(fast); - fast = _trans_BLr(fast); - fast = _trans_UFm(fast); - fast = _trans_ULm(fast); - fast = _trans_UBm(fast); - fast = _trans_URm(fast); - fast = _trans_DFm(fast); - fast = _trans_DLm(fast); - fast = _trans_DBm(fast); - fast = _trans_DRm(fast); - fast = _trans_RUm(fast); - fast = _trans_RFm(fast); - fast = _trans_RDm(fast); - fast = _trans_RBm(fast); - fast = _trans_LUm(fast); - fast = _trans_LFm(fast); - fast = _trans_LDm(fast); - fast = _trans_LBm(fast); - fast = _trans_FUm(fast); - fast = _trans_FRm(fast); - fast = _trans_FDm(fast); - fast = _trans_FLm(fast); - fast = _trans_BUm(fast); - fast = _trans_BRm(fast); - fast = _trans_BDm(fast); - fast = _trans_BLm(fast); - } - - for (i = m * 18; i < n; i++) - fast = _trans_FRm(fast); - - return fast; -} - -cube_t -run_compose(int64_t n) -{ - cube_fast_t fast, cubes[RANDOMCUBES]; - int64_t i; - - setup_randomcubes(cubes); - - for (i = 0; i < n; i++) - fast = compose_fast(fast, cubes[i % RANDOMCUBES]); - - return fast; -} - -cube_t -run_inverse(int64_t n) -{ - cube_fast_t fast, cubes[RANDOMCUBES]; - int64_t i; - - setup_randomcubes(cubes); - - for (i = 0; i < n; i++) - fast = inverse_fast(cubes[i % RANDOMCUBES]); - - return fast; -} diff --git a/cube.c b/cube.c index 0088dc1..4806b95 100644 --- a/cube.c +++ b/cube.c @@ -3619,12 +3619,6 @@ applytrans(cube_t cube, char *buf) return fasttocube(fast); } -int64_t -coord_eo(cube_t cube) -{ - return coord_fast_eo(cubetofast(cube)); -} - /****************************************************************************** Section: solvers diff --git a/cube.h b/cube.h index d8896d8..791d167 100644 --- a/cube.h +++ b/cube.h @@ -105,51 +105,47 @@ cube_t readcube(char *format, char *buf); */ void writecube(char *format, cube_t cube, char *buf); -/****************************************************************************** -Coordinates - -TODO description -******************************************************************************/ - -int64_t coord_eo(cube_t); - /****************************************************************************** Solvers -The solutions are returned as a newline-separated list of characters. +The solutions are returned as a newline-separated list of characters. Moves +are separated by single spaces. Unless specified otherwise, all the solutions are not trivially simplifiable. This means that sequences like U U2 or R L R will not appear in any solution. Moreover, two consecutive parallel moves are always going to be sorted in increasing order. For example, L R2 may never appear in a solution, but R2 L could. - -Solvers return -1 in case of error, the number of solutions found otherwise. - -TODO NISS / INVERSE / LINEAR as a mask? - -All solvers take at least the following parameters, satisfying the conditions -in square brackets: -TODO more! - - cube_t cube [issolvable(cube)]: The cube to solve. - - uint8_t depth [depth <= 20]: The lenght of the solution. - - int maxsols: The maximum number of solutions to find. The solver - stops when the limit is reached. If set to a negative number, all - the solutions are found. - - move_t *ret: The array where the moves of the solutions are stored. - There is no separator between different solutions; to read the - solutions, use the fact that all solutions has the same length: the - i-th move of the j-th solution is ret[j*depth + i]. - -Some solvers take other parameters. See below for details. ******************************************************************************/ -/* TODO -int solve_generic( - cube_t cube, - uint8_t depth, - int maxsols, - uint8_t *ret, // TODO change to char - int (*estimate)(cube_t) +int64_t solve( + cube_t cube, /* The cube to solve. Must be solvable. */ + char *solver, /* The solver. Supported solvers: TODO. */ + char *options, /* Some solvers accept extra options, + * like "!filter". + */ + char *nisstype, /* Can be "normal", "inverse", "mixed" or "linear". */ + int8_t minmoves, /* The minimum number of moves. Must be >= 0. */ + int8_t maxmoves, /* The maximum number of moves. If negative, the + * maximum length is unlimited. + */ + int64_t maxsols, /* The maximum number of solutions. */ + int64_t optimal, /* All solutions at most "optimal" moves from the + * shortest solution (respecting minmoves) are found. + * If negative, this parameter is ignored. + */ + void *data, /* Some solvers require extra data to function + * properly (for example, pruning tables). This data + * can be generated with gendata(), see below. + */ + char *solutions /* The solutions (return parameter) */ ); -*/ + +/* Solving n cubes optimally, one solutions per cube. Options are similar + * to solve(). + */ +void multisolve(int n, cube_t *cube, char *solver, void *data, char *sols); + +/* Returns the number of bytes written to data, -1 in case of error. + * TODO: write down how much memory every solver requires. */ +int64_t gendata(char *solver, void *data); diff --git a/old/061_coord_eo/00_solved.in b/old/061_coord_eo/00_solved.in new file mode 100644 index 0000000..dff224d --- /dev/null +++ b/old/061_coord_eo/00_solved.in @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 diff --git a/old/061_coord_eo/00_solved.out b/old/061_coord_eo/00_solved.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/00_solved.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/01_U.in b/old/061_coord_eo/01_U.in new file mode 100644 index 0000000..b5b36ad --- /dev/null +++ b/old/061_coord_eo/01_U.in @@ -0,0 +1 @@ +UR0 UL0 DB0 DF0 UB0 UF0 DL0 DR0 FR0 FL0 BL0 BR0 UBR0 UFL0 DFL0 DBR0 UFR0 UBL0 DFR0 DBL0 diff --git a/old/061_coord_eo/01_U.out b/old/061_coord_eo/01_U.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/01_U.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/02_U2.in b/old/061_coord_eo/02_U2.in new file mode 100644 index 0000000..316ad57 --- /dev/null +++ b/old/061_coord_eo/02_U2.in @@ -0,0 +1 @@ +UB0 UF0 DB0 DF0 UL0 UR0 DL0 DR0 FR0 FL0 BL0 BR0 UBL0 UFR0 DFL0 DBR0 UBR0 UFL0 DFR0 DBL0 diff --git a/old/061_coord_eo/02_U2.out b/old/061_coord_eo/02_U2.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/02_U2.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/03_U3.in b/old/061_coord_eo/03_U3.in new file mode 100644 index 0000000..7721ab5 --- /dev/null +++ b/old/061_coord_eo/03_U3.in @@ -0,0 +1 @@ +UL0 UR0 DB0 DF0 UF0 UB0 DL0 DR0 FR0 FL0 BL0 BR0 UFL0 UBR0 DFL0 DBR0 UBL0 UFR0 DFR0 DBL0 diff --git a/old/061_coord_eo/03_U3.out b/old/061_coord_eo/03_U3.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/03_U3.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/04_D.in b/old/061_coord_eo/04_D.in new file mode 100644 index 0000000..cf4f816 --- /dev/null +++ b/old/061_coord_eo/04_D.in @@ -0,0 +1 @@ +UF0 UB0 DR0 DL0 UR0 UL0 DB0 DF0 FR0 FL0 BL0 BR0 UFR0 UBL0 DBL0 DFR0 UFL0 UBR0 DFL0 DBR0 diff --git a/old/061_coord_eo/04_D.out b/old/061_coord_eo/04_D.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/04_D.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/07_R.in b/old/061_coord_eo/07_R.in new file mode 100644 index 0000000..8c8fcb3 --- /dev/null +++ b/old/061_coord_eo/07_R.in @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 FR0 UL0 DL0 BR0 DR0 FL0 BL0 UR0 DFR2 UBL0 DFL0 UBR2 UFL0 UFR1 DBR1 DBL0 diff --git a/old/061_coord_eo/07_R.out b/old/061_coord_eo/07_R.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/07_R.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/08_R2.in b/old/061_coord_eo/08_R2.in new file mode 100644 index 0000000..90765e2 --- /dev/null +++ b/old/061_coord_eo/08_R2.in @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 DR0 UL0 DL0 UR0 BR0 FL0 BL0 FR0 DBR0 UBL0 DFL0 UFR0 UFL0 DFR0 UBR0 DBL0 diff --git a/old/061_coord_eo/08_R2.out b/old/061_coord_eo/08_R2.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/08_R2.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/10_L.in b/old/061_coord_eo/10_L.in new file mode 100644 index 0000000..0b0565c --- /dev/null +++ b/old/061_coord_eo/10_L.in @@ -0,0 +1 @@ +UF0 UB0 DB0 DF0 UR0 BL0 FL0 DR0 FR0 UL0 DL0 BR0 UFR0 DBL2 UFL2 DBR0 UBL1 UBR0 DFR0 DFL1 diff --git a/old/061_coord_eo/10_L.out b/old/061_coord_eo/10_L.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/10_L.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/13_F.in b/old/061_coord_eo/13_F.in new file mode 100644 index 0000000..e805af8 --- /dev/null +++ b/old/061_coord_eo/13_F.in @@ -0,0 +1 @@ +FL1 UB0 DB0 FR1 UR0 UL0 DL0 DR0 UF1 DF1 BL0 BR0 UFL1 UBL0 DFR1 DBR0 DFL2 UBR0 UFR2 DBL0 diff --git a/old/061_coord_eo/13_F.out b/old/061_coord_eo/13_F.out new file mode 100644 index 0000000..2c60641 --- /dev/null +++ b/old/061_coord_eo/13_F.out @@ -0,0 +1 @@ +388 diff --git a/old/061_coord_eo/14_F2.in b/old/061_coord_eo/14_F2.in new file mode 100644 index 0000000..8aa701f --- /dev/null +++ b/old/061_coord_eo/14_F2.in @@ -0,0 +1 @@ +DF0 UB0 DB0 UF0 UR0 UL0 DL0 DR0 FL0 FR0 BL0 BR0 DFL0 UBL0 UFR0 DBR0 DFR0 UBR0 UFL0 DBL0 diff --git a/old/061_coord_eo/14_F2.out b/old/061_coord_eo/14_F2.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/14_F2.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/15_F3.in b/old/061_coord_eo/15_F3.in new file mode 100644 index 0000000..40f1260 --- /dev/null +++ b/old/061_coord_eo/15_F3.in @@ -0,0 +1 @@ +FR1 UB0 DB0 FL1 UR0 UL0 DL0 DR0 DF1 UF1 BL0 BR0 DFR1 UBL0 UFL1 DBR0 UFR2 UBR0 DFL2 DBL0 diff --git a/old/061_coord_eo/15_F3.out b/old/061_coord_eo/15_F3.out new file mode 100644 index 0000000..2c60641 --- /dev/null +++ b/old/061_coord_eo/15_F3.out @@ -0,0 +1 @@ +388 diff --git a/old/061_coord_eo/16_B.in b/old/061_coord_eo/16_B.in new file mode 100644 index 0000000..f7fb13c --- /dev/null +++ b/old/061_coord_eo/16_B.in @@ -0,0 +1 @@ +UF0 BR1 BL1 DF0 UR0 UL0 DL0 DR0 FR0 FL0 UB1 DB1 UFR0 UBR1 DFL0 DBL1 UFL0 DBR2 DFR0 UBL2 diff --git a/old/061_coord_eo/16_B.out b/old/061_coord_eo/16_B.out new file mode 100644 index 0000000..1fd9918 --- /dev/null +++ b/old/061_coord_eo/16_B.out @@ -0,0 +1 @@ +1539 diff --git a/old/061_coord_eo/17_B2.in b/old/061_coord_eo/17_B2.in new file mode 100644 index 0000000..9b33e35 --- /dev/null +++ b/old/061_coord_eo/17_B2.in @@ -0,0 +1 @@ +UF0 DB0 UB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BR0 BL0 UFR0 DBR0 DFL0 UBL0 UFL0 DBL0 DFR0 UBR0 diff --git a/old/061_coord_eo/17_B2.out b/old/061_coord_eo/17_B2.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/old/061_coord_eo/17_B2.out @@ -0,0 +1 @@ +0 diff --git a/old/061_coord_eo/18_B3.in b/old/061_coord_eo/18_B3.in new file mode 100644 index 0000000..1367517 --- /dev/null +++ b/old/061_coord_eo/18_B3.in @@ -0,0 +1 @@ +UF0 BL1 BR1 DF0 UR0 UL0 DL0 DR0 FR0 FL0 DB1 UB1 UFR0 DBL1 DFL0 UBR1 UFL0 UBL2 DFR0 DBR2 diff --git a/old/061_coord_eo/18_B3.out b/old/061_coord_eo/18_B3.out new file mode 100644 index 0000000..1fd9918 --- /dev/null +++ b/old/061_coord_eo/18_B3.out @@ -0,0 +1 @@ +1539 diff --git a/old/061_coord_eo/20_scrambled.in b/old/061_coord_eo/20_scrambled.in new file mode 100644 index 0000000..274d30b --- /dev/null +++ b/old/061_coord_eo/20_scrambled.in @@ -0,0 +1,3 @@ +UL0 BL0 BR1 DL0 FR0 DF0 DB1 DR1 UB0 FL0 UF0 UR1 DFL0 UFR1 DBR1 UBR2 DBL2 DFR0 UFL1 UBL2 + +// Scramble: U R D' L D' F L2 D L F B D2 B' L2 F U2 L2 D2 R2 L2 B' diff --git a/old/061_coord_eo/20_scrambled.out b/old/061_coord_eo/20_scrambled.out new file mode 100644 index 0000000..aa309cc --- /dev/null +++ b/old/061_coord_eo/20_scrambled.out @@ -0,0 +1 @@ +1122 diff --git a/old/061_coord_eo/coord_eo_tests.c b/old/061_coord_eo/coord_eo_tests.c new file mode 100644 index 0000000..30989e8 --- /dev/null +++ b/old/061_coord_eo/coord_eo_tests.c @@ -0,0 +1,26 @@ +#include +#include +#include + +#ifdef CUBE_AVX2 +#include +#endif + +#include "../../cube.h" + +#define STRLENMAX 10000 + +int main() { + char str[STRLENMAX]; + cube_t cube; + int16_t result; + + fgets(str, STRLENMAX, stdin); + cube = readcube("H48", str); + + result = coord_eo(cube); + + printf("%" PRId16 "\n", result); + + return 0; +} diff --git a/old/benchmark/bench.c b/old/benchmark/bench.c new file mode 100644 index 0000000..2c3358f --- /dev/null +++ b/old/benchmark/bench.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include + +#include "../cube.h" + +#define MOVES 100000000 +#define TRANS 100000000 +#define COMPOSE 100000000 +#define INVERSE 100000000 + +double +bench(cube_t (*run)(int64_t), int64_t n, char *name) +{ + char str[1000]; + cube_t cube; + struct timespec start, end; + double tdiff, tdsec, tdnano; + + printf("\n"); + fflush(stdout); + + if (run == NULL) { + printf("> %s: nothing to run!\n", name); + fflush(stdout); + return -1.0; + } + + printf("> %s: running benchmark...\n", name); + fflush(stdout); + clock_gettime(CLOCK_MONOTONIC, &start); + + cube = run(n); + writecube("H48", cube, str); + str[3] = 0; + printf("> %s: resulting cube, first piece: %s\n", name, str); + fflush(stdout); + + clock_gettime(CLOCK_MONOTONIC, &end); + tdsec = end.tv_sec - start.tv_sec; + tdnano = end.tv_nsec - start.tv_nsec; + tdiff = tdsec + 1e-9 * tdnano; + printf("> %s: %.4fs\n", name, tdiff); + fflush(stdout); + + return tdiff; +} + +int main() { + double tmoves, ttrans, tcompose, tinverse; + + printf( + "Benchmarks settings:\n" + "MOVES:\t%d\nTRANS:\t%d\nCOMPOSE:\t%d\nINVERSE:\t%d\n", + MOVES, TRANS, COMPOSE, INVERSE + ); + fflush(stdout); + + srand(time(NULL)); + + tmoves = bench(run_moves, MOVES, "moves"); + ttrans = bench(run_trans, TRANS, "trans"); + tcompose = bench(run_compose, COMPOSE, "compose"); + tinverse = bench(run_inverse, INVERSE, "inverse"); + + printf( + "\nBenchmark summary:\n" + "moves: %d moves in %.4fs (%.4f MTPS)\n" + "trans: %d transformations in %.4fs (%.4f MTPS)\n" + "compose: %d compositions in %.4fs (%.4f MCPS)\n" + "inverse: %d inverses in %.4fs (%.4f MIPS)\n" + "Total time: %.4f\n", + MOVES, tmoves, MOVES / (1e6 * tmoves), + TRANS, ttrans, TRANS / (1e6 * ttrans), + COMPOSE, tcompose, COMPOSE / (1e6 * tcompose), + INVERSE, tinverse, INVERSE / (1e6 * tinverse), + tmoves + ttrans + tcompose + tinverse + ); + + return 0; +} diff --git a/old/benchmark/bench.sh b/old/benchmark/bench.sh new file mode 100755 index 0000000..cc31c1e --- /dev/null +++ b/old/benchmark/bench.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +CC="cc -std=c99 -O3 -D$CUBETYPE" +if [ "$CUBETYPE" = "CUBE_AVX2" ]; then + CC="$CC -mavx2" +fi + +BENCHBIN="benchmark/run" +BENCHDIR="benchmark/results" +CUBEOBJ="cube.o" + +$CC -D_POSIX_C_SOURCE=199309L -o $BENCHBIN benchmark/bench.c $CUBEOBJ || exit 1 + +d="$(date +'%Y-%m-%d-%H-%M-%S')" +mkdir -p "$BENCHDIR" +$BENCHBIN | tee "$BENCHDIR/results-$d.txt" "$BENCHDIR/results.txt" + +echo "" +echo "Results saved to $BENCHDIR/results.txt" + +rm -rf $BENCHBIN $CUBEOBJ diff --git a/old/benchmark/cube-bench.c b/old/benchmark/cube-bench.c new file mode 100644 index 0000000..26d12a4 --- /dev/null +++ b/old/benchmark/cube-bench.c @@ -0,0 +1,147 @@ +/****************************************************************************** +Section: benchmarks + +Here you can find some simple functions that can be used to benchmark the +rest of the code. +******************************************************************************/ + +#define RANDOMCUBES 157 + +static void +setup_randomcubes(cube_fast_t *cubes) +{ + int i; + + for (i = 0; i < RANDOMCUBES; i++) + cubes[i] = run_moves(i*4); +} + +cube_t +run_moves(int64_t n) +{ + cube_fast_t fast; + int64_t m, i; + + fast = solvedcube(); + m = n / 18; + + for (i = 0; i < m; i++) { + fast = _move_U(fast); + fast = _move_U2(fast); + fast = _move_U3(fast); + fast = _move_D(fast); + fast = _move_D2(fast); + fast = _move_D3(fast); + fast = _move_R(fast); + fast = _move_R2(fast); + fast = _move_R3(fast); + fast = _move_L(fast); + fast = _move_L2(fast); + fast = _move_L3(fast); + fast = _move_F(fast); + fast = _move_F2(fast); + fast = _move_F3(fast); + fast = _move_B(fast); + fast = _move_B2(fast); + fast = _move_B3(fast); + } + + for (i = m * 18; i < n; i++) + fast = _move_F(fast); + + return fast; +} + +cube_t +run_trans(int64_t n) +{ + cube_fast_t fast; + int64_t m, i; + + fast = run_moves(33); + m = n / 18; + + for (i = 0; i < m; i++) { + fast = _trans_UFr(fast); + fast = _trans_ULr(fast); + fast = _trans_UBr(fast); + fast = _trans_URr(fast); + fast = _trans_DFr(fast); + fast = _trans_DLr(fast); + fast = _trans_DBr(fast); + fast = _trans_DRr(fast); + fast = _trans_RUr(fast); + fast = _trans_RFr(fast); + fast = _trans_RDr(fast); + fast = _trans_RBr(fast); + fast = _trans_LUr(fast); + fast = _trans_LFr(fast); + fast = _trans_LDr(fast); + fast = _trans_LBr(fast); + fast = _trans_FUr(fast); + fast = _trans_FRr(fast); + fast = _trans_FDr(fast); + fast = _trans_FLr(fast); + fast = _trans_BUr(fast); + fast = _trans_BRr(fast); + fast = _trans_BDr(fast); + fast = _trans_BLr(fast); + fast = _trans_UFm(fast); + fast = _trans_ULm(fast); + fast = _trans_UBm(fast); + fast = _trans_URm(fast); + fast = _trans_DFm(fast); + fast = _trans_DLm(fast); + fast = _trans_DBm(fast); + fast = _trans_DRm(fast); + fast = _trans_RUm(fast); + fast = _trans_RFm(fast); + fast = _trans_RDm(fast); + fast = _trans_RBm(fast); + fast = _trans_LUm(fast); + fast = _trans_LFm(fast); + fast = _trans_LDm(fast); + fast = _trans_LBm(fast); + fast = _trans_FUm(fast); + fast = _trans_FRm(fast); + fast = _trans_FDm(fast); + fast = _trans_FLm(fast); + fast = _trans_BUm(fast); + fast = _trans_BRm(fast); + fast = _trans_BDm(fast); + fast = _trans_BLm(fast); + } + + for (i = m * 18; i < n; i++) + fast = _trans_FRm(fast); + + return fast; +} + +cube_t +run_compose(int64_t n) +{ + cube_fast_t fast, cubes[RANDOMCUBES]; + int64_t i; + + setup_randomcubes(cubes); + + for (i = 0; i < n; i++) + fast = compose_fast(fast, cubes[i % RANDOMCUBES]); + + return fast; +} + +cube_t +run_inverse(int64_t n) +{ + cube_fast_t fast, cubes[RANDOMCUBES]; + int64_t i; + + setup_randomcubes(cubes); + + for (i = 0; i < n; i++) + fast = inverse_fast(cubes[i % RANDOMCUBES]); + + return fast; +} diff --git a/old/benchmark/results/results-2023-10-31-18-54-37.txt b/old/benchmark/results/results-2023-10-31-18-54-37.txt new file mode 100644 index 0000000..c0f84e5 --- /dev/null +++ b/old/benchmark/results/results-2023-10-31-18-54-37.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: UR0 +> moves: 3.5626s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 9.9028s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UF0 +> comp: 2.9944s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: DB0 +> inv: 2.6475s + +Benchmark summary: +moves: 100000000 moves in 3.5626s (28.0697 MTPS) +trans: 100000000 trans in 9.9028s (10.0981 MTPS) +comp: 100000000 comps in 2.9944s (33.3956 MCPS) +inv: 100000000 invs in 2.6475s (37.7714 MIPS) +Total time: 19.1073 diff --git a/old/benchmark/results/results-2023-10-31-19-13-49.txt b/old/benchmark/results/results-2023-10-31-19-13-49.txt new file mode 100644 index 0000000..b0716f1 --- /dev/null +++ b/old/benchmark/results/results-2023-10-31-19-13-49.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: UF0 +> moves: 3.5096s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 9.8367s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UF0 +> comp: 2.9693s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: FL0 +> inv: 2.6227s + +Benchmark summary: +moves: 100000000 moves in 3.5096s (28.4930 MTPS) +trans: 100000000 trans in 9.8367s (10.1660 MTPS) +comp: 100000000 comps in 2.9693s (33.6784 MCPS) +inv: 100000000 invs in 2.6227s (38.1283 MIPS) +Total time: 18.9383 diff --git a/old/benchmark/results/results-2023-11-01-20-55-21.txt b/old/benchmark/results/results-2023-11-01-20-55-21.txt new file mode 100644 index 0000000..adf1fd8 --- /dev/null +++ b/old/benchmark/results/results-2023-11-01-20-55-21.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: BL1 +> moves: 3.6556s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 7.5844s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UF0 +> comp: 3.0103s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: DL0 +> inv: 2.6601s + +Benchmark summary: +moves: 100000000 moves in 3.6556s (27.3556 MTPS) +trans: 100000000 trans in 7.5844s (13.1850 MTPS) +comp: 100000000 comps in 3.0103s (33.2191 MCPS) +inv: 100000000 invs in 2.6601s (37.5929 MIPS) +Total time: 16.9103 diff --git a/old/benchmark/results/results-2023-11-03-23-08-50.txt b/old/benchmark/results/results-2023-11-03-23-08-50.txt new file mode 100644 index 0000000..12e2aa6 --- /dev/null +++ b/old/benchmark/results/results-2023-11-03-23-08-50.txt @@ -0,0 +1,18 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: ERR +> moves: 6.6791s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: ERR +> trans: 6.6844s + +> comp: setting up benchmark... +> comp: running benchmark... diff --git a/old/benchmark/results/results-2023-11-03-23-10-40.txt b/old/benchmark/results/results-2023-11-03-23-10-40.txt new file mode 100644 index 0000000..5be1c1f --- /dev/null +++ b/old/benchmark/results/results-2023-11-03-23-10-40.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: BL1 +> moves: 1.6354s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: ERR +> trans: 1.9863s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UF0 +> comp: 0.3505s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: DL1 +> inv: 0.7249s + +Benchmark summary: +moves: 100000000 moves in 1.6354s (61.1463 MTPS) +trans: 100000000 trans in 1.9863s (50.3458 MTPS) +comp: 100000000 comps in 0.3505s (285.3105 MCPS) +inv: 100000000 invs in 0.7249s (137.9488 MIPS) +Total time: 4.6971 diff --git a/old/benchmark/results/results-2023-11-04-10-22-43.txt b/old/benchmark/results/results-2023-11-04-10-22-43.txt new file mode 100644 index 0000000..7a2c483 --- /dev/null +++ b/old/benchmark/results/results-2023-11-04-10-22-43.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: UF0 +> moves: 1.3535s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 1.6526s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UR0 +> comp: 0.2848s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: DF0 +> inv: 0.6598s + +Benchmark summary: +moves: 100000000 moves in 1.3535s (73.8828 MTPS) +trans: 100000000 trans in 1.6526s (60.5112 MTPS) +comp: 100000000 comps in 0.2848s (351.1409 MCPS) +inv: 100000000 invs in 0.6598s (151.5679 MIPS) +Total time: 3.9506 diff --git a/old/benchmark/results/results-2023-11-04-10-23-11.txt b/old/benchmark/results/results-2023-11-04-10-23-11.txt new file mode 100644 index 0000000..f3a60de --- /dev/null +++ b/old/benchmark/results/results-2023-11-04-10-23-11.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: UL1 +> moves: 1.3463s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 1.6303s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UF0 +> comp: 0.2881s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: UF0 +> inv: 0.6853s + +Benchmark summary: +moves: 100000000 moves in 1.3463s (74.2803 MTPS) +trans: 100000000 trans in 1.6303s (61.3400 MTPS) +comp: 100000000 comps in 0.2881s (347.0564 MCPS) +inv: 100000000 invs in 0.6853s (145.9211 MIPS) +Total time: 3.9499 diff --git a/old/benchmark/results/results-2023-11-04-10-23-43.txt b/old/benchmark/results/results-2023-11-04-10-23-43.txt new file mode 100644 index 0000000..e1f557c --- /dev/null +++ b/old/benchmark/results/results-2023-11-04-10-23-43.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: UF0 +> moves: 1.3434s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 1.6439s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UR1 +> comp: 0.2872s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: DF0 +> inv: 0.6646s + +Benchmark summary: +moves: 100000000 moves in 1.3434s (74.4399 MTPS) +trans: 100000000 trans in 1.6439s (60.8320 MTPS) +comp: 100000000 comps in 0.2872s (348.1848 MCPS) +inv: 100000000 invs in 0.6646s (150.4726 MIPS) +Total time: 3.9390 diff --git a/old/benchmark/results/results-2023-11-04-10-24-08.txt b/old/benchmark/results/results-2023-11-04-10-24-08.txt new file mode 100644 index 0000000..46eb403 --- /dev/null +++ b/old/benchmark/results/results-2023-11-04-10-24-08.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: UF0 +> moves: 1.3330s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 1.6094s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UF0 +> comp: 0.2827s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: BL0 +> inv: 0.6527s + +Benchmark summary: +moves: 100000000 moves in 1.3330s (75.0200 MTPS) +trans: 100000000 trans in 1.6094s (62.1335 MTPS) +comp: 100000000 comps in 0.2827s (353.7582 MCPS) +inv: 100000000 invs in 0.6527s (153.2026 MIPS) +Total time: 3.8778 diff --git a/old/benchmark/results/results-2023-11-04-10-52-05.txt b/old/benchmark/results/results-2023-11-04-10-52-05.txt new file mode 100644 index 0000000..597eddf --- /dev/null +++ b/old/benchmark/results/results-2023-11-04-10-52-05.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: UL0 +> moves: 3.6559s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 7.9072s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: BL1 +> comp: 3.3698s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: FL1 +> inv: 2.6933s + +Benchmark summary: +moves: 100000000 moves in 3.6559s (27.3528 MTPS) +trans: 100000000 trans in 7.9072s (12.6467 MTPS) +comp: 100000000 comps in 3.3698s (29.6755 MCPS) +inv: 100000000 invs in 2.6933s (37.1296 MIPS) +Total time: 17.6262 diff --git a/old/benchmark/results/results-2023-11-04-10-53-06.txt b/old/benchmark/results/results-2023-11-04-10-53-06.txt new file mode 100644 index 0000000..8543d81 --- /dev/null +++ b/old/benchmark/results/results-2023-11-04-10-53-06.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: UR1 +> moves: 1.3554s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 1.6302s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UF0 +> comp: 0.2880s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: DR1 +> inv: 0.6567s + +Benchmark summary: +moves: 100000000 moves in 1.3554s (73.7816 MTPS) +trans: 100000000 trans in 1.6302s (61.3423 MTPS) +comp: 100000000 comps in 0.2880s (347.2758 MCPS) +inv: 100000000 invs in 0.6567s (152.2870 MIPS) +Total time: 3.9302 diff --git a/old/benchmark/results/results-2023-11-04-10-57-46.txt b/old/benchmark/results/results-2023-11-04-10-57-46.txt new file mode 100644 index 0000000..1ad4579 --- /dev/null +++ b/old/benchmark/results/results-2023-11-04-10-57-46.txt @@ -0,0 +1,32 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMP: 100000000 +INV: 100000000 + +> moves: setting up benchmark... +> moves: running benchmark... +> moves: resulting cube, first piece: UL0 +> moves: 1.3518s + +> trans: setting up benchmark... +> trans: running benchmark... +> trans: resulting cube, first piece: UF0 +> trans: 1.6350s + +> comp: setting up benchmark... +> comp: running benchmark... +> comp: resulting cube, first piece: UF0 +> comp: 0.3039s + +> inv: setting up benchmark... +> inv: running benchmark... +> comp: resulting cube, first piece: UR1 +> inv: 0.6681s + +Benchmark summary: +moves: 100000000 moves in 1.3518s (73.9734 MTPS) +trans: 100000000 trans in 1.6350s (61.1621 MTPS) +comp: 100000000 comps in 0.3039s (329.0593 MCPS) +inv: 100000000 invs in 0.6681s (149.6737 MIPS) +Total time: 3.9589 diff --git a/old/benchmark/results/results-2023-11-10-15-49-45.txt b/old/benchmark/results/results-2023-11-10-15-49-45.txt new file mode 100644 index 0000000..6c64bc8 --- /dev/null +++ b/old/benchmark/results/results-2023-11-10-15-49-45.txt @@ -0,0 +1,28 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMPOSE: 100000000 +INVERSE: 100000000 + +> moves: running benchmark... +> moves: resulting cube, first piece: UB0 +> moves: 0.0097s + +> trans: running benchmark... +> trans: resulting cube, first piece: DB0 +> trans: 20.1464s + +> compose: running benchmark... +> compose: resulting cube, first piece: ERR +> compose: 3.7322s + +> inverse: running benchmark... +> inverse: resulting cube, first piece: DB0 +> inverse: 2.1003s + +Benchmark summary: +moves: 100000000 moves in 0.0097s (10259.5134 MTPS) +trans: 100000000 transformations in 20.1464s (4.9637 MTPS) +compose: 100000000 compositions in 3.7322s (26.7940 MCPS) +inverse: 100000000 inverses in 2.1003s (47.6116 MIPS) +Total time: 25.9886 diff --git a/old/benchmark/results/results.txt b/old/benchmark/results/results.txt new file mode 100644 index 0000000..6c64bc8 --- /dev/null +++ b/old/benchmark/results/results.txt @@ -0,0 +1,28 @@ +Benchmarks settings: +MOVES: 100000000 +TRANS: 100000000 +COMPOSE: 100000000 +INVERSE: 100000000 + +> moves: running benchmark... +> moves: resulting cube, first piece: UB0 +> moves: 0.0097s + +> trans: running benchmark... +> trans: resulting cube, first piece: DB0 +> trans: 20.1464s + +> compose: running benchmark... +> compose: resulting cube, first piece: ERR +> compose: 3.7322s + +> inverse: running benchmark... +> inverse: resulting cube, first piece: DB0 +> inverse: 2.1003s + +Benchmark summary: +moves: 100000000 moves in 0.0097s (10259.5134 MTPS) +trans: 100000000 transformations in 20.1464s (4.9637 MTPS) +compose: 100000000 compositions in 3.7322s (26.7940 MCPS) +inverse: 100000000 inverses in 2.1003s (47.6116 MIPS) +Total time: 25.9886 diff --git a/test/020_move/300_multimove_solved.in b/test/020_move/300_multimove_solved.in new file mode 100644 index 0000000..e084353 --- /dev/null +++ b/test/020_move/300_multimove_solved.in @@ -0,0 +1,2 @@ +B2 D' L2 D' B2 D B2 R2 B2 D U2 R D R2 B L' B' L2 U B2 U +UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 diff --git a/test/020_move/300_multimove_solved.out b/test/020_move/300_multimove_solved.out new file mode 100644 index 0000000..6c52430 --- /dev/null +++ b/test/020_move/300_multimove_solved.out @@ -0,0 +1 @@ +UB1 UL0 UF1 DL0 FL0 DB0 BR0 BL0 DF0 FR0 DR0 UR0 UBR1 DFR1 UBL0 DFL2 DBR1 DBL2 UFR1 UFL1 diff --git a/test/020_move/301_multimove_scrambled.in b/test/020_move/301_multimove_scrambled.in new file mode 100644 index 0000000..cc649c0 --- /dev/null +++ b/test/020_move/301_multimove_scrambled.in @@ -0,0 +1,2 @@ +D2 B2 L U2 B2 L' B2 R' D2 R D2 B F L U F2 L' R' B2 U B2 +UB1 UL0 UF1 DL0 FL0 DB0 BR0 BL0 DF0 FR0 DR0 UR0 UBR1 DFR1 UBL0 DFL2 DBR1 DBL2 UFR1 UFL1 diff --git a/test/020_move/301_multimove_scrambled.out b/test/020_move/301_multimove_scrambled.out new file mode 100644 index 0000000..102ac1b --- /dev/null +++ b/test/020_move/301_multimove_scrambled.out @@ -0,0 +1 @@ +UL1 UB0 DL1 UR0 BL1 DR1 BR0 DB0 FL1 UF0 FR1 DF0 DFR2 DFL0 DBL0 UFL0 UBR1 UBL0 UFR2 DBR1 diff --git a/test/061_coord_eo/00_solved.in b/test/061_coord_eo/00_solved.in deleted file mode 100644 index dff224d..0000000 --- a/test/061_coord_eo/00_solved.in +++ /dev/null @@ -1 +0,0 @@ -UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0 diff --git a/test/061_coord_eo/00_solved.out b/test/061_coord_eo/00_solved.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/00_solved.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/01_U.in b/test/061_coord_eo/01_U.in deleted file mode 100644 index b5b36ad..0000000 --- a/test/061_coord_eo/01_U.in +++ /dev/null @@ -1 +0,0 @@ -UR0 UL0 DB0 DF0 UB0 UF0 DL0 DR0 FR0 FL0 BL0 BR0 UBR0 UFL0 DFL0 DBR0 UFR0 UBL0 DFR0 DBL0 diff --git a/test/061_coord_eo/01_U.out b/test/061_coord_eo/01_U.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/01_U.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/02_U2.in b/test/061_coord_eo/02_U2.in deleted file mode 100644 index 316ad57..0000000 --- a/test/061_coord_eo/02_U2.in +++ /dev/null @@ -1 +0,0 @@ -UB0 UF0 DB0 DF0 UL0 UR0 DL0 DR0 FR0 FL0 BL0 BR0 UBL0 UFR0 DFL0 DBR0 UBR0 UFL0 DFR0 DBL0 diff --git a/test/061_coord_eo/02_U2.out b/test/061_coord_eo/02_U2.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/02_U2.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/03_U3.in b/test/061_coord_eo/03_U3.in deleted file mode 100644 index 7721ab5..0000000 --- a/test/061_coord_eo/03_U3.in +++ /dev/null @@ -1 +0,0 @@ -UL0 UR0 DB0 DF0 UF0 UB0 DL0 DR0 FR0 FL0 BL0 BR0 UFL0 UBR0 DFL0 DBR0 UBL0 UFR0 DFR0 DBL0 diff --git a/test/061_coord_eo/03_U3.out b/test/061_coord_eo/03_U3.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/03_U3.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/04_D.in b/test/061_coord_eo/04_D.in deleted file mode 100644 index cf4f816..0000000 --- a/test/061_coord_eo/04_D.in +++ /dev/null @@ -1 +0,0 @@ -UF0 UB0 DR0 DL0 UR0 UL0 DB0 DF0 FR0 FL0 BL0 BR0 UFR0 UBL0 DBL0 DFR0 UFL0 UBR0 DFL0 DBR0 diff --git a/test/061_coord_eo/04_D.out b/test/061_coord_eo/04_D.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/04_D.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/07_R.in b/test/061_coord_eo/07_R.in deleted file mode 100644 index 8c8fcb3..0000000 --- a/test/061_coord_eo/07_R.in +++ /dev/null @@ -1 +0,0 @@ -UF0 UB0 DB0 DF0 FR0 UL0 DL0 BR0 DR0 FL0 BL0 UR0 DFR2 UBL0 DFL0 UBR2 UFL0 UFR1 DBR1 DBL0 diff --git a/test/061_coord_eo/07_R.out b/test/061_coord_eo/07_R.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/07_R.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/08_R2.in b/test/061_coord_eo/08_R2.in deleted file mode 100644 index 90765e2..0000000 --- a/test/061_coord_eo/08_R2.in +++ /dev/null @@ -1 +0,0 @@ -UF0 UB0 DB0 DF0 DR0 UL0 DL0 UR0 BR0 FL0 BL0 FR0 DBR0 UBL0 DFL0 UFR0 UFL0 DFR0 UBR0 DBL0 diff --git a/test/061_coord_eo/08_R2.out b/test/061_coord_eo/08_R2.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/08_R2.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/10_L.in b/test/061_coord_eo/10_L.in deleted file mode 100644 index 0b0565c..0000000 --- a/test/061_coord_eo/10_L.in +++ /dev/null @@ -1 +0,0 @@ -UF0 UB0 DB0 DF0 UR0 BL0 FL0 DR0 FR0 UL0 DL0 BR0 UFR0 DBL2 UFL2 DBR0 UBL1 UBR0 DFR0 DFL1 diff --git a/test/061_coord_eo/10_L.out b/test/061_coord_eo/10_L.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/10_L.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/13_F.in b/test/061_coord_eo/13_F.in deleted file mode 100644 index e805af8..0000000 --- a/test/061_coord_eo/13_F.in +++ /dev/null @@ -1 +0,0 @@ -FL1 UB0 DB0 FR1 UR0 UL0 DL0 DR0 UF1 DF1 BL0 BR0 UFL1 UBL0 DFR1 DBR0 DFL2 UBR0 UFR2 DBL0 diff --git a/test/061_coord_eo/13_F.out b/test/061_coord_eo/13_F.out deleted file mode 100644 index 2c60641..0000000 --- a/test/061_coord_eo/13_F.out +++ /dev/null @@ -1 +0,0 @@ -388 diff --git a/test/061_coord_eo/14_F2.in b/test/061_coord_eo/14_F2.in deleted file mode 100644 index 8aa701f..0000000 --- a/test/061_coord_eo/14_F2.in +++ /dev/null @@ -1 +0,0 @@ -DF0 UB0 DB0 UF0 UR0 UL0 DL0 DR0 FL0 FR0 BL0 BR0 DFL0 UBL0 UFR0 DBR0 DFR0 UBR0 UFL0 DBL0 diff --git a/test/061_coord_eo/14_F2.out b/test/061_coord_eo/14_F2.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/14_F2.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/15_F3.in b/test/061_coord_eo/15_F3.in deleted file mode 100644 index 40f1260..0000000 --- a/test/061_coord_eo/15_F3.in +++ /dev/null @@ -1 +0,0 @@ -FR1 UB0 DB0 FL1 UR0 UL0 DL0 DR0 DF1 UF1 BL0 BR0 DFR1 UBL0 UFL1 DBR0 UFR2 UBR0 DFL2 DBL0 diff --git a/test/061_coord_eo/15_F3.out b/test/061_coord_eo/15_F3.out deleted file mode 100644 index 2c60641..0000000 --- a/test/061_coord_eo/15_F3.out +++ /dev/null @@ -1 +0,0 @@ -388 diff --git a/test/061_coord_eo/16_B.in b/test/061_coord_eo/16_B.in deleted file mode 100644 index f7fb13c..0000000 --- a/test/061_coord_eo/16_B.in +++ /dev/null @@ -1 +0,0 @@ -UF0 BR1 BL1 DF0 UR0 UL0 DL0 DR0 FR0 FL0 UB1 DB1 UFR0 UBR1 DFL0 DBL1 UFL0 DBR2 DFR0 UBL2 diff --git a/test/061_coord_eo/16_B.out b/test/061_coord_eo/16_B.out deleted file mode 100644 index 1fd9918..0000000 --- a/test/061_coord_eo/16_B.out +++ /dev/null @@ -1 +0,0 @@ -1539 diff --git a/test/061_coord_eo/17_B2.in b/test/061_coord_eo/17_B2.in deleted file mode 100644 index 9b33e35..0000000 --- a/test/061_coord_eo/17_B2.in +++ /dev/null @@ -1 +0,0 @@ -UF0 DB0 UB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BR0 BL0 UFR0 DBR0 DFL0 UBL0 UFL0 DBL0 DFR0 UBR0 diff --git a/test/061_coord_eo/17_B2.out b/test/061_coord_eo/17_B2.out deleted file mode 100644 index 573541a..0000000 --- a/test/061_coord_eo/17_B2.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/061_coord_eo/18_B3.in b/test/061_coord_eo/18_B3.in deleted file mode 100644 index 1367517..0000000 --- a/test/061_coord_eo/18_B3.in +++ /dev/null @@ -1 +0,0 @@ -UF0 BL1 BR1 DF0 UR0 UL0 DL0 DR0 FR0 FL0 DB1 UB1 UFR0 DBL1 DFL0 UBR1 UFL0 UBL2 DFR0 DBR2 diff --git a/test/061_coord_eo/18_B3.out b/test/061_coord_eo/18_B3.out deleted file mode 100644 index 1fd9918..0000000 --- a/test/061_coord_eo/18_B3.out +++ /dev/null @@ -1 +0,0 @@ -1539 diff --git a/test/061_coord_eo/20_scrambled.in b/test/061_coord_eo/20_scrambled.in deleted file mode 100644 index 274d30b..0000000 --- a/test/061_coord_eo/20_scrambled.in +++ /dev/null @@ -1,3 +0,0 @@ -UL0 BL0 BR1 DL0 FR0 DF0 DB1 DR1 UB0 FL0 UF0 UR1 DFL0 UFR1 DBR1 UBR2 DBL2 DFR0 UFL1 UBL2 - -// Scramble: U R D' L D' F L2 D L F B D2 B' L2 F U2 L2 D2 R2 L2 B' diff --git a/test/061_coord_eo/20_scrambled.out b/test/061_coord_eo/20_scrambled.out deleted file mode 100644 index aa309cc..0000000 --- a/test/061_coord_eo/20_scrambled.out +++ /dev/null @@ -1 +0,0 @@ -1122 diff --git a/test/061_coord_eo/coord_eo_tests.c b/test/061_coord_eo/coord_eo_tests.c deleted file mode 100644 index 30989e8..0000000 --- a/test/061_coord_eo/coord_eo_tests.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include - -#ifdef CUBE_AVX2 -#include -#endif - -#include "../../cube.h" - -#define STRLENMAX 10000 - -int main() { - char str[STRLENMAX]; - cube_t cube; - int16_t result; - - fgets(str, STRLENMAX, stdin); - cube = readcube("H48", str); - - result = coord_eo(cube); - - printf("%" PRId16 "\n", result); - - return 0; -} -- cgit v1.3