players.HAL1Player module

class HAL1Player(game, board)[source]

Bases: core.Player.Player

Subclass of Player, first try of learning player.

Variables:
  • memories (Memory) – Advanced dictionary that registers the past games.
  • saveGame (bool) – Indicates if the game must be saved or not (True by default, set to False if the game is known).
  • nbOfIntelligentGame (int) – The number of game where the memory have been used.
  • evolutionOfMemories (list of int) – The lengths of the memory, one entry added at the end hof each game.
endOfGame()[source]

Record the game if it is not an already know game

This function is called when a game is over, it relies on self.saveGame to know if the game must be learn or not. If it is the case, memories.addGame(game) is called. Reset self.saveGame to True at the end. Manages self.evolutionOfMemories

openTraining(trainingFileName)[source]

Imports a trained memories dictionary

play()[source]

Play a first random movement and then tries to play intelligently

Intelligently means it recognises learned the boardStates that leads to direct victory (in one movement) and plays the winning movement — not so intelligent but self learning !

saveTraining(trainingFileName)[source]

Saves a trained memories dictionary