Search
You are a Thief in a grid-based cave. Your goal is to escape with as much gold as possible. There is a Guard who wants to stop You.
The game is played on a grid-based map as follows:
up
down
left
right
S
G
E
D
During an Encounter, the Guard has two options:
If the Thief loses a fight, the game ends immediately; otherwise the Thief is free to continue with all the collected gold. The probability that the Guard wins a fight starts at 50 % and increases with each Encounter according to the formula \( 1 - \frac{0.5}{n} \) where \( n \) is the number of Encounters. The Thief knows when a fight happens, but is unaware of the Guard's sneaky hiding place changes.
The score starts at zero. The Thief gets two points for a successful escape, and one additional point for each gold stolen. No points will be awarded in case the Thief loses a fight or gets stuck on a square with no legal moves; that means:
This game is much more complex than the previous and developing best-response oracles is not so easy. Instead, Your task is to accurately describe the rules of the game as a two-player zero-sum extensive form game, such that it can be solved by a generic algorithm You will implement in the next homework assignment.
Your program must accept the cave definition from standard input, and must write the resulting game tree to standard output, i.e. the expected usage is
python main.py < cave.txt > game.json
You must not open, read or write to any files, and your standard output must contain only the game representation without any debugging information.
You can use our template and example caves (and their values ) to simplify your implementation.
The template uses our EFG library, pygambit and pydot to simplify the creation, and visualization of your extensive form games. You can download it directly from Github
pip install git+https://github.com/votroto/cgt_bandits.git[dot,gambit]
Use pygambit to compute equilibria and values of your games, but do not expect it to work for larger games. Implementing a better algorithm will be the subject of a subsequent homework assignment.
pygambit
Maps have the following format:
###### #SE-D# #-##G# #--E-# ######
(- empty square, S start, D destination, E possible hiding place, G gold, # wall)
-
#