**Blue-Red Hackenbush Calculator**

**What is Blue-Red Hackenbush and how do we compute values?**

Hackenbush is a two-player Combinatorial Game where players (Left and Right) take turns removing edges (Blue and Red, respectively) from a diagram. This script only deals with single Hackenbush strings, though more complicated diagrams exist. In terms of a single stalk, values are computed as follows:

Until a color change, each segment is worth +1 or
-1 (depending on whether it is Blue or Red, respectively).

Once a color change occurs, each subsequent segment (regardless of color), is worth half of the previous segment, with a +/- corresponding to the color.

Thus, the string BBRB would be worth +1+1-1/2+1/4=7/4.

Any real number can be
approximated using Hackenbush strings and in terms of information
theory, this method provides a more efficient way for encouding numbers
than floating-point. Any dyadic rational (a rational with a power of
two in the denominator) can be expressed with a finite-length
Hackenbush stalk. When entering values, please enter only dyadic
rationals.Once a color change occurs, each subsequent segment (regardless of color), is worth half of the previous segment, with a +/- corresponding to the color.

Thus, the string BBRB would be worth +1+1-1/2+1/4=7/4.

**Compute the value of a single Hackenbush stalk or**

Find the Hackenbush stalk corresponding to a dyadic rational:

Find the Hackenbush stalk corresponding to a dyadic rational:

Hackenbush string of Bs and Rs: | Draw stalk | |||

Value of the Hackenbush stalk |

A visualization of the game or value entered is displayed below (if the box is checked). Click here to clear it.