chess.js Announcement

Discussion of chess software programming and technical issues.

Moderator: Ras

jhlywa
Posts: 3
Joined: Sun Dec 03, 2006 10:45 pm
Location: Virginia, USA

chess.js Announcement

Post by jhlywa »

I've spent the last few months working on a Javascript library that implements many chess-related functions (e.g. 0x88 move generation, checkmate/draw detection, FEN loading/saving, perft, etc). It's quickly maturing so I thought I'd share it with the TalkChess community. It supports most modern browsers as well as node.js. The library, along with its documentation, has been released under the BSD license and can be found at: https://github.com/jhlywa/chess.js

Future work includes a jquery-based chessboard widget as well as a primitive search/evaluation function.

Enjoy.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: chess.js Announcement

Post by sje »

Thank you for sharing your code. I also use the BSD license for some of my code and I think it's superior to the GPL.

I took a brief look at your code and I have a few comments.

1) I notice that your rank ordering is the reverse of what most authors use. While this may be convenient for displaying a board diagram with Black at the top, it could lead to some difficulties as your code covers more functions.

2) For position repetition detection, you are correct in your comments that Zobrist hashes are what you need. Also, note that only half of the stored positions need to be examined (color matching), and only the N most recent positions where N is the value of the half move counter.

3) You may be interested in some of my FEN data at https://public.me.com/chessnotation directory FEN that could help you with testing your program's mate detection. At the same URL, the Perft directory has the file InitialPosition and its contents can help you with Perft verification.
gladius
Posts: 568
Joined: Tue Dec 12, 2006 10:10 am
Full name: Gary Linscott

Re: chess.js Announcement

Post by gladius »

Cool stuff! You might be interested in my javascript chess engine, https://github.com/glinscott/Garbochess-JS. It plays a pretty strong game of chess on newer browsers (IE9,FF4,Chrome,Safari).

Also, it has a really basic UI. Feel free to use the code!