dc3client package¶
Submodules¶
dc3client.dc3client module¶
- class dc3client.dc3client.BaseClient(timeout: int = 10, buffer: int = 1024, log_level: int = 20)[source]¶
Bases:
object
- class dc3client.dc3client.SocketClient(host: str = 'dc3-server', port: int = 10000, client_name: str = 'AI0', auto_start: bool = True, rate_limit: float = 0.2)[source]¶
Bases:
BaseClient- convert_is_ready(is_ready: IsReady) dict[str, Any][source]¶
convert IsReady to dict
- Parameters:
is_ready (IsReady) – is_ready
- Returns:
converted is_ready
- Return type:
dict
- convert_trajectory(trajectory_data: Trajectory) dict[str, Any][source]¶
convert trajectory to dict
- Parameters:
trajectory_data (Trajectory) – trajectory
- Returns:
dict of trajectory
- Return type:
dict[str, Any]
- convert_update(update_data: Update, remove_trajectory: bool = True) dict[str, Any][source]¶
convert Update to dict
- Parameters:
update_data (Update) – Update
remove_trajectory (bool) – Delete trajectory data from Update? Defaults to True.
- Returns:
converted Update
- Return type:
dict
- get_update_and_trajectory(remove_trajectory: bool = True) tuple[list[Update], list[Trajectory]][source]¶
get update and trajectory
- Parameters:
remove_trajectory (bool, optional) – Delete trajectory data from Update?. Defaults to True.
- Returns:
update list and trajectory list
- Return type:
tuple[list[Update], list[Trajectory]]
- move(x: float = 0.0, y: float = 2.4, rotation: StoneRotation = StoneRotation.counterclockwise) None[source]¶
Shot Stone
- Parameters:
x (float, optional) – Velocity in x-axis direction. Defaults to 0.0.
y (float, optional) – Velocity in y-axis direction. Defaults to 2.4. rotation (StoneRotation, optional): Rotation of stone. Defaults to StoneRotation.outturn.
dc3client.models module¶
- class dc3client.models.ActualMove(rotation: str | None, type: str | None, velocity: Velocity)[source]¶
Bases:
objectActual Move
- rotation: str | None¶
- type: str | None¶
- class dc3client.models.Coordinate(angle: float | None, position: list[Position])[source]¶
Bases:
objectPosition and Angle
- angle: float | None¶
- class dc3client.models.ExtraEndScore(team0: int, team1: int)[source]¶
Bases:
objectExtraEnd Score
- team0: int¶
- team1: int¶
- class dc3client.models.ExtraEndThinkingTime(team0: float, team1: float)[source]¶
Bases:
objectThinking time per end of ExtraEnd
- team0: float¶
- team1: float¶
- class dc3client.models.Finish(team0: list[Coordinate], team1: list[Coordinate])[source]¶
Bases:
objectStone placement at end of shot
- team0: list[Coordinate]¶
- team1: list[Coordinate]¶
- class dc3client.models.Frame(team: str | None, index: int | None, value: Coordinate | None)[source]¶
Bases:
objectThe position and angle of the stones at each time interval, denoted by seconds_per_frame. Each frame is represented as the difference from the previous frame (the first frame is start).
- index: int | None¶
- team: str | None¶
- value: Coordinate | None¶
- class dc3client.models.GameResult(winner: str | None, reason: str | None)[source]¶
Bases:
objectGame Result
- reason: str | None¶
- winner: str | None¶
- class dc3client.models.GameRule(players: Players, rule: str, setting: Setting, simulator: Simulator)[source]¶
Bases:
objectGame Rule
- rule: str¶
- class dc3client.models.IsReady(cmd: str, team: str, game: GameRule)[source]¶
Bases:
objectMatch settings
- cmd: str¶
- team: str¶
- class dc3client.models.LastMove(actual_move: ActualMove | Concede, free_guard_zone_foul: bool, trajectory: Trajectory | None)[source]¶
Bases:
objectResults of previous shot
- actual_move: ActualMove | Concede¶
- free_guard_zone_foul: bool¶
- trajectory: Trajectory | None¶
- class dc3client.models.MatchData(server_dc: ~dc3client.models.ServerDC | None = None, is_ready: ~dc3client.models.IsReady | None = None, new_game: ~dc3client.models.NewGame | None = None, update_list: list[~dc3client.models.Update] = <factory>)[source]¶
Bases:
objectMatch Data
- class dc3client.models.NewGame(cmd: str, name: dict)[source]¶
Bases:
objectSignal for the start of the match
- cmd: str¶
- name: dict¶
- class dc3client.models.PlayerInfo(max_speed: float, seed: None, stddev_angle: float, stddev_speed: float, randomness: str)[source]¶
Bases:
objectMaximum velocity of the stone and standard deviation of normally distributed random numbers applied to the initial velocity and initial angle
- max_speed: float¶
- randomness: str¶
- seed: None¶
- stddev_angle: float¶
- stddev_speed: float¶
- class dc3client.models.Players(team0: list[PlayerInfo], team1: list[PlayerInfo])[source]¶
Bases:
objectPool of players per team
- team0: list[PlayerInfo]¶
- team1: list[PlayerInfo]¶
- class dc3client.models.Position(x: float | None, y: float | None)[source]¶
Bases:
objectStone Position
- x: float | None¶
- y: float | None¶
- class dc3client.models.Scores(team0: list, team1: list)[source]¶
Bases:
object- team0: list¶
- team1: list¶
- class dc3client.models.ServerDC(date_time: str, game_id: str, cmd: str, version: Version)[source]¶
Bases:
objectServer Info
- cmd: str¶
- date_time: str¶
- game_id: str¶
- class dc3client.models.Setting(extra_end_thinking_time: ExtraEndThinkingTime, five_rock_rule: bool, max_end: int, sheet_width: float, thinking_time: ThinkingTime)[source]¶
Bases:
objectMatch Setting
- extra_end_thinking_time: ExtraEndThinkingTime¶
- five_rock_rule: bool¶
- max_end: int¶
- sheet_width: float¶
- thinking_time: ThinkingTime¶
- class dc3client.models.ShotInfo(velocity_x: float, velocity_y: float, rotation: StoneRotation)[source]¶
Bases:
objectShot Info
- rotation: StoneRotation¶
- velocity_x: float¶
- velocity_y: float¶
- class dc3client.models.Simulator(seconds_per_frame: float, simulator_type: str)[source]¶
Bases:
objectSimulator Settings
- seconds_per_frame: float¶
- simulator_type: str¶
- class dc3client.models.Start(team0: list[Coordinate], team1: list[Coordinate])[source]¶
Bases:
objectStone placement at the start of the shot
- team0: list[Coordinate]¶
- team1: list[Coordinate]¶
- class dc3client.models.State(end: int, extra_end_score: ExtraEndScore, game_result: GameResult, hammer: str, scores: Scores, shot: int, stones: Stones, thinking_time_remaining: ThinkingTimeRemaining)[source]¶
Bases:
objectMatch State
- end: int¶
- extra_end_score: ExtraEndScore¶
- game_result: GameResult¶
- hammer: str¶
- shot: int¶
- thinking_time_remaining: ThinkingTimeRemaining¶
- class dc3client.models.StoneRotation(value)[source]¶
Bases:
str,EnumStone Rotation Direction
- clockwise = 'cw'¶
- counterclockwise = 'ccw'¶
- inturn = 'cw'¶
- outturn = 'ccw'¶
- class dc3client.models.Stones(team0: list[Coordinate], team1: list[Coordinate])[source]¶
Bases:
objectStone Positions of each team
- team0: list[Coordinate]¶
- team1: list[Coordinate]¶
- class dc3client.models.ThinkingTime(team0: float, team1: float)[source]¶
Bases:
objectThinking time not including ExtraEnd
- team0: float¶
- team1: float¶
- class dc3client.models.ThinkingTimeRemaining(team0: float, team1: float)[source]¶
Bases:
objectThinking time remaining
- team0: float¶
- team1: float¶
- class dc3client.models.Trajectory(seconds_per_frame: float | None, start: Start, finish: Finish, frames: list[FrameArray] | None)[source]¶
Bases:
objectTrajectory of each stone
- frames: list[FrameArray] | None¶
- seconds_per_frame: float | None¶
- class dc3client.models.Update(cmd: str, next_team: str, state: State, last_move: LastMove | None)[source]¶
Bases:
objectMatch information on each shot
- cmd: str¶
- next_team: str¶