This projects contains several agents to play abalone on the seahorse platform.
Algorithms implemented:
- Minimax
- AB pruning
- AB pruning with nodes sorted by heuristic
- AB pruning with Transposition Table
Heuristics available:
- Distance to center of the board
- Ejected pieces with distance as a tie-breaker
- Maximise push and ejections available
Run once:
python main_abalone.py -g -c simplified -t local my_player_ab_distance.py random_player_abalone.py
More info on options with python main_abalone.py -h
.
Run on every file change with watchexec:
watchexec -e py -- python main_abalone.py -g -c simplified -t local my_player_ab_distance.py random_player_abalone.py
In addition to classical
and alien
starting position,
there is an additionnal simplified
config where each player has 3 pieces available.
To limit the number of turns, change MAX_STEP
value in constants
module.
To limit the goal score, change MAX_SCORE
value in constants
module.
Beside victory, an agent logs the following info :
- Time remaining at the end of the game
- Nodes where score was computed (as terminal node or from children)
- (for agents with a Transposition Table) the number of successful lookups
- Subclass
MyPlayer
fromab
module. - Define the heuristic as a scalar function of a
GameState
in one of the following places:- as the
self.heuristic
attribute in the__init__
method - if your heuristic depends on element unkown at time of
__init__
, override theget_heuristic
method to create the heuristic using the firstGameState
- as the