Betafish
A chess engine and AI move finder written in Javascript. Beats Stockfish level 6 on Lichess.
Install / Use
/learn @Strryke/BetafishREADME
Betafish
<img src="cover.png" alt="Betafish" width="300"/>Betafish - An amalgamation of AlphaZero and Stockfish.
Play it here.
Read more about it on my blog.
Introduction
Betafish is a chess engine and AI move finder written in Javascript, based on the Negamax algorithm. It beats Stockfish Level 6 on Lichess, and I estimate its around 1800-2000 Elo, depending on the thinking time afforded.
Features
- Negamax algorithm with alpha-beta pruning
- Move ordering using the MVV-LVA heuristic
- Principal variation search
- Quiescence search
- Iterative deepening
- Piece-square tables
- Tapered evaluation
This enables Betafish to search to a depth of 7-8 plies and around ~1mil possible nodes, given a thinking time of around 1-2 seconds.
Possible Improvements
- Transposition tables
- Zobrist hashing
- Opening tables
Of course, re-writing this in a compiled language like C++ would be a huge improvement. I wrote it in Javacript as I wanted to deploy it as a web app, as what fun would a game be without letting your friends challenge it? However, I quickly realised the limitations, as JS is definitely not suited for these computing-intensive tasks.
Changelogs
- 1.1 - Changed evaluation function from Simplified Eval to PeSTO's Eval Function. Major improvements ~ 200 elo.
Credits
- Chess Engines: A Zero to One - The article that jumpstarted my journey into chess programming.
- WukongJS - A JS chess engine, written by Maksim Korzh, who was patient enough to answer my questions, give me pointers and point me in the right direction in this journey.
- Bluefever Software's YouTube series - A 63-part series on chess programming, which was an absolute gold mine and served as inspiration for the bulk of the chess engine.
- Chess Programming Wiki - A great resource for chess programming.
- CM Chessboard - The library I used for the GUI.
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
