Chess Variant
Development
A custom chess variant built from scratch with vanilla HTML, CSS, and JavaScript, including custom rule logic.
I wanted to build something that pushed me past typical web dev work, a project with real logic complexity instead of just layout and styling. Standard chess didn't feel like enough of a challenge on its own, so I set out to build a variant with rules that don't exist in any chess engine or library, meaning I couldn't lean on existing chess logic and had to write all the rules myself from scratch.
The board state is represented as a 2D array, with each cell holding either null (empty) or a piece object. That's the source of truth for the entire game, everything else, rendering, validation, movement, reads from and writes to that array.
The part that makes this variant different is that both the pieces and the board itself can move, and pieces can jump over gaps in the board. The jump logic works by looping in the direction the piece is already allowed to move in (so a rook still moves along ranks and files, a bishop still moves diagonally, etc.), and checking each square along that path for whether it's active, meaning it exists and isn't an empty gap. If the loop hits an active square beyond a gap, the piece is allowed to jump directly to it, skipping over the empty space in between. That let me reuse each piece's normal movement direction logic rather than writing a whole separate rule set for jumping.
The board itself is rendered with the DOM, a grid of divs rather than canvas, which made it straightforward to bind click and drag handlers directly to each square and piece without maintaining a separate coordinate to pixel mapping.
Every move runs through validation at the point of piece drop. When a piece is released on a square, the game checks the move against that piece's legal move set (including the gap jump logic) before committing the change to the array and re rendering the board. Illegal drops get rejected and the piece snaps back.
Right now it's built for a single player or two people sharing one screen, since there's no networking layer yet. The plan going forward is to add WebSockets so two people can play against each other remotely in real time.
A fully playable, working variant with custom rule logic built entirely from the ground up, no chess library, no shortcuts. The 2D array plus direction based jump checking turned out to be a clean way to handle a rule that doesn't exist anywhere else, and it's a solid proof of concept for the harder engineering problem still ahead: adding real time multiplayer with WebSockets.