Skip to content

Conversation

@sowson
Copy link

@sowson sowson commented Feb 19, 2025

Hi @jhlywa, I'm working on that one. It now needs more description in the README.md file only. I am still looking into some issues with the Perf Test of Chess 960. With Depth 2, I have 4 different values, and on Depth 3, I have 21 different values. I'm not sure why. Thanks!

@sowson
Copy link
Author

sowson commented Feb 19, 2025

Can someone figure out what is wrong with the code so that 100% of the tests pass? Depths 2nd: 4/960 and 3rd: 21/960 failed. I attached tests here below.

960-2-perf.test.ts.zip
960-3-perf.test.ts.zip

Thanks!

@sowson
Copy link
Author

sowson commented Feb 20, 2025

Hi @jhlywa ;-). I am stuck on this isolated issue I added as a following test case. I think I should allow Rook H1 to move to F1 and bring King from F1 to G1 :D. Does that make sense?

it('X-FEN O-O 960 19', () => { const chess = new Chess( 'nbbnrkqr/p1pp3p/1p2p1p1/5p2/8/4PP2/PPPPRQPP/NBBN1K1R w Hh - 0 5', ) chess.move({ from: 'h1', to: 'f1' }) expect(chess.fen()).toEqual('nbbnrkqr/p1pp3p/1p2p1p1/5p2/8/4PP2/PPPPRQPP/NBBN1RK1 b h - 1 5') })

Here is the situation on the board:
Screenshot 2025-02-20 at 12 18 12

@sowson
Copy link
Author

sowson commented Feb 20, 2025

Hi, @jhlywa. Could you merge this PR as the next milestone? I added the Perf Tests for Depth 2 and 3 as TXT files to rename when 100% pass. Now, on depth 2nd, 954/960 passes, and on depth 3rd, 932/960 passes. Thank you!

@sowson
Copy link
Author

sowson commented Feb 21, 2025

Hi @jhlywa, what do you think about this one? Could you merge this milestone? I made Many Improvements except README.

@sowson
Copy link
Author

sowson commented Feb 23, 2025

Here is the last piece of this Code Puzzle to solve:

it('X-FEN O-O-O 960 29', () => { const chess = new Chess( 'rk2bnqb/pprpppp1/4n2p/2p5/P7/3PN1NP/1PP1PPP1/RKR1B1QB b CAa - 2 9', ) chess.move({ from: 'a8', to: 'd8' }) chess.undo() expect(chess.fen()).toEqual( 'rk2bnqb/pprpppp1/4n2p/2p5/P7/3PN1NP/1PP1PPP1/RKR1B1QB b CAa - 2 9', ) })

@sowson
Copy link
Author

sowson commented Feb 25, 2025

Hi @jhlywa The work done! :D. All 100% means 3311 tests pass :D. Thank you!

@sowson
Copy link
Author

sowson commented Feb 25, 2025

@jhlywa Fork Synced in Case of Merge :D. For eventual manual tests, you may try https://iChess.io site :D.

@jhlywa jhlywa mentioned this pull request Mar 1, 2025
@jhlywa
Copy link
Owner

jhlywa commented Mar 1, 2025

Hi @sowson. Sorry, I've been on travel and haven't been able to review any changes.

Another PR (#493) with 960 support has come over the last week as well. I'll need to spend some time reviewing and testing both before making any decisions. Either way, I appreciate your PR and the resulting discussion it spawned.

@sowson
Copy link
Author

sowson commented Mar 1, 2025

Hi @jhlywa, it looks like #493 is better. I found one wrong test, and I checked on PR #493, and it is okay. So... looks like I cannot be merged. Simply PR #493 is better.
test('perft - 960 - position 646', () => { const chess = new Chess( 'rnbkrbqn/p1pp1ppp/4p3/1p6/8/BPN3P1/P1PPPP1P/R2KRBQN w EAea - 2 9', { enable960: true } ) expect(chess.perft(3)).toBe(20014) })

@sowson
Copy link
Author

sowson commented Mar 1, 2025

Hi, @jhlywa. I think I am correct.

Take a look for position 646 of perf tests depth 3:
it('X-FEN O-O 960 28', () => { const chess = new Chess( 'rnbkrbqn/p1pp1ppp/4p3/1p6/8/BPN3P1/P1PPPP1P/R2KRBQN w AEae - 2 9', ) chess.loadPgn('9. Bh3 c6 10. Qg2 g6') expect(chess.moves().length).toBe(36) chess.move({ from: 'd1', to: 'g1' }) expect(chess.fen()).toEqual( 'rnbkrbqn/p2p1p1p/2p1p1p1/1p6/8/BPN3PB/P1PPPPQP/R4RKN b ea - 1 11', ) }) })

