Live data from Hacker News

I Made a Chess Library in Java

jaeheonshim.com

21–30 of 31 posts

Re: I Made a Chess Library in Java

#21
post #7

You need to switch your data representation to 0x88 [1] or bitbords [2] to get anything performant. You won't get anywhere with a class hierarchy [1] https://www.chessprogramming.org/0x88 [2] https://www.chessprogramming.org/Bitboards

You need to consider the goals of a project before giving advice.

Re: I Made a Chess Library in Java

#23
post #18

As someone who has implemented online multiplayer tbs games before, this is exactly the kind of thing you would use at the backend. However, you also need the same code running on the frontend in order to do validations before sending moves to the backend. That optimization helps distribute some server load and gets you immediate feedback. In Java's case, I'd use some java to js or java to kotlin to js transpilation.

Is performing chess validations that heavy, if you're serving ~10,000 games? (just asking for a friend)

To do all validations and move suggesions on the server side causes data traffic for no reason. Not just cpu time. It is senseless.

Re: I Made a Chess Library in Java

#24
The first thing you'd want to implement is perft: https://www.chessprogramming.org/Perft_Results It actually doubles as a performance test(like it's name) and a debugging tool to verify that you can generate moves correctly by comparing your numbers vs the positions given on the website and a few large suites.

I'd encourage you to get involved with the passionate community at talkchess: http://talkchess.com/forum3/index.php

And join a small group on IRC at Freenode ##chessprogramming where we discuss chess AIs, libraries and often other games like Ataxx and Go.

I myself am an author of a chess library: https://github.com/Mk-Chan/libchess ! Great to see development for Java as well

Re: I Made a Chess Library in Java

#25
post #7

You need to switch your data representation to 0x88 [1] or bitbords [2] to get anything performant. You won't get anywhere with a class hierarchy [1] https://www.chessprogramming.org/0x88 [2] https://www.chessprogramming.org/Bitboards

You need to consider the goals of a project before giving advice.

OP mentions chess AI and game analyzer. Those would benefit from an optimized data representation.

Re: I Made a Chess Library in Java

#26
post #10
post #7

You need to switch your data representation to 0x88 [1] or bitbords [2] to get anything performant. You won't get anywhere with a class hierarchy [1] https://www.chessprogramming.org/0x88 [2] https://www.chessprogramming.org/Bitboards

If the API is well written, this is an implementation detail.

Well, it depends on the project goals. For a GUI app I can agree but good luck writing a chess engine where data representation is hidden behind an abstract interface.

Re: I Made a Chess Library in Java

#28
post #25

Earlier quoted context omitted.

You need to consider the goals of a project before giving advice.

OP mentions chess AI and game analyzer. Those would benefit from an optimized data representation.

But both can also be written optimizing for simplicity and clarity at the cost of performance.

Competing with the state of the art is not an implicit goal for every project.

Re: I Made a Chess Library in Java

#29
post #18

Earlier quoted context omitted.

Is performing chess validations that heavy, if you're serving ~10,000 games? (just asking for a friend)

To do all validations and move suggesions on the server side causes data traffic for no reason. Not just cpu time. It is senseless.

As a clarification, of course you will validate all moves on the server side and make sure client side state is consistent, but what I meant by validation is when you have to give every feedback from the server back to the client you will quickly find yourself in a ddos situation with so many players online.

Re: I Made a Chess Library in Java

#30
post #26
post #10

Earlier quoted context omitted.

If the API is well written, this is an implementation detail.

Well, it depends on the project goals. For a GUI app I can agree but good luck writing a chess engine where data representation is hidden behind an abstract interface.

Abstract as in using bit-boards or proper abstraction as in giving a clean interface to interact with a model and let the implementation worry about itself?
Post reply on HN