{"schemaVersion":1,"record":{"key":"mechanic/puzzle--family-programming","type":"mechanic","id":"puzzle--family-programming","lang":"en","title":"Algorithms and programming","summary":"The player creates a procedure that solves a problem within a defined execution model.","updatedAt":"2026-10-22","status":"active","url":"https://gamemechanics.pro/en/knowledge/mechanic/puzzle--family-programming/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/mechanic/puzzle--family-programming.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/mechanic/puzzle--family-programming.md","aliases":[],"tags":["Puzzles","Mechanics catalog"],"sourceIds":["source-2fb392d4831688b7"],"sources":[{"id":"source-2fb392d4831688b7","title":"Human Resource Machine","url":"https://store.steampowered.com/app/375820/","verifiedAt":null}],"sections":[{"id":"principle","title":"How it works","body":"Create a procedure that solves a problem in a given execution model."},{"id":"variants","title":"Variants","body":"### Variants and applications\n\n<a id=\"family-programming-variants\"></a>\n\n- Sequence of commands. Definition: Compose a program from elementary actions before launching it. Conditional example: Guide the robot along the route with commands. <a id=\"variant-command-sequence\"></a>\n- Repeatable block. Definition: Use a loop instead of an expanded sequence. Conditional example: Describe the traversal of repeating columns in one block. <a id=\"variant-loop-program\"></a>\n- Conditional execution. Definition: Select actions based on sensor readings or input properties. Conditional example: Turn only in front of the red square. <a id=\"variant-branch-program\"></a>\n- Subroutines. Definition: Decompose the solution into callable parts with a limit on the size of the program. Conditional example: Move the repeated lifting into a separate procedure. <a id=\"variant-subroutine\"></a>\n- Recursive procedure. Definition: Construct a solution by calling the same operation again for a smaller or nested problem. Conditional example: Traversal of a tree of unknown depth. <a id=\"variant-recursive-program\"></a>\n- Registers and limited memory. Definition: Convert data when the number of stored values ​​is small. Conditional example: Sort a stream with two registers. <a id=\"variant-register-machine\"></a>\n- Stack computing. Definition: Construct a calculation using operations on the top of the stack. Conditional example: Get a formula without named variables. <a id=\"variant-stack-language\"></a>\n- Coordination of performers. Definition: Organize independent programs with data exchange and shared resources. Conditional example: Coordinate two processors without waiting for each other. <a id=\"variant-parallel-program\"></a>\n- Program correction. Definition: Find and change erroneous actions in a finished procedure. Conditional example: Correct one command that violates the route. <a id=\"variant-debug-program\"></a>\n- Solution for all valid inputs. Definition: Create an algorithm that works on a set of cases, rather than on a single sample. Conditional example: Build a sorter for any valid stream. <a id=\"variant-general-solution\"></a>\n- Optimization of the procedure. Definition: Improve a correct program according to a given metric. Conditional example: Reduce execution time with the same result. <a id=\"variant-program-optimization\"></a>"},{"id":"context","title":"Context and limits","body":"A wide catalog of mechanics for digital puzzles, paper logic problems and physical puzzles. Each position contains an action or rule and a conditional example of application."}],"relations":[],"placements":[{"catalogId":"puzzle","id":"family-programming","title":"Puzzles","url":"https://gamemechanics.pro/en/mechanics/puzzle/#family-programming","categoryIds":["section-1"]}],"supersededBy":[],"attributes":{"preview":{"updatedAt":"2026-10-22","title":"Algorithms and programming","description":"The player creates a procedure that solves a problem within a defined execution model.","image":{"src":"images/mechanics/adventure-human-resource-machine-00.webp","width":1440,"height":810,"game":"Human Resource Machine","sourceUrl":"https://store.steampowered.com/app/375820/","originalUrl":"https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/375820/ss_5de238ca62f67dc97c940bd6af61c03a4320c981.1920x1080.jpg?t=1692721273","credit":"Tomorrow Corporation","rights":"Game imagery © its respective rights holders. Publisher-distributed Steam screenshot; all rights reserved. Excluded from MIT and CC BY 4.0.","caption":"Program commands control transport and calculation","alt":"Program commands control transport and calculation","markers":[{"x":84,"y":65,"label":"The program defines execution order"},{"x":25,"y":49,"label":"An agent executes commands in the game world"}]},"tips":["Provide step-by-step execution and inspectable variables or states."],"examples":[{"title":"Human Resource Machine","url":"https://store.steampowered.com/app/375820/"}]}},"endsAt":null,"provenance":"Original editorial design catalog consolidated from project discussions on 2026-10-20. Complete discussion item lists and contextual limitations are preserved; linked primary sources support specific techniques, not the entire classification. English translation was prepared with machine assistance and editorial review.","license":"CC-BY-4.0","codeLicense":"MIT","attribution":"gamemechanics.pro contributors","catalogKey":"catalog/puzzle"}}