Your goal is to write an AnnotatedBool class which behaves like a plain boolean, but also has the ability to print out an explanation of how the boolean was computed. The class needs to support:
- Function
var(string, bool), which takes a variable name and a boolean setting - Operator
AnnotatedBool && AnnotatedBool, which ANDs two bools together - Operator
AnnotatedBool || AnnotatedBool, which ORs two bools together - Implicit conversion to
bool, which gives the concrete boolean value of the expression - Method
explain(), which returns an HTML string which explains how the boolean value of the expression was computed