This is my repo in which I work on reinforcement learning algorithms to play the board game Photosynthesis. The aim is to produce the first AI to achieve superhuman performance in the game.
Results
This section is a work in progress, and will be updated periodically as I improve the model.
Here is a gif of four agents playing the game:
Here is a reward curve during training:
Rules of the game
Due to copyright restrictions I won’t be sharing photographs of the board or the rule book. However, I will describe them in brief below.
Photosynthesis is a four-player game played on a hexagonal grid of spaces. The aim is to get the highest score by the end of the game. Your score accumulates when a tree is harvested.
A game is separated into days and hours.
In a given hour, a token representing the sun is placed on one of the six corners of the board. All trees that can see the sun (and are not in the shadow of other trees), will get light points for their owner.
A small/medium/large tree casts a shadow that is 1/2/3 spaces long.
On a player’s turn they have various things that they can do, each costing a different number of light points:
- Purchase and plant a seed (in the shadow of an existing tree) [1 LP].
 - Buy a seed/small/medium/large tree to move it from the “stash” to the “ready” zones [variable LP].
 - Grow a seed/small/medium tree from the to a small/medium/large tree [1/2/3 LP], as long as the new trees are in the “ready” section of the player’s items.
 - Harvest a large tree [4 LP].
 - End turn.
 
A player may make as many actions as they want during their turn, but may not use the same cell more than once on a turn.
When a tree is harvested, the player gets a number of points that depends on how many other trees have already been harvested.