Add random scenario and refactor case handling

Consolidate scenario creation by replacing separate normal/edge/clear handlers with createCase({withWalls, scenario}). Add a new 'random' scenario that picks random start/end positions and places random walls (controlled by MAX_RANDOM_WALLS_FACTORS). Change pathLength to a string and display "∞" for empty paths. Update applyGridSize logic to avoid unnecessary resets when dimensions unchanged and to initialize with the new API. Add random helper and MAX_RANDOM_WALLS_FACTORS constant, update template buttons to call createCase, and add i18n entries for the random case and updated clear-board label.
This commit is contained in:
2026-02-05 09:24:44 +01:00
parent f385a154d5
commit 52f0e371ee
5 changed files with 95 additions and 35 deletions

View File

@@ -303,7 +303,8 @@
"ASTAR": "Start A*",
"NORMAL_CASE": "Testaufbau",
"EDGE_CASE": "A* Grenzfall-Aufbau",
"CLEAR_BOARD": "Board leeren",
"RANDOM_CASE": "Zufälliger-Aufbau",
"CLEAR_BOARD": "Leeres Gitter",
"VISITED": "Besucht",
"PATH": "Pfad",
"PATH_LENGTH": "Pfadlänge",