fathom-http

command module
v0.0.0-...-bf777a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Fathom HTTP

HTTP version of Fathom — Syzygy tablebase probe tool. Server handles following requests:

  1. POST /wdl
  2. POST /root
  3. POST /root-dtz
  4. 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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址