No apology necessary… how many projects out there have major
version numbers less than 1?
Thanks, Hal! I appreciate it.
When you say it crashes, do you mean that literally? Or what?
No, sorry. It exits with an error message, like this, for
example:
kingix is NIL!!! color=-1… about to crash
./nchess6.rb:1924:in []': no implicit conversion from nil to integer (TypeError) from ./nchess6.rb:1924:in
Eval’
from ./nchess6.rb:1918:in each' from ./nchess6.rb:1918:in
Eval’
from ./nchess6.rb:1781:in Eval' from ./nchess6.rb:2407:in
ABnegaSearchZWTail’
from ./nchess6.rb:2383:in times' from ./nchess6.rb:2383:in
ABnegaSearchZWTail’
from ./nchess6.rb:2457:in ABnegaSearchZWTail' ... 11 levels... from board.rb:1028:in
PrepareForNextMoveWhenOpponentThinks’
from board.rb:812:in replaystart' from board.rb:230:in
build’
from board.rb:1079
While I could easily prevent that particular ?crash? from happening, it
is indicative of
an error somewhere in the engine that needs to be fixed, so I?m not just
plugging the hole,
if that makes any sense.
Is part of this in C?
No, it is 100% pure Ruby. It is a line-by-line port of the
Pythonchess-0.6, with
only one tiny tweak I made myself because I had always wanted the python
version to
draw a red box around where it last moved from to where it last moved
to, in case I was
looking away when it moved.
Is Ruby’s performance acceptable (up till the time it dies)?
Well, that is an excellent question. At work, I?ve got a
brand new screaming
Core Duo machine, and the performance is great. But if you run the
python version
side-by-side with the Ruby version, the python version is easily 10x
faster, and sometimes
100x faster based purely on the ?number of nodes? it processes during
the game, which
it reports in the GUI. So most of the time Ruby will process ~200
nodes/second while
python would be processing ~4000 nodes/second. Sad, but true. I wish
someone
would just step in and make an ?-O? flag for ruby that either
byte-compiled the script
or native-compiled it and then ran it.
– Glenn
Hal