Skip to content
ElectroweakCatPublic

About

Self-built chess engine and website in vanilla JavaScript. Negamax search with alpha-beta pruning, iterative deepening and quiescence search, plus a hand-written opening book. Playable in the browser at khianat.org.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

64 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Khianat

A chess engine written from scratch in plain JavaScript, playable in the browser.

Play it at khianat.org — pick your colour and go.

Khianat is Indonesian for betrayal. The logo is a pawn casting the shadow of a queen: it looks harmless, it is not.

The engine

Runs entirely in the browser, no server involved.

  • Opening book — a small hand-written repertoire with weighted random replies
  • Search — negamax with alpha-beta pruning, iterative deepening, move ordering, in a Web Worker
  • Quiescence search — capture sequences played out to avoid horizon blunders
  • Evaluation — material plus piece square tables, with a separate king table for the endgame

Five difficulty levels. Estimated 1600–1800 Elo at the highest — an estimate from the engine's features, not from rated games. Measured results live on the benchmark page, the runner in benchmark/.

How it works, with diagrams →

Built with

Vanilla JavaScript, HTML and CSS. No frameworks, no build step, no tracking. Chess rules by chess.js, board by chessboard.js, plus one small PHP script for the poll and statistics.

Run locally

git clone https://github.com/ElectroweakCat/Khianat.git
cd Khianat

Open index.html — the game works as-is. Only poll and statistics need PHP: php -S localhost:8000

License

MIT for my own code. Third-party components keep theirs: chess.js (BSD-2-Clause), chessboard.js (MIT), piece values adapted from Sunfish, sounds from Mixkit and freesound.org (user mh2o).

About

Self-built chess engine and website in vanilla JavaScript. Negamax search with alpha-beta pruning, iterative deepening and quiescence search, plus a hand-written opening book. Playable in the browser at khianat.org.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages