games.common.voting_system¶
Generalized AI Voting System for Game Winner Determination.
This module provides a reusable voting system that can evaluate game performance across different game types using AI judges with specialized perspectives.
Classes¶
AI judge that can evaluate any game type. |
|
Evaluator for chess games. |
|
Evaluator for debate games. |
|
Protocol for game-specific evaluation logic. |
|
Generalized voting system for any game type. |
|
Different AI judge personalities for game evaluation. |
|
A judge's vote choice with reasoning. |
|
Complete voting results from multiple judges. |
Functions¶
|
Create appropriate voting system for game type. |
Module Contents¶
- class games.common.voting_system.AIGameJudge(name, personality=JudgePersonality.BALANCED, expertise_area=None, focus_weight=0.5)¶
AI judge that can evaluate any game type.
- Parameters:
name (str)
personality (JudgePersonality)
expertise_area (str | None)
focus_weight (float)
- class games.common.voting_system.ChessEvaluator¶
Evaluator for chess games.
- class games.common.voting_system.DebateEvaluator¶
Evaluator for debate games.
- class games.common.voting_system.GameEvaluator¶
Bases:
Protocol
Protocol for game-specific evaluation logic.
- format_game_data(game_data)¶
Format game data for judge evaluation.
- Parameters:
game_data (Any)
- Return type:
- class games.common.voting_system.GameVotingSystem(judges)¶
Generalized voting system for any game type.
- Parameters:
judges (list[AIGameJudge])
- classmethod create_game_specific_judges(game_type, num_judges=3)¶
Create judges specialized for a specific game type.
- Parameters:
- Return type:
- classmethod create_standard_judges(num_judges=3)¶
Create standard judge panel with configurable size and randomized. personalities.
- Parameters:
num_judges (int) – Number of judges to create (default: 3 to avoid ties) Odd numbers recommended to prevent tie votes.
- Return type:
- async vote(topic, options, game_data, criteria, evaluator=None)¶
Conduct voting with all judges.
- Parameters:
- Return type:
- class games.common.voting_system.JudgePersonality¶
-
Different AI judge personalities for game evaluation.
Initialize self. See help(type(self)) for accurate signature.
- class games.common.voting_system.VoteChoice(/, **data)¶
Bases:
pydantic.BaseModel
A judge’s vote choice with reasoning.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class games.common.voting_system.VotingResult(/, **data)¶
Bases:
pydantic.BaseModel
Complete voting results from multiple judges.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- games.common.voting_system.create_voting_system(game_type='general', num_judges=3)¶
Create appropriate voting system for game type.
- Parameters:
- Return type: