aboutsummaryrefslogtreecommitdiff
path: root/src/cube_public.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-07-04 17:09:55 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-07-04 17:09:55 +0200
commit518d98ad5f9eec0cf4124375bdbb84d1296b3f3f (patch)
tree467b2b0387f23a0b379cf428c6883937ec18c134 /src/cube_public.h
parent425eee24421bf0a19c7e0199d2e3ecba3318c8f4 (diff)
downloadnissy-core-518d98ad5f9eec0cf4124375bdbb84d1296b3f3f.tar.gz
nissy-core-518d98ad5f9eec0cf4124375bdbb84d1296b3f3f.zip
(almost) added getcube
Diffstat (limited to 'src/cube_public.h')
-rw-r--r--src/cube_public.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/cube_public.h b/src/cube_public.h
index fe003c9..b537019 100644
--- a/src/cube_public.h
+++ b/src/cube_public.h
@@ -2,6 +2,16 @@
2 2
3_static int64_t write_result(cube_t, char [static 22]); 3_static int64_t write_result(cube_t, char [static 22]);
4 4
5/* TODO: add option to get DR, maybe C-only, E-only, eo... */
6#define GETCUBE_OPTIONS(S, F) { .option = S, .fix = F }
7struct {
8 char *option;
9 void (*fix)(int64_t *, int64_t *, int64_t *, int64_t *);
10} getcube_options[] = {
11 GETCUBE_OPTIONS("fix", getcube_fix),
12 GETCUBE_OPTIONS(NULL, NULL)
13};
14
5_static int64_t 15_static int64_t
6write_result(cube_t cube, char result[static 22]) 16write_result(cube_t cube, char result[static 22])
7{ 17{
@@ -105,15 +115,25 @@ nissy_convert(
105} 115}
106 116
107int64_t 117int64_t
108nissy_gencube( 118nissy_getcube(
109 uint8_t id[16], 119 int64_t ep,
120 int64_t eo,
121 int64_t cp,
122 int64_t co,
110 const char *options, 123 const char *options,
111 char result[static 22] 124 char result[static 22]
112) 125)
113{ 126{
114 /* TODO: compute cube from id % (number of positions) */ 127 int i;
115 /* options can be used for generating e.g. DR-state cube */ 128 cube_t c;
116 return -1; 129
130 for (i = 0; getcube_options[i].option != NULL; i++)
131 if (!strcmp(options, getcube_options[i].option))
132 getcube_options[i].fix(&ep, &eo, &cp, &co);
133
134 c = getcube(ep, eo, cp, co);
135
136 return write_result(c, result);
117} 137}
118 138
119int64_t 139int64_t

Generated with cgit - Back to sebastiano.tronto.net