small code-style improvements and typofix - randomcrap - random crap programs of varying quality
(HTM) git clone git://git.codemadness.org/randomcrap
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit f9e923c7dc9c8cc10a71d9f305961a0ccd0287a6
(DIR) parent ccfd3b75fd9368ff84c604a337e094038fdcd4d3
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 23 Jan 2024 20:26:43 +0100
small code-style improvements and typofix
Diffstat:
M 960pos.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/960pos.c b/960pos.c
@@ -33,7 +33,7 @@ postab(int n, char *rank)
"QRKRNN", "RQKRNN", "RKQRNN", "RKRQNN", "RKRNQN", "RKRNNQ"
};
- /* Bishop's table */
+ /* Bishop's table: encoded squares between them */
unsigned char btab[] = {
0, 0, 0, 2, 0, 4, 0, 6, 1, 0, 2, 0, 2, 2, 2, 4,
1, 2, 3, 0, 4, 0, 4, 2, 1, 4, 3, 2, 5, 0, 6, 0
@@ -59,16 +59,17 @@ postab(int n, char *rank)
rank[i] = *s;
s++;
}
-
+
rank[8] = '\0'; /* NUL */
}
-/* more computation way to generate the position */
+/* more computational way to generate the position */
void
poscomp(int n, char *rank)
{
int n1, n2, n3, n4, b1, b2, q, i;
- int ntab[] = { 0, 0, 0, 1, 0, 2, 0, 3, 1, 0, 1, 1, 1, 2, 2, 0, 2, 1, 3, 0 };
+ /* knights table: encoded squares between them */
+ unsigned char ntab[] = { 0, 0, 0, 1, 0, 2, 0, 3, 1, 0, 1, 1, 1, 2, 2, 0, 2, 1, 3, 0 };
for (q = 0; q < 8; q++)
rank[q] = 0;