This site uses third-party cookies, learn more or accept

I Made a Chess game in JavaScript

I made a chess game simulation using HTML, CSS, and JavaScript. It's pretty cool.
Written by Maxwell Pelic,

Chess is fun, as we all know, but the rules can get a little complicated. You can’t move into check, if you’re in check you have to move out of it, and don’t get me started on en passant. That said, I decided to make a chess game using JavaScript because I thought it would be fun.

How it works

When you select a piece, the computer calculates all the possible moves. It first determines how the piece moves, then it checks if any moves would cause check. If not, it marks it as a legal move. If so, it does not.

What’s next

I want to make a computer that can find good moves, though I realize that’ll be pretty complicated to implement. There are a huge number of possible moves in each position, and each of those moves introduces more moves. Thus, it would be very difficult to find the best move.

Previous Article: Generating Cryptographically Secure Random Numbers in Vanilla JavaScript