aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-03-26 19:22:50 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-03-26 19:22:50 +0100
commit83338a2f753ebbb7ba7b154cc60b2f427b6121b0 (patch)
tree149efb6a0b835fd6b3d89f7fd7808f8eed8e0288 /src/core
parent56048d13b73ec6e6a9c59d62e82f41e69a3994bd (diff)
downloadnissy-core-83338a2f753ebbb7ba7b154cc60b2f427b6121b0.tar.gz
nissy-core-83338a2f753ebbb7ba7b154cc60b2f427b6121b0.zip
Added inverse coordinate for CO
this is necessary for DR coordinate
Diffstat (limited to 'src/core')
-rw-r--r--src/core/cube.h2
-rw-r--r--src/core/io_moves.h16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/core/cube.h b/src/core/cube.h
index 7a68fb2..3dd3ccb 100644
--- a/src/core/cube.h
+++ b/src/core/cube.h
@@ -61,7 +61,7 @@ isconsistent(cube_t cube)
61 } 61 }
62 for (i = 0; i < 8; i++) 62 for (i = 0; i < 8; i++)
63 if (!found[i]) 63 if (!found[i])
64 goto inconsistent_co; 64 goto inconsistent_cp;
65 65
66 return true; 66 return true;
67 67
diff --git a/src/core/io_moves.h b/src/core/io_moves.h
index b00682b..c94b6b7 100644
--- a/src/core/io_moves.h
+++ b/src/core/io_moves.h
@@ -1,5 +1,6 @@
1STATIC uint8_t readmove(char); 1STATIC uint8_t readmove(char);
2STATIC int64_t readmoves(const char *, size_t n, uint8_t [n]); 2STATIC int64_t readmoves(const char *, size_t n, uint8_t [n]);
3STATIC int64_t countmoves(const char *);
3STATIC uint8_t readmodifier(char); 4STATIC uint8_t readmodifier(char);
4STATIC int64_t writemoves(size_t n, const uint8_t [n], size_t m, char [m]); 5STATIC int64_t writemoves(size_t n, const uint8_t [n], size_t m, char [m]);
5 6
@@ -72,6 +73,21 @@ readmoves(const char *buf, size_t n, uint8_t ret[n])
72} 73}
73 74
74STATIC int64_t 75STATIC int64_t
76countmoves(const char *buf)
77{
78 uint8_t m;
79 uint64_t c;
80
81 FOREACH_READMOVE(buf, m, c, INT_MAX, NISSY_ERROR_INVALID_MOVES,
82 {}
83 )
84
85 (void)m; /* Ignore "variable set but not used" warning */
86
87 return (int64_t)c;
88}
89
90STATIC int64_t
75writemoves( 91writemoves(
76 size_t nmoves, 92 size_t nmoves,
77 const uint8_t m[nmoves], 93 const uint8_t m[nmoves],

Generated with cgit - Back to sebastiano.tronto.net