Generating Lever-Door Puzzles with JavaScript
The article details the creation of lever-door puzzles for a browser MMO, utilizing a JavaScript script and graph structures to generate complex puzzles, with code available on GitHub.
Read original articleThe article discusses the creation of lever-door puzzles for a browser-based MMO, inspired by similar puzzles in games like Runescape. These puzzles require players to navigate through rooms by activating levers that toggle the states of doors, with the goal of reaching a final room for a reward. The author outlines a method for generating these puzzles using a graph structure, where rooms are nodes and doors are edges. The complexity of the puzzle generation is highlighted, as the number of possible configurations grows exponentially with the number of doors and switches. To manage this complexity, the author employs a script written in JavaScript that utilizes a breadth-first search algorithm to explore potential puzzles efficiently. The script defines the graph, calculates possible door changes, and implements a recursive function to test various scenarios. The author also mentions optimizations to reduce the number of trials needed to find a viable puzzle configuration. After running the script for an hour, the author successfully generated a puzzle with a 16-step shortest path. The article concludes with an invitation to explore the full code on GitHub, suggesting that this puzzle format could be developed into a standalone game.
- Lever-door puzzles involve navigating rooms by toggling doors with levers.
- The puzzle generation process is complex, requiring a graph structure and extensive calculations.
- A JavaScript script is used to automate the generation of puzzles through a breadth-first search.
- The author achieved a successful puzzle configuration after running the script for an hour.
- The full code is available on GitHub for others to explore and create similar puzzles.
Related
Solving puzzles faster than humanly possible
The Opus Magnum challenge tasks players with automating puzzle-solving to optimize Cost, Cycles, and Area metrics. Participants submit solutions for evaluation, exploring automated vs. human strategies, hybrid approaches, scoring systems, mods, and bots.
Door Problem
The "door problem," coined by Liz England, highlights the complexity of seemingly simple game features, revealing that tasks like adding doors require significant design and technical considerations across various disciplines.
Possibly all the ways to get loop-finding in graphs wrong
The article examines algorithms for detecting loops in planar graphs, highlighting their limitations and the need to identify specific edges involved, while reflecting on the complexities of graph theory in puzzle design.
Factorio – Visualizing construction material dependencies
The discussion highlights Factorio's gameplay, focusing on resource automation and complex dependencies. Sander Huisman shares code for visualizing these relationships using Mathematica, emphasizing the game's addictive nature.
Building a Game with the Real Engine
The author is developing a game using a diorama and photography instead of 3D modeling, facing artistic challenges and design flaws, while setting the game in an abbey and using a Raspberry Pi camera.
Given levers that toggle at least one door and with a stipulation that no single lever toggles the state of exactly the same set of doors as another lever how many levers do you need before you can precisely toggle the state of X doors? I personally hypothesise the answer as X but welcome thought on this from those that know their linear maths.
I’ll give an example of 2 levers and 2 doors. 2 distinct levers can toggle all states of 2 doors.
Eg. Lever 1 toggles 1,1 ( notation for both doors)
Lever 2 toggles 1, 0 ( just the first door )
Since the levers xor over each other I can make a truth table of all four possible states of the doors
( 0, 0 )
( 0, 1 ) - both levers for to this
( 1, 0 ) - just the second lever
( 1, 1 ) - just the first lever
Now i could change what the levers do, eg. I could make the first lever toggle ( 0, 1 ) and I can still build the above complete truth table.
A quick sketch without stating it here and I can see I can do the same with 3 levers and 3 doors. Is it true that x unique levers can always toggle all states of x unique doors?
Related
Solving puzzles faster than humanly possible
The Opus Magnum challenge tasks players with automating puzzle-solving to optimize Cost, Cycles, and Area metrics. Participants submit solutions for evaluation, exploring automated vs. human strategies, hybrid approaches, scoring systems, mods, and bots.
Door Problem
The "door problem," coined by Liz England, highlights the complexity of seemingly simple game features, revealing that tasks like adding doors require significant design and technical considerations across various disciplines.
Possibly all the ways to get loop-finding in graphs wrong
The article examines algorithms for detecting loops in planar graphs, highlighting their limitations and the need to identify specific edges involved, while reflecting on the complexities of graph theory in puzzle design.
Factorio – Visualizing construction material dependencies
The discussion highlights Factorio's gameplay, focusing on resource automation and complex dependencies. Sander Huisman shares code for visualizing these relationships using Mathematica, emphasizing the game's addictive nature.
Building a Game with the Real Engine
The author is developing a game using a diorama and photography instead of 3D modeling, facing artistic challenges and design flaws, while setting the game in an abbey and using a Raspberry Pi camera.