• Stars
    star
    139
  • Rank 262,010 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

♟️ A chess engine with alpha-beta pruning, piece-square tables, move ordering, and command-line UI.

Unit tests and puzzles

Andoma

My blog post: Building My Own Chess Engine


A chess engine which implements:

  • Alpha-beta pruning for move searching
  • Move ordering based off heuristics like captures and promotions
  • Tomasz Michniewski's Simplified Evaluation Function for board evaluation and piece-square tables
  • A slice of the Universal Chess Interface (UCI) to allow challenges via lichess.org
  • A command-line user interface

It uses Python 3.8 with Mypy type hints and unit + integration tests.

See Contributing to help out!


Install

pip install -r requirements.txt


Use it via command-line

Start the engine with:

python ui.py

Start as [w]hite or [b]lack:
w

  8 ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖
  7 ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
  6 · · · · · · · ·
  5 · · · · · · · ·
  4 · · · · · · · ·
  3 · · · · · · · ·
  2 ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟
  1 ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜
    a b c d e f g h

Enter a move like g1h3:

Use it as a UCI engine

The only interfaces that Andoma currently supports are ShailChoksi/lichess-bot and the command-line UI (ui.py). Debug information and configuration options are minimal compared to a full UCI engine.


Start the engine with:

python main.py

An example interaction with the engine (responses have #):

uci
# id name Andoma
# id author Andrew Healey & Roma Parramore
# uciok
position startpos moves e2e4
go
# bestmove g8f6

Also accepts a FEN string:

position fen rnbqk1nr/p1ppppbp/1p4p1/8/2P5/2Q5/PP1PPPPP/RNB1KBNR b KQkq - 0 1


See the UCI interface doc for more information on communicating with the engine.


Lichess.org

The UCI protocol slice that's implemented by this engine means you can play it via lichess.org by using ShailChoksi/lichess-bot (a bridge between Lichess API and chess engines) and a BOT account.

The engine file required by lichess-bot may be generated using pyinstaller.


Tests

There are unit tests for the engine, UI, and evaluation modules. Mate-in-two/mate-in-three puzzles are being added.

python -m unittest discover test/

Type hints:

pip install -r requirements-dev.txt

mypy .


Contributing

Raise an issue to propose a bug fix or feature (or pick up an existing one).

I (@healeycodes) am happy to help you along the way.

For coding style: look at the existing files, use Mypy types, use PEP8, and add a test for any change in functionality.

Please run the tests locally before submitting a PR.

More Repositories

1

if-sad-send-cat

🐱 A program that sends cats to my phone when I'm sad at the computer.
HTML
191
star
2

doom-checkboxes

🕹️ DOOM rendered via checkboxes in a web browser.
JavaScript
173
star
3

bandwidth-checker

⚡ Test and graph your internet bandwidth over time
Python
86
star
4

codeguessr

🤔 Like GeoGuessr but for code. An open source project quiz.
TypeScript
79
star
5

boids

🦢 The boids flocking simulation in Wasm using Ebiten!
Go
64
star
6

healeycodes.com

🏡 Personal blog/website running Next.js.
TypeScript
62
star
7

in-memory-cache-over-http

⛷️ In-memory key/value cache server over HTTP with no dependencies.
Go
47
star
8

crane-search

🐦 A full-text WebAssembly search engine for static websites. Build, index, and fly.
Go
42
star
9

Broken-Link-Crawler

🤖 Python bot that crawls your website looking for dead stuff
Python
42
star
10

conways-game-of-life

🎲 Conway's game of life
Go
39
star
11

deno-script-sandbox

🏜️ A sandbox that runs user-supplied JavaScript/TypeScript scripts.
TypeScript
34
star
12

jar

🫙 A server-side web framework that deploys to Vercel.
Python
32
star
13

adventlang

🎅 A programming language (+ code playground) for Advent of Code.
Go
30
star
14

websocket-benchmarker

Benchmark a WebSocket server's message throughput ⌛
Python
29
star
15

pi

🥧 Monorepo for my Raspberry Pi dashboard and GPS satellite listener.
Python
27
star
16

golfcart

⛳ A minimal programming language inspired by Ink, JavaScript, and Python.
Go
25
star
17

bitcask-lite

📚 A log-structured hash table database. Speedy K/V store for datasets larger than memory.
Go
24
star
18

untrusted-python

📦 Run untrusted python code on the server
TypeScript
23
star
19

tools

🛠️ Terminal tools, written from scratch.
Go
21
star
20

noter

📝 A text editor for macOS. Built using the Ebitengine game engine.
Go
21
star
21

niceware

🔒 Generate or convert random bytes into passphrases. A Rust port of niceware.
Rust
20
star
22

talking-between-python-and-js

Talking to Python from JavaScript (and Back Again!)
Python
20
star
23

twitter-ticker-tape

🖨️ A Raspberry Pi project to read tweets via receipt printer
Python
18
star
24

inkbyexample

✒ A hands-on introduction to Ink using annotated example programs.
CSS
18
star
25

among-us-friends

🎮 An ELO and player tracking system for the game Among Us
JavaScript
17
star
26

embroidery-vision

🧵 Identify which DMC threads are used in embroidery hoop images.
Python
16
star
27

calorie-king

Count your calories like a king! 👑 Full-stack Node.js/React app
JavaScript
15
star
28

self-forge

Self-host your GitHub repositories via a lightweight user interface.
Go
12
star
29

PairCode

👩‍💻 Real-time pair coding in a HTML/CSS/JS playground
JavaScript
12
star
30

roll-your-own-analytics

Complete website analytics (tracking script/client/server) via Node.js, Express, Babel, Webpack, Sequelize, chart.js.
JavaScript
11
star
31

secret-sudoku

🎲 Play Sudoku in your browser's URL bar!
JavaScript
10
star
32

dev-article-analysis

📊 A website that graphs textual statistics from a DEV user's articles
JavaScript
10
star
33

deno-isolate-web-request

🌎 Making web requests from inside an isolate
Rust
9
star
34

nodots-lang

𝐧𝐝 A small programming language with an interpreter, and a WebAssembly compiler.
Python
8
star
35

quill

A Rust port of the Ink programming language (thesephist/ink)
Rust
7
star
36

privacy-focused-analytics

🗃️ A toy analytics system for the web with a focus on user privacy.
Python
7
star
37

oak-lru-cache

🌳 An LRU cache written in Oak.
7
star
38

hoot-language

🦉 A general-purpose interpreted scripting language with an event loop.
Python
7
star
39

markov-chain-generator

🤖 Build and consume Markov chain models to generate random realistic text.
Python
7
star
40

tiny-note-taker

A tiny note taking app that teaches the power of the Storage API 🏪
JavaScript
7
star
41

embed-DEV-posts

Embed a list of your most recent DEV posts with this tiny library 💌
HTML
6
star
42

real-rainy-mood

☔ If it's not raining, you're not allowed in.
JavaScript
6
star
43

gatsby-serverless-comments

🔧 Use Netlify serverless functions to add commenting to a static website
JavaScript
6
star
44

file-share-cli

📁 Share files with friends from your terminal.
Go
5
star
45

sokoban

🧩 Sokoban game and automated puzzle solver
TypeScript
5
star
46

cursor-travel-tracker

🐭 How far has my cursor travelled?
Python
5
star
47

tld-quiz

🌐 How well do you know your top-level domains (TLDs)?
JavaScript
4
star
48

easy-high-scores

High scores API for apps/games/websites! 😄 Written in Python 🐍 with Flask, SQLAlchemy, and Bulma.
Python
4
star
49

Raspberry-Pi-Live-Cam

Build a live cam 📷 with your Raspberry Pi and Pi Camera! Powered by Flask ⚗️. Robust through laziness.
Python
4
star
50

order-tracking-microservice

Node/Express/Firebase microservice for sending users an auto-updating delivery tracking page! 🍔🍟🍺
JavaScript
4
star
51

coolrule

🧮 Boolean expression evaluation engine. A Rust port of boolrule.
Rust
3
star
52

lua-sokoban

📦 Sokoban clone written with LÖVE
Lua
3
star
53

captcha-api

🔒 An API for generating CAPTCHAs from scratch (Node.js)
JavaScript
3
star
54

EmojiStreamer

Real-time streaming of every emoji posted to Reddit.com 🔥
JavaScript
3
star
55

unity-smooth-camera-follow

An extendable C# camera script for a 3D smooth follow. Designed for single-unit top-down use.
C#
3
star
56

country-borders

🗺️ Calculating the path between two countries with the least border crossings.
Python
3
star
57

virtual-ants

Langton's ant with vanilla HTML, CSS, JavaScript
HTML
3
star
58

artisan-pixelation

Inspired by Kensuke Koike's real life pixelation art, this program which performs an approximation of his 'Avatar' piece.
Python
2
star
59

simple-images-to-pdf

A tiny Python program to create PDF files from multiple images.
Python
2
star
60

random-mdn-page

Random pages from the MDN JavaScript Docs, delivered fresh to your browser 🌎
JavaScript
2
star
61

tinyinfra

🏗 A simple key/value store (get/set) and queue (send/receive/delete).
Go
1
star
62

project-mood

Node.js API for generating GitHub badges depending on a repository's mood 🌸🔵☀️🌃
JavaScript
1
star
63

earn-a-build-passing-badge

The files for my tutorial on continuous intregration with Jest, Express, and Travis CI ✅
JavaScript
1
star
64

drep

🗃️ A fast grep clone written with Deno.
TypeScript
1
star
65

Reddit-Bot-Tutorial

Build a friendly bot to keep you company on Reddit! 🤖
Python
1
star
66

advent-of-code-2020

🎅 My solutions for Advent of Code 2020 in browser-land JavaScript
JavaScript
1
star
67

hidden-in-apostrophes

A tutorial on tricking Google: encoding messages in apostrophes
Python
1
star
68

compressing-cs2-demos

An example of compressing Counter-Strike 2 demo data.
Go
1
star