aboutsummaryrefslogtreecommitdiff
path: root/test/080_allowednext/allowednext_tests.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-04-16 17:51:05 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-04-16 17:51:05 +0200
commit81708be1d1784f41343530e8e01a68094bc50da6 (patch)
treee9894214d6bdf551e6ef1496a7483bffd3e79a77 /test/080_allowednext/allowednext_tests.c
parent5378be20bc24ea0c8681da17d0585ee6ff82f788 (diff)
downloadnissy-core-81708be1d1784f41343530e8e01a68094bc50da6.tar.gz
nissy-core-81708be1d1784f41343530e8e01a68094bc50da6.zip
Failed attempts to fix / debug eoesep + other changes
Diffstat (limited to 'test/080_allowednext/allowednext_tests.c')
-rw-r--r--test/080_allowednext/allowednext_tests.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/test/080_allowednext/allowednext_tests.c b/test/080_allowednext/allowednext_tests.c
index 7ae7f66..e531911 100644
--- a/test/080_allowednext/allowednext_tests.c
+++ b/test/080_allowednext/allowednext_tests.c
@@ -1,6 +1,6 @@
1#include "../test.h" 1#include "../test.h"
2 2
3bool allowednextmove(uint8_t *, int, uint8_t); 3bool allowednextmove(uint8_t *, uint8_t);
4 4
5static char *moves[] = { 5static char *moves[] = {
6 "U", "U2", "U'", 6 "U", "U2", "U'",
@@ -13,7 +13,7 @@ static char *moves[] = {
13 13
14int main(void) { 14int main(void) {
15 char movestr[STRLENMAX]; 15 char movestr[STRLENMAX];
16 uint8_t m[100], next; 16 uint8_t m[100];
17 int n, i, j; 17 int n, i, j;
18 18
19 fgets(movestr, STRLENMAX, stdin); 19 fgets(movestr, STRLENMAX, stdin);
@@ -26,17 +26,12 @@ int main(void) {
26 if (!strcmp(movestr, moves[j])) 26 if (!strcmp(movestr, moves[j]))
27 m[i] = j; 27 m[i] = j;
28 } 28 }
29 fgets(movestr, STRLENMAX, stdin);
30 movestr[strcspn(movestr, "\n")] = 0;
31 for (j = 0; j < 18; j++)
32 if (!strcmp(movestr, moves[j]))
33 next = j;
34 29
35 fprintf(stderr, "Last two: %s, %s\nNext: %s\n", 30 fprintf(stderr, "Last two: %s, %s\nNext: %s\n",
31 n > 2 ? moves[m[n-3]] : "-",
36 n > 1 ? moves[m[n-2]] : "-", 32 n > 1 ? moves[m[n-2]] : "-",
37 n > 0 ? moves[m[n-1]] : "-", 33 n > 0 ? moves[m[n-1]] : "-");
38 moves[next]); 34 printf("%s\n", allowednextmove(m, n) ? "true" : "false");
39 printf("%s\n", allowednextmove(m, n, next) ? "true" : "false");
40 35
41 return 0; 36 return 0;
42} 37}

Generated with cgit - Back to sebastiano.tronto.net