Hi Erik!emadsen wrote: ↑Wed Nov 28, 2018 3:47 amHi Louis. Welcome to the TalkChess forum and congratulations on your accomplishment! Writing an original chess engine requires a lot of determination and mental focus. You should be proud of reaching this milestone- an engine that plays a game of chess. I laugh at your use of the word "finished." I know you qualified it with "the first version" but we'll see how you feel about that word in a few months or years. Our hobby is addictive and encourages constant tinkering.AxolotlFever wrote: ↑Wed Nov 14, 2018 11:21 amI would like to introduce my new chess engine, Axolotl! This engine is written in Java (10), and compiled to 8. It is a UCI engine
I looked through your source code and can offer some advice regarding why your engine is not a fast as you'd like it to be. The single most significant killer of speed is the use of the "new" keyword. If you want to improve the performance of your engine then eliminate all memory allocations during search. Make it your mission to find every use of the "new" keyword and move it outside of the search function (or any functions called by search). Create and populate all your data structures during engine startup. Reference these pre-allocated data structures during search. Modify them if necessary but do not construct new objects during search. Like this:
Thank you so much for this feedback, I have started implementing the changes you suggested, and I can already feel a speed boost! Thanks also for your kind words - and I definitely see what you mean about constant tinkering!
The next version of Axolotl will be out in a few days, taking on board much of what you and others said. I cannot express how grateful I am for this wonderful and freely given feedback, it is really heartwarming.
Ok back to code! In your answer, one sentence left me unsure,
I understand the for loops > for each, but when we talk about arrays I am struggling a bit. My understanding is that, in java, arrays are fixed size. So if I use an array to store moves (ints), I would have to know ahead of time how many moves will be generated, which seems impossible. I could also work out the maximum possible number of moves, which might be about 80 (?) and always populate an array that size, but this seems to be wasteful of memory, especially when escaping check. Sorry to be unclear on this! Could you possibly let me know how arrays could be used?Prefer to use arrays and for loops over Lists and foreach
Thanks very much for your time, and I hope to give madchess a good game someday!
Kind regards,
Louis