AI¶
-
class
games.spiders.ai.
AI
(game)¶ Bases:
joueur.base_ai.BaseAI
The AI you add and improve code inside to play Spiders.
-
end
(won: bool, reason: str) → None¶ This is called when the game ends, you can clean up your data and dump files here if need be.
- Parameters
won (bool) – True means you won, False means you lost.
reason (str) – The human readable string explaining why your AI won or lost.
-
property
game
¶ The reference to the Game instance this AI is playing.
-
game_updated
() → None¶ This is called every time the game’s state updates, so if you are tracking anything you can update it here.
-
get_name
() → str¶ This is the name you send to the server so your AI will control the player named this string.
- Returns
The name of your Player.
- Return type
str
-
get_setting
(key: str) → str¶ Gets an AI setting passed to the program via the –aiSettings flag. If the flag was set it will be returned as a string value, None otherwise.
- Parameters
key (str) – The key of the setting you wish to get the value for
- Returns
A string representing the value set via command line, or None if the key was not set
- Return type
str
-
property
player
¶ The reference to the Player this AI controls in the Game.
-
run_turn
() → bool¶ This is called every time it is this AI.player’s turn.
- Returns
Represents if you want to end your turn. True means end your turn, False means to keep your turn going and re-call this function.
- Return type
bool
-
start
() → None¶ This is called once the game starts and your AI knows its player and game. You can initialize your AI here.
-