Toledo chess program
Forum rules
Be nice. No drama.
Be nice. No drama.
Toledo chess program
See here:
https://nanochess.org/chess.html
https://nanochess.org/faq.html
Just wanted to see, if glcc would compile it and if it would even run
It compiles and runs - but:
It always says 'illegal' to any input - something is wrong at reading and compute input?
Since computer playing is activated with command parameter, this is not working right now.
Maybe the c experts want to have a look at this nice piece of obfuscated source
Have fun.
https://nanochess.org/chess.html
https://nanochess.org/faq.html
Just wanted to see, if glcc would compile it and if it would even run
It compiles and runs - but:
It always says 'illegal' to any input - something is wrong at reading and compute input?
Since computer playing is activated with command parameter, this is not working right now.
Maybe the c experts want to have a look at this nice piece of obfuscated source
Have fun.
- Attachments
-
- Bildschirmfoto 2024-04-04 um 12.33.30.png (349.27 KiB) Viewed 7347 times
-
- Bildschirmfoto 2024-04-04 um 12.33.16.png (54.19 KiB) Viewed 7347 times
-
- toledo.zip
- (29.67 KiB) Downloaded 495 times
Re: Toledo chess program
From the FAQ
Checked on ROMv6.
Checked on ROMv6.
Re: Toledo chess program
Thanks! I just did the required changes for modern C++ compiler. But now I replaced all occurrences of 1e5 with 2e4, and 1e9 with 3e4 and it runs fine now. Now we just need to figure out, how to have computer play black
best, Peter
best, Peter
- Attachments
-
- Bildschirmfoto 2024-04-05 um 11.56.59.png (62.93 KiB) Viewed 7303 times
-
- toledo.zip
- (18.81 KiB) Downloaded 308 times
Re: Toledo chess program
According to the web page, one has to invoke it with one dummy argument to make it play black.
Because there is no command line, glcc programs always start with argc=0 and argv=0.
But here we just have to change this
Code: Select all
int main(int argc, char *argv[])
{
X((int)argc, 0, 0, 0);
}
Code: Select all
int main(int argc, char *argv[])
{
X(2, 0, 0, 0);
}
To compare with MSCP, go to https://www.gigatron128k.com, select "SpiCard", then "Apps", then "MSCP", then "mscp_128k.gt1".
This is a much bigger program.
Re: Toledo chess program
Thx. On PC with i5 3GHz, the answer is instantly. On Gigatron emulation, I had to wait probably "hours" (broken up - hat to go).
I will test on real hardware the next days.
best, Peter
I will test on real hardware the next days.
best, Peter
- Attachments
-
- Bildschirmfoto 2024-04-07 um 19.20.21.png (42.09 KiB) Viewed 7251 times
Re: Toledo chess program
Replacing all the 1e4, 2e4, 3e4 by integers 10000,20000,30000 should make it run a bit faster.
Otherwise the expression is promoted to floating point which is emulated in software.
Still waiting ... is something wrong?
Otherwise the expression is promoted to floating point which is emulated in software.
Still waiting ... is something wrong?
Re: Toledo chess program
ok.
Did that. In small sdl2 emu, I am waiting now app. 50min for any computer answer. In real HW, with 128kd7 rom, I am waiting now app. 30min.
No computer answer? I compiled again for PC i5 3k. Runs fine and answer is instandly there.
??
best, Peter
Did that. In small sdl2 emu, I am waiting now app. 50min for any computer answer. In real HW, with 128kd7 rom, I am waiting now app. 30min.
No computer answer? I compiled again for PC i5 3k. Runs fine and answer is instandly there.
??
best, Peter
- Attachments
-
- toledo.zip
- (39.28 KiB) Downloaded 429 times
Re: Toledo chess program
The main difference is the size of integers, two bytes vs four bytes. The faq says that it can work, but that might be old information. It might also be possible that glcc has a bug but this is not the right way to isolate it (obfuscation does not help debugging).
Re: Toledo chess program
- I tried this in Linux X86 and it runs ok. Responds in a second. Compiled with GCC shows no errors.
- Then I tried Gigatron version and it runs forever to respond to move. It took more than hour to respond. Compiled with GLCC it showed couple of errors, but those were easy to fix with return 0;
- I gave a try with OpenAI / ChatGPT to cleanup the code. It was too complex to cleanup and I don't think it's a real AI processing it.
- Second try with OpenAI / ChatGPT was to make similar chess game that AI would make. Well it is not up to making full games.
There is nothing else besides microchess that can run so small amount of memory.
https://github.com/kervinck/gigatron-ro ... Microchess
- Then I tried Gigatron version and it runs forever to respond to move. It took more than hour to respond. Compiled with GLCC it showed couple of errors, but those were easy to fix with return 0;
Code: Select all
../CODE/toledo.c:14: warning: missing return value
../CODE/toledo.c:79: warning: missing return value
- Second try with OpenAI / ChatGPT was to make similar chess game that AI would make. Well it is not up to making full games.
There is nothing else besides microchess that can run so small amount of memory.
https://github.com/kervinck/gigatron-ro ... Microchess
Re: Toledo chess program
I added some printf() into the code to debug. Looking at the output and comparing with the same on a PC, I realized that the Gigatron would take about 12 hours to answer an initial e2e4. (compiled for the dev7 rom).
Then I compiled a gtsim version because gtsim runs faster than real hardware. It plays!
Then I compiled a gtsim version because gtsim runs faster than real hardware. It plays!
Code: Select all
$ glcc -rom=dev7 -map=sim -o toledos.gt1 toledo.c
...
$ gtsim -rom=.../dev7.rom -vmode=1975 toledos.gt1
e2e4
...