Evalmap
The evalmap is a gzipped JSON file containing selected position evaluations that were precomputed. The code loads the map on startup and also uses it as a memoization cache during search.
Default location
- EVALMAP points to the packaged file dodgem_eval.json.gz inside the installed package directory.
- You can override with –evalmap-path or via
~/.dodgem
.
JSON structure
- Top-level keys: “3”, “4”, “5” for board sizes.
- Each value is a dictionary where:
- Key: A canonical JSON string of the position state “[[a…],[b…],turn]” with lists sorted and no spaces.
- Value: An array [evaluation, depth], where:
- evaluation:
- ≥ +100: the current side to move has a forced win (from that node perspective).
- ≤ -100: the current side to move has a forced loss.
- Otherwise: a tentative evaluation score when no forced win/loss is determined.
- depth: the depth of evaluation
- evaluation:
Selection when generating
- The create_evalmap() method queries MongoDB collections eval_3, eval_4 and eval_5 using filters:
- min search depth, min remain, and a near-frontier constraint depth - remain ≥ threshold
- EVAL3, EVAL4 and EVAL5 constants define these thresholds
Generate from MongoDB
1) Ensure MongoDB is populated for the board sizes you want:
dodgem -n 3 -c
dodgem -n 4 -c
2) Export (for all board sizes):
dodgem -e
3) The output path is controlled by --evalmap-path
or config.
Refreshing in search
- If the two players have different levels, refresh_evalmap is set to True. In that case, the engine reloads the evalmap before each move to incorporate the fresh data.
Used by the online Dodgem
- The evalmap generated by this package is used by the online Dodgem page: https://sekika.github.io/dodgem/.
- The online version does not connect to MongoDB and relies solely on the evalmap, so it supports CPU levels up to 3. For MongoDB-backed level 4 play, use the local CLI/GUI.
- The strength of each level is verified with a round-robin league.