The main menu is the entry point for every simulation run. It opens automatically when the 800×620 Arcade window titled “Spatial Donkey - Graphs” launches, and lets you configure the full path before the donkey begins its journey. Nothing happens until you fill in the start and end star labels and choose a mode — every field must be completed before a run can begin.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tutosrive/Constellations/llms.txt
Use this file to discover all available pages before exploring further.
Window Layout
The menu background is rendered in dark slate blue. The following elements are drawn top-to-bottom:| Element | Position (center) | Description |
|---|---|---|
| ”Menú Inicial” title | Top of screen | White bold text at 28 pt |
| Cargar JSON button | y = 360 | Opens a file picker to load a custom constellation JSON |
| Inicio input field | y = 300 | Text field for the starting star label (e.g. "A") |
| Fin input field | y = 220 | Text field for the destination star label (e.g. "H") |
| Ruta más corta button | y = 150 | Launches shortest-path (Dijkstra) mode |
| Ruta más larga button | y = 90 | Launches longest-path (DFS) mode |
arcade.color.AO) when active and white when inactive. The button backgrounds are also rendered in arcade.color.AO. If an error occurs — such as a missing input or an invalid star label — a red error message is drawn below the buttons.
Entering Star Labels
Clicking inside the Inicio or Fin box activates it; the border changes from white to green to indicate focus. Any subsequent keystrokes append characters to that field. All input is automatically converted to uppercase viatext.upper(), so typing "a" records "A". Pressing Backspace removes the last character from the active field.
Both fields must be non-empty and must correspond to labels that actually exist in the currently-loaded graph before a mode button will work. If either field is blank, or if the label is not found in graph.vertex_list, the menu shows a ⚠️ error message and returns without opening GameView.
Shortest Path Mode
Clicking Ruta más corta (or theEnter key) calls _start_game(mode="dijkstra"). The following sequence runs immediately:
current_mode = "dijkstra"is set onmain_runner.graph_controller.get_shortest_path(start, end)runs Dijkstra’s algorithm and returns(dist, pred, path).- The result is packaged as
dijkstra_data = {'dist': dist, 'pred': pred, 'path': path, 'mode': 'dijkstra'}and passed toGameView. window.show_view(game_view)switches the display to the graph simulation.
GameView calls graph_controller.toggle_edge(from_label, to_label), toggling that edge’s blocked state in real time. Red edges are blocked; white edges are passable; yellow edges are highlighted as part of the current path.
Longest Path Mode
Clicking Ruta más larga calls_start_game(mode="longest"). The sequence is:
current_mode = "longest"is set onmain_runner.- A fresh
Donkeyis created with the fixed starting stats shown below:
graph_controller.get_longest_path_with_donkey(start, donkey)runs a depth-first search that accounts for the donkey’s resource constraints, returning(path, dist).- The result is packaged as
{'path': path, 'dist': dist, 'mode': 'longest'}and passed toGameView.
on_mouse_press handler in GameView checks main_runner.current_mode and returns early if it is not "dijkstra".
Loading a Custom JSON
Clicking Cargar JSON opens a native OS file picker via the following flow in_load_graph_json():
root.withdraw() call ensures that no extra empty window appears on screen — only the system file-picker dialog is shown.
- If the user cancels without selecting a file,
error_messageis set to"⚠️ No seleccionaste ningún archivo.". - If a file is chosen,
graph_controller.load_graph(file_path)is called. On success,error_messagebecomes"✅ Grafo cargado correctamente."(displayed in red since it shares the error label, but visually indicates success). On failure, the message becomes"❌ No se pudo cargar el archivo.". - After a successful load,
self.graphis refreshed fromgraph_controller.graphso new star labels are immediately available for validation.