An open API service indexing awesome lists of open source software.

https://github.com/maxhalford/detrak

Calculate the optimal score at Detrak
https://github.com/maxhalford/detrak

Last synced: 6 months ago
JSON representation

Calculate the optimal score at Detrak

Awesome Lists containing this project

README

          

# Detrak optimal score

[Detrak](https://www.philibertnet.com/en/gigamic/73968-detrak-3421271117919.html) 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 score
- `enumerate_layouts.py` generates a `.txt` file with all the possible grid layouts thanks to [backtracking](https://www.wikiwand.com/en/Backtracking)
- `evaluate_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.