Screenshot 2025-03-01 at 14 50 13

@sowson
Copy link
Author

sowson commented Mar 1, 2025

The 646 perf test starts incorrectly at the 3rd level of depth. It is only one case, and I added some special checking, but overall, it is wrong.

@sowson
Copy link
Author

sowson commented Mar 2, 2025

Hi, @jhlywa. Let me explain the non-working test. I checked many things, and I think it is as it should be regarding the situation:

X-FEN: rnbkrbqn/p1pp1ppp/4p3/1p6/8/BPN3P1/P1PPPP1P/R2KRBQN w AEae - 2 9
PGN: 9. Bh3 c6 10. Qg2 g6

Screenshot 2025-03-02 at 15 42 04

We have the following moves for Castling: by rook O-O-O (a1-d1) (looks like capturing your own King) and 0-0 (d1-g1), like jumping (over the Rook). That is why I wanted to make UI/UX and one move only per case. I will not plan to add more commits, so if you like it, take it... If you have questions, try to find out how it works at https://iChess.io, and I hope you will like it.

Thanks a lot. Without this project, I could not find such a good solution. Thanks!

@sowson
Copy link
Author

sowson commented Jun 11, 2025

Hi @jhlywa can you please decide what happens with this PR? I am using exactly this, also combined with https://github.com/sowson/libchess, at https://iChess.io, and it works excellently, stably, and with backward compatibility. I know that there are other PR... but I checked it and it breaks compatibility. Anyway, please decide whether to merge or reject. Thanks for this great work, I can run Chess 960 on my site. BR!, @sowson

@neofight78
Copy link
Collaborator

@sowson Thanks for the PR, I think we are leaning more towards accepting the other PR currently. But that doesn't mean your input isn't valued and useful. I expect post merge the code will evolved further prior to the 2.0 release too.

You mention about backward compatibility being an issue, can you expand on what you mean? Are you talking in terms of the 960 branch or the master branch? Does the API in the other PR present any particular difficulties for you or would it be fairly easy to adapt your code?

I am keen to get a solution merged in master soon, but everybody is operating in their spare time etc...

@sowson
Copy link
Author

sowson commented Sep 11, 2025

Hi @neofight78, can you or @jhlywa merge to the 960 branch... at last I figured it out. Castling is by the "collect" rook. And X-FEN is automatically detected. Code is simpler and friendlier. Thanks a lot! ;-). I learn and self-study a lot, thanks to this!

@sowson
Copy link
Author

sowson commented Sep 11, 2025

Sorry, one more thing I need to add, do not merge yet, pls :D.

@sowson
Copy link
Author

sowson commented Sep 11, 2025

Ok, now is the best I was able to do!!! :D. Thanks a lot!

@sowson
Copy link
Author

sowson commented Sep 11, 2025

You may test it at https://iChess.io site. This is for my PhD. Thanks again!

@sowson
Copy link
Author

sowson commented Sep 11, 2025

There is one more thing... it is compatible with this one with the C++ library improved as well at https://github.com/sowson/libchess so, I can compute on GPU with https://github/sowson/darknet I forked as well:D.

@sowson
Copy link
Author

sowson commented Sep 26, 2025

At last, all tests pass, can. You update the 960 branch with that one?

@sowson
Copy link
Author

sowson commented Sep 26, 2025

I am asking @jhlywa and @neofight78 when the current 960 branch will be outdated and have issues. This one is not. :-).

@sowson
Copy link
Author

sowson commented Sep 26, 2025

It auto-detects that XFEN has been provided, and I like it. I hope you too.

@sowson
Copy link
Author

sowson commented Oct 29, 2025

Hi guys, any update for 960 branch at least?? :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants