Detrak is a fun roll and write game. Every turn you throw a pair of dice to generate two symbols at random. The goal is the score points by placing symbols on a grid. The more adjacent symbols there are, the more points you score.
The question I'm looking to answer here is:
What is the highest possible score if the sequence of symbols is known in advance?
I haven't found a smart answer yet. The brute-force way I see is to list all the possible grid layouts, and then evaluate each layout:
precompute_scores.py
generates a.json
file mapping each possible row/column/diagonal symbol combination to a scoreenumerate_layouts.py
generates a.txt
file with all the possible grid layouts thanks to backtrackingevaluate_sequence.py
calculates the best possible score for a given sequence of symbols
Each script has an N
parameter which can be changed. I haven't managed to run enumerate_layouts.py
with N=5
because it's simply taking too long.