Factorial Calculator
Difficulty: Expert
Game Overview
Design a physical track where a marble rolls and executes programming instructions. The marble carries a value and performs calculations as it hits different track pieces.
Puzzle
Calculate the factorial of 4 (4! = 4 ร 3 ร 2 ร 1) and output the result 24.
Starting Conditions:
- Marble begins carrying the value: 4
- Expected output: 24
Available Track Pieces (Use Each Once):
- 2ร CURVE - Changes marble direction 90ยฐ
- 1ร STRAIGHT - Continues marble in same direction
- 1ร LOOP-TRACK - Connects track to form a physical loop
- 1ร BRANCH-ZERO - Marble goes LEFT if carrying 0, RIGHT otherwise
- 1ร SUBTRACT-1 - Subtracts 1 from marble's value
- 1ร MULTIPLY - Multiplies marble's value by memory slot A
- 1ร STORE-A - Saves marble's current value to memory slot A
- 1ร LOAD-A - Loads value from memory slot A into marble
- 1ร OUTPUT - Displays marble's current value
- 1ร HALT - Stops the marble
Rules:
- Arrange all track pieces to create a complete path
- Marble executes instructions when rolling over pieces
- Design must calculate factorial using the loop mechanism
- Marble must output 24 and then halt
Goal
The marble completes its journey, outputs 24, and stops.
Really cool ๐