If case

Catalin Ichim
Preview of If casePreview of If case

About this model

This diagram is designed to determine the maximum of two input values using a combination of registers and state connections. It incorporates interactive input registers labeled "Input 1" and "Input 2," where users can input numerical values. These inputs are then evaluated in a logical condition within another register that determines if the value in "Input 1" is larger than "Input 2." Depending on this evaluation, the diagram uses conditional state connections to set the value of a "max" register to the larger of the two inputs.

The process involves comparing inputs and manipulating values based on the outcome of comparisons. A textual description embedded in the diagram succinctly explains the logic: "If a b then max = a else max = b." This mechanism demonstrates a fundamental computational concept of conditional logic and value assignment. The interactive component where inputs are manually provided, combined with the dynamic update of the "max" register based on conditions, exemplifies a basic decision-making structure in computational systems, making the diagram an illustrative tool for understanding conditional statements and maximum value determination in computational logic.

“If case” is a diagram in the Machinations Community by Catalin Ichim.

You can open the original diagram in the Machinations app, press Play to watch how resources move through it, and change its values to see how the system responds. Machinations is a visual tool for designing, simulating and balancing game economies and other systems, where resources flow through sources, pools, drains, converters and gates.