Scala, represent pattern of boolean tuple into something else.
- by Berlin Brown
This is a cellular automata rule (input Boolean == Left, Center, Right Cell) and output Boolean .
What is a better way to represent this in Scala.
trait Rule {
def ruleId() : Int
def rule(inputState:(Boolean, Boolean, Boolean)) : Boolean
override def toString : String = "Rule:" + ruleId
}
class Rule90 extends Rule {
…