Add chess960 support. This is a roll-up of all changes from the 'chess960support' branch.#551
Add chess960 support. This is a roll-up of all changes from the 'chess960support' branch.#551deverac wants to merge 6 commits into
Conversation
…s960support' branch.
|
It's coming together nicely now. Looking at load() it seems to me that the castling logic can be simplified quite a bit, and consequently elsewhere in the code. My observations are:
Hopefully that gives you enough to go on? |
|
This looks like it might be a bug as it won't filter out any moves: I think the correct logic is to OR the flags and then NOT the result. Either this doesn't matter in which case there is no need for the filter, or there should be a test that fails on it (before fixing). |
|
Great catch! You are exactly right about the OR/NOT logic. I've added a bug fix (with tests) for it. I think I understand the other suggestions you mentioned, which all seem sensible. When I initially submitted the Chess960 changes, I was trying to touch the existing code as little as possible, but it's nice to have some knowledgeable eyes to help integrate the necessary changes into the existing code base. I think all of your suggestions have been good steps in the right direction. |
|
In addition to the suggested changes, one further optimisation could be made. Instead of filtering all the moves with _filterMoves() and then looping through them, you could put all the logic together inside a find() allowing you to stop as soon as a match is made. Best to benchmark it before and after to check, but it should improve the speed I think. |
|
Worth taking note of this recent change / fix BTW: #554 Let me know if you are still happy to make the suggested changes / fixes. I assume you are just busy with other things right now? |
|
Hi @deverac can you check this one. Is that by propuse? on my PR at last it works :-). |
|
Hi @deverac, please let me know if you are wanting to get back to the branch and complete the changes. If not, we'll have to look at how to proceed. |
|
@neofight78 @sowson I'm sorry about my absence. I'm back 'online' now and, if you are agreeable with it, will continue from were I left off. |
|
Yes, that would be great! This PR is not too far off being ready. |
I am not quite sure what you are asking. This test above does not appear in the In the test above, the I am not sure if this has answered your question. If not, please rephrase your question. |
I wrote two versions of the code: one version is the current code in this PR (it calls the I then wrote a test which performs a Chess960 castling move and makes the move 100,000 times. I ran the test against both version of the code. The second version of the code might be a tiny bit faster, but if it is, the difference is negligible. When running the test, which uses Google/Node's V8 engine, I suspect the Javascript engine (or JIT compiler?) may be doing optimizations which causes both versions of the code to be essentially the same. When In any case, I think the version that removed the |
|
Hi guys, I'm just wondering what is the status of this PR ? Can we assume chess960 will be supported by this lib at some point ? |
This contains all changes up to and including the commit 'Refactor to remove PreMove and _preprocessMove().' f1b9523
This is a 'roll-up' of all changes made in PR #493.