Live data from Hacker News

I Made a Chess Library in Java

jaeheonshim.com

11–20 of 31 posts

Re: I Made a Chess Library in Java

#11
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.

Re: I Made a Chess Library in Java

#12
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 someone just wants a library to power a chess UI this isn't really necessary. Either way I'd suggest the author finish off the current implementation until they can get perft and other automated tests up and running first.

That said, chess programming is a _wonderful_ education in Computer Science, and you'll be following in the footsteps of so many great figures in the industry. Understanding bitboards and how to work with them can take you all the way from the bit-twiddling chapters of The Art of Computer Programming, right up to recent advances in CPU architecture and instruction sets. Learning how search works will teach you both very low techniques and high level heuristics in performance optimisation. And of course you can go all all the way up to recent advances in evaluation from deep learning.

Re: I Made a Chess Library in Java

#14
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

Yea and you probably also need OpenCL or CUDA and several GPUs to get anything really “performant”. The basic OO model is good for its own purposes

Re: I Made a Chess Library in Java

#16
When I was 17, I built a Java Chess AI for a school project called Chessmate. The AI couldn't castle or en passant, but it won a regional prize that got lost in the mail.

10 Years later, the code (which I had put on GitHub) made its way into a Minecraft mod called MineChess: http://petrustheron.com/posts/chessmate.html

Source code: https://github.com/theronic/chessmate

Re: I Made a Chess Library in Java

#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)

Re: I Made a Chess Library in Java

#19
post #2

Awesome, I would encourage turn this into a actual chess game using JavaFX.

That's a great idea, I'm going to look into creating an online chess game application soon!

Hey, yo! I was thinking doing the same. I was thinking in something with link sharing i.e. you create a game session and then get a link you can share with the second player and spectators.

Re: I Made a Chess Library in Java

#20
I loved building my chess library and would encourage other developers to try it. It is large and complex enough to test your abilities. Building it in a idiomatic, testable, and performant way really encourages software engineering skills instead of just coding. I felt like I didn’t really write solid go code until I finished my chess library.

https://github.com/notnil/chess

Post reply on HN