Those are the bots I created for the Botany18 PyCon tournament.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
athanase.py
athanase_no_traps.py
athanase_no_traps_priority.py
romuald.py
romuald_clever.py
romuald_no_last_check.py
romuald_no_last_check_more_traps.py
romuald_passive.py
romuald_passive_aggresive.py

README.md

Botany18 PyCon UK competition

Those are the bots I created for the Botany18 PyCon tournament organized by @inglesp

The comments have been added later for clarity. Results for the bots are available here

For more information of the tournament, see on the GitHub for Botany

For the names of the Bots, they come from French comic Le Génie des Alpages or in english :

  • Athanase: he is the shepherd, rather placid and always wear a beret. He has among others things an infinite collection of sweaters all more delirious than each other. (directly translated from Wikipedia in French).
  • Romuald: he is a black ram. He claims to be the leader of the flock, but this flock is not one to be lead. Romuald often fails at everything he undertakes, or even remains misunderstood (very approximate summary from Wikipedia)

Both Athanase and Romuald are 'Goldfish' or stateless bots, meaning everything is recalculated at each round.

To see Athanase or Romuald play, just follow the links below or install Botany.

Athanase and Athanase 'No Traps' have better output if you play using local verion of Botany, just set DEBUG (output should not appear in tournament version):

DEBUG=1 botany play athanase.py athanase_no_traps.py

Athanase serie

This is the logic that was successfull at the beginning of the tournament and relatively simple. Code was (will be) edited to add comments and select better variable names.

Athanase (athanase.py)

The page for Athanase is available on the Botany18 server and you can start playing against him or play against him letting him start.

Key idea was to select the play that would be part of the most "line of 4", irrelevant of the player that started complete the line of 4.

The results were ordered using the number move needed to complete the "line of 4", meaning a line with a "remaining 1" was a potentially winning "line of 4" and the number of "line of 4" with the same number of "remaining".

Top result will be selected and a position from then was selected.

It was a pure "Gold fish" strategy, not looking ahead, so could fall into obvious traps like allowing the opponent to access a "line of 4" that only need 1 to be completed: athanase will fall for this trap set up by human player 'X'.

athanase_no_traps.py

The page for Athanase "No traps" is available on the Botany18 server and you can start playing against him or play against him letting him start.

To avoid falling into 'traps', an additional search was needed, as we were not looking at "line_of_4" accesible during this turn, but at the "lines of 4" that our move could give access to.

The move that could fall into a trap would be taken out of the moves to select randomly from.

This filtering is done twice, once on the move that have been selected, but if no move is left after the filtering, you redo the filtering but this time out of all available moves.

Once again traps were selected irrelevant to the player ('X' or 'O'). This was to allow preventing your move giving the opportunity to bloc a winning "line_of_4": athanase_no_traps.py will not fall for this trap set up by human player 'X'.

athanase_no_traps_priority.py

The page for Athanase 'No traps Priority' is available on the Botany18 server and you can start playing against him or play against him letting him start.

It turns out all traps are not made equal, at the end of the game you might have to chose to fall into an enemy trap (and lose) or fall into your own trap (and let your opponent prevent you from losing.... for now).

If no move is left at the end of the process as defined previously, you select from any available move but this time only filtering out the "deadly traps", meaning this traps that would mean you lose the game...

Link to practical example to come....

Romuald

Romuald is an improved version of Athanase. Version that finished 2nd at the Botany tournament is here. You can start play against him or start playing against him letting him start.

Goal of Romuald was to set "consecutive" traps, meaning setting winning moves above each other and garanty victory.

Implementation being done in the final hours of the competition turned out to be trickier than planned... And relatively simple Athanase 'No Traps Priority' was still able to beat Romuald most of the time.

Final implementation tried to check for "consecutive" traps, and in those cases trigger them to get faster to victory, but apparently with little success.