lichess_api/api/tablebase.rs
1//! Look up Syzygy endgame tablebase results for positions with few pieces
2//! remaining, one method per variant: standard chess
3//! ([`lookup_standard`](LichessApi::lookup_standard)), antichess
4//! ([`lookup_antichess`](LichessApi::lookup_antichess)), and atomic chess
5//! ([`lookup_atomic`](LichessApi::lookup_atomic)). Each returns the win/loss/draw
6//! category and, where known, distance-to-zero and distance-to-mate for the
7//! position and for every legal move. These endpoints are public and need no
8//! token, and are served from a separate host,
9//! [`Domain::Tablebase`](crate::model::Domain::Tablebase).
10
11use crate::client::LichessApi;
12use crate::error::Result;
13use crate::model::tablebase::*;
14
15impl LichessApi<reqwest::Client> {
16 pub async fn lookup_antichess(
17 &self,
18 request: impl Into<antichess::GetRequest>,
19 ) -> Result<TablebaseJson> {
20 self.get_single_model(request.into()).await
21 }
22
23 pub async fn lookup_atomic(
24 &self,
25 request: impl Into<atomic::GetRequest>,
26 ) -> Result<TablebaseJson> {
27 self.get_single_model(request.into()).await
28 }
29
30 pub async fn lookup_standard(
31 &self,
32 request: impl Into<standard::GetRequest>,
33 ) -> Result<TablebaseJson> {
34 self.get_single_model(request.into()).await
35 }
36}