Add Four-Color algorithm page

Introduce an interactive Four Color Theorem demo: add FourColorComponent (template, styles, standalone component) with canvas-based grid, region generation, adjacency detection and a backtracking solver; include models for nodes/regions and grid constants. Wire up route and RouterConstants/UrlConstants, add menu entry in AlgorithmsService, and add i18n entries for English and German. Also add global color styles in styles.scss and a few minor i18n text adjustments.
This commit is contained in:
lobo committed 2026-03-08 11:01:14 +01:00
1 parent 61defae20e
commit 54b33daa40
11 files changed
+615 -5

No files matched your search

+34
View File
@@ -526,6 +526,10 @@
"TITLE": "Maze Generation",
"DESCRIPTION": "Visualizing various maze generation algorithms."
},
"FOUR_COLOR": {
"TITLE": "Four Color Theorem",
"DESCRIPTION": "The four color theorem states that any map in a plane can be colored using at most four colors in such a way that regions sharing a common boundary (other than a single point) do not share the same color."
},
"FRACTAL": {
"TITLE": "Fractals",
"DESCRIPTION": "Visualisation of complex geometric patterns that resemble each other on increasingly smaller scales (self-similarity)."
@@ -545,5 +549,35 @@
"NOTE": "Note",
"GRID_HEIGHT": "Height",
"GRID_WIDTH": "Width"
},
"FOUR_COLOR": {
"TITLE": "Four Color Theorem",
"GENERATE": "Generate Map",
"SOLVE": "Auto Solve",
"CLEAR": "Clear Colors",
"COLOR_1": "Color 1",
"COLOR_2": "Color 2",
"COLOR_3": "Color 3",
"COLOR_4": "Color 4",
"EXECUTION_TIME": "Execution Time",
"STATUS": {
"LABEL": "Status",
"INCOMPLETE": "Map is not fully colored yet.",
"SOLVED": "Congratulations! You solved the map correctly!",
"CONFLICTS": "Warning: Adjacent regions have the same color!",
"INVALID": "Map is fully colored, but contains conflicts."
},
"EXPLANATION": { "TITLE": "Four Color Theorem",
"EXPLANATION": "The four color theorem states that any map in a plane can be colored using at most four colors in such a way that regions sharing a common boundary (other than a single point) do not share the same color.",
"DISCLAIMER": "This algorithm uses backtracking to find a valid coloring for the generated regions.",
"DISCLAIMER_1": "Map Generation: Regions are generated using a random seed growth algorithm (Voronoi-like) on a grid.",
"DISCLAIMER_2": "Adjacency: Two regions are considered neighbors if they share at least one edge in the grid.",
"DISCLAIMER_3": "Backtracking: The solver tries colors 1-4 for each region, backtracking when a conflict is found.",
"DISCLAIMER_4": "Interactive: You can also click on regions to cycle through colors manually.",
"DISCLAIMER_BOTTOM": "Click to color the region. Click again to change the color."
},
"ALERT": {
"NO_SOLUTION": "No solution found (this should not happen for a planar map!)."
}
}
}