Skip to content

Commit 0dae9d7

Browse files
committed
Add send_opponent_information() documentation
1 parent fa152ad commit 0dae9d7

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

chess/engine.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,18 @@ class Info(enum.IntFlag):
449449
@dataclasses.dataclass
450450
class Opponent:
451451
"""Used to store information about an engine's opponent."""
452+
452453
name: Optional[str]
454+
"""The name of the opponent."""
455+
453456
title: Optional[str]
457+
"""The opponent's title--for example, GM, IM, or BOT."""
458+
454459
rating: Optional[int]
460+
"""The opponent's ELO rating."""
461+
455462
is_engine: Optional[bool]
463+
"""Whether the opponent is a chess engine/computer program."""
456464

457465

458466
class PovScore:
@@ -1158,7 +1166,7 @@ async def send_opponent_information(self, *, opponent: Optional[Opponent] = None
11581166
method should be called before the first move of a game--i.e., the
11591167
first call to :func:`chess.engine.Protocol.play()`.
11601168
1161-
:param opponent: Optional. The opponent's information.
1169+
:param opponent: Optional. An instance of :class:`chess.engine.Opponent` that has the opponent's information.
11621170
:param engine_rating: Optional. This engine's own rating. Only used by XBoard engines.
11631171
"""
11641172

docs/engine.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ Example: Let Stockfish play against itself, 100 milliseconds per move.
7070
.. autoclass:: chess.engine.PlayResult
7171
:members:
7272

73+
.. autoclass:: chess.engine.Protocol
74+
:members: send_opponent_information
75+
76+
.. autoclass:: chess.engine.Opponent
77+
:members:
78+
7379
Analysing and evaluating a position
7480
-----------------------------------
7581

0 commit comments

Comments
 (0)