Check out Janggi (Korean Chess), our featured variant for December, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

GAME code table-driven move generator[Subject Thread] [Add Response]
H. G. Muller wrote on Tue, Jul 28, 2020 07:22 PM UTC:

I stumbled again on a mystery. I define this large array, and some code to print what is in it:

set legdefs
(0
1  1  0  1     1
1  1  1  1     2
1  1 -1  1     2
1  1  0  2   16577 // pawn(1)
1  1  1  1     4
1  1 -1  1     4
0
1  1  0 -1     1
1  1 -1 -1     2
1  1  1 -1     2
1  1  0 -2   16577 // pawn(32)
1  1 -1 -1     4
1  1  1 -1     4
0
//... snip ...
2 99 -1 -1    16
  99 -1 -1     2
2 99 -1  1    16
  99 -1  1     2
0);

set k 0;
do while < #k 100:
  print join #k join ". " elem #k #legdefs;
  inc k;
loop;
die "stop";

But what it prints is this:

...
20. 16577
21. 1
22. 1
23. 1
24. 1
25. 4
26. 1
27. 1
28. -1
29. 1
30. 4
31. 1
32. 1
33. 0
34. -1
...

It seems the 0 at location 31 did not get into the array. That does not seem kosher to me...