Fathom HTTP
HTTP version of Fathom — Syzygy tablebase probe tool. Server handles following requests:
- POST /wdl
- POST /root
- POST /root-dtz
- POST /root-wdl
Build
You need to generate or download pregenerated Syzygy tablebase files. If you’re about to download them, then go to the tablebases directory and follow these instructions.
Go
Just build it: go mod download && go build
Docker
Build an image:
docker build -t fathom .
Run a container:
docker run \
-p 8080:80 `# expose port` \
-v "$(pwd)/tablebases:/app/tablebases" `# mount tablebase directory` \
-it fathom
Example Requests
Probe WDL
curl -X POST 'http://localhost:8080/wdl' \
--data-binary '{ "position": "4k3/7q/8/8/8/8/B61/4K3 b - - 0 1" }'
Response:
{"res":"Win"}
Probe root
curl -X POST 'http://localhost:8080/root' \
--data-binary '{ "position": "4k3/7q/8/8/8/8/B61/4K3 b - - 0 1" }'
Response (pretty and shortened):
{
"res": {
"move": "h7h1",
"details": [
{
"move": "e8d7",
"wdl": "Win",
"dtz": 15
},
{
"move": "e8e7",
"wdl": "Win",
"dtz": 15
},
...
{
"move": "h7g8",
"wdl": "Draw",
"dtz": 0
},
{
"move": "h7h8",
"wdl": "Win",
"dtz": 5
}
]
}
}
Probe root DTZ
curl -X POST 'http://localhost:8080/root-dtz' \
--data-binary '{ "position": "4k3/7q/8/8/8/8/B61/4K3 b - - 0 1", "useRule50": true }'
Response (pretty and shortened):
{
"res": [
{
"move": "e8d7",
"pv": [],
"score": 31744,
"rank": 1000
},
{
"move": "e8e7",
"pv": [],
"score": 31744,
"rank": 1000
},
...
{
"move": "h7h8",
"pv": [],
"score": 31744,
"rank": 1000
}
]
}
Probe root WDL
This is a fallback for the case that some or all DTZ tables are missing.
curl -X POST 'http://localhost:8080/root-wdl' \
--data-binary '{ "position": "4k3/7q/8/8/8/8/B61/4K3 b - - 0 1", "useRule50": true }'
Response (pretty and shortened):
{
"res": [
{
"move": "e8d7",
"pv": [],
"score": 31744,
"rank": 1000
},
{
"move": "e8e7",
"pv": [],
"score": 31744,
"rank": 1000
},
...
{
"move": "h7h8",
"pv": [],
"score": 31744,
"rank": 1000
}
]
}
CLI Arguments
Parameter | Type | Default | Description |
---|---|---|---|
--allowOrigin |
string | "*" |
Value for HTTP header Access-Control-Allow-Origin |
--listen |
string | "127.0.0.1:80" |
HTTP listen [host]:port |
--maxTime |
duration | "0s" (infinite) |
Max time limit |
--poolSize |
int | numcpu | Pool size of concurrent Fathom instances |
--tbDir |
string | "./tablebases" |
Path to the directory containing Tablebase files |