Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ To be released
of a given user.
* Added ``bots.handle_draw_offer`` and ``bots.handle_takeback_offer`` to handle draw and takeback offers
* Added ``client.external_engine.analyse``, ``client.external_engine.acquire_request``, ``client.external_engine.answer_request`` to handle analysis with an external engine
* Added ``bots.claim_draw`` and ``bots.claim_victory`` to claim a draw or a victory in a bot game
* Added ``client.board.claim_draw`` to claim a draw in a game (after the opponent left the game)


Thanks to all the contributors who helped to this release:
Expand All @@ -29,6 +31,7 @@ Thanks to all the contributors who helped to this release:
- @gameroman
- @JAMoreno-Larios
- @friedrichtenhagen
- @jquiaios


v0.14.0 (2025-08-26)
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Most of the API is available:
client.board.offer_takeback
client.board.accept_takeback
client.board.decline_takeback
client.board.claim_draw
client.board.claim_victory
client.board.go_berserk

Expand All @@ -100,6 +101,8 @@ Most of the API is available:
client.bots.post_message
client.bots.abort_game
client.bots.resign_game
client.bots.claim_draw
client.bots.claim_victory
client.bots.handle_draw_offer
client.bots.handle_takeback_offer
client.bots.accept_challenge
Expand Down
12 changes: 12 additions & 0 deletions berserk/clients/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ def resign_game(self, game_id: str) -> None:
path = f"/api/board/game/{game_id}/resign"
self._r.post(path)

def claim_draw(self, game_id: str) -> None:
"""Claim a draw when the opponent has left the game for a while.

Generally, this should only be called once the `opponentGone` event
is received in the board game state stream and the `claimWinInSeconds`
time has elapsed.

:param str game_id: ID of an in-progress game
"""
path = f"/api/board/game/{game_id}/claim-draw"
self._r.post(path)

def handle_draw_offer(self, game_id: str, accept: bool) -> None:
"""Create, accept, or decline a draw offer.

Expand Down
16 changes: 16 additions & 0 deletions berserk/clients/bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ def resign_game(self, game_id: str) -> None:
path = f"/api/bot/game/{game_id}/resign"
self._r.post(path)

def claim_draw(self, game_id: str) -> None:
"""Claim a draw in a bot game.

:param game_id: ID of a game
"""
path = f"/api/bot/game/{game_id}/claim-draw"
self._r.post(path)

def claim_victory(self, game_id: str) -> None:
"""Claim victory in a bot game.

:param game_id: ID of a game
"""
path = f"/api/bot/game/{game_id}/claim-victory"
self._r.post(path)

def handle_draw_offer(self, game_id: str, accept: bool) -> None:
"""Create/accept/decline draw offers

Expand Down