Skip to content
All projectsPersonal project

Terminal Chess

A terminal-based chess game in Go — full rules, move validation, zero dependencies.

Role

Creator — personal project

Stack

Go

Language

Go

Repository

Link pending

Problem

Chess rules are deceptively deep: castling, en passant, promotion, pins, and check detection interact in ways that make naive implementations subtly wrong.

Solution

A chess game playable in the terminal, implementing the complete rules of the game with move validation in pure Go (Feb–Mar 2023).

My contribution

Implemented full game rules and move validation — including special moves and check/checkmate detection — rendered as an interactive terminal UI.

Architecture

Board state as an immutable-per-turn model; every candidate move is validated by simulating it and checking the mover's king safety, which handles pins and discovered checks without special-casing.

Overview

Terminal Chess is a personal exercise in encoding a rules-heavy domain: the complete FIDE ruleset — castling, en passant, promotion, stalemate — implemented and validated in a terminal UI.

Technical Decisions

Every move is validated by simulating the resulting position and testing king safety. This eliminates an entire class of pin/discovered-check bugs that pattern-matching validators accumulate.

Results

Full-rule chess with zero dependencies — correctness proven by the simulation approach rather than special cases.

The hard part

Move validation correctness: a legal-looking move may expose the king. Validation has to reason about the resulting position, not just the move pattern.

A decision worth noting

Simulate-then-verify over pattern rules: generate the candidate move, apply it to a copy of the board, and reject if the king is attacked. Slower per move by microseconds, correct by construction.

Outcome

A complete, rule-correct chess implementation in ~800 lines of Go — a favorite exercise in state modeling and rule encoding.

Next project

Godash