remove string stack (why do we have this?)

This commit is contained in:
Rowan Torbitzky-Lane 2025-01-19 20:53:28 -06:00
parent f991792787
commit d67ed6a821

View File

@ -12,11 +12,9 @@ data Gene
= GeneInt Int = GeneInt Int
| GeneFloat Float | GeneFloat Float
| GeneBool Bool | GeneBool Bool
| GeneString String
| GeneIntVector [Int] | GeneIntVector [Int]
| GeneFloatVector [Float] | GeneFloatVector [Float]
| GeneBoolVector [Bool] | GeneBoolVector [Bool]
| GeneStringVector [String]
| StateFunc (State -> State) | StateFunc (State -> State)
| PlaceInput String | PlaceInput String
| Close | Close
@ -26,12 +24,10 @@ instance Eq Gene where
GeneInt x == GeneInt y = x == y GeneInt x == GeneInt y = x == y
GeneFloat x == GeneFloat y = x == y GeneFloat x == GeneFloat y = x == y
GeneBool x == GeneBool y = x == y GeneBool x == GeneBool y = x == y
GeneString x == GeneString y = x == y
PlaceInput x == PlaceInput y = x == y PlaceInput x == PlaceInput y = x == y
GeneIntVector xs == GeneIntVector ys = xs == ys GeneIntVector xs == GeneIntVector ys = xs == ys
GeneFloatVector xs == GeneFloatVector ys = xs == ys GeneFloatVector xs == GeneFloatVector ys = xs == ys
GeneBoolVector xs == GeneBoolVector ys = xs == ys GeneBoolVector xs == GeneBoolVector ys = xs == ys
GeneStringVector xs == GeneStringVector ys = xs == ys
Close == Close = True Close == Close = True
StateFunc _ == StateFunc _ = True -- This line is probably not the best thing to do StateFunc _ == StateFunc _ = True -- This line is probably not the best thing to do
Block [x] == Block [y] = [x] == [y] Block [x] == Block [y] = [x] == [y]
@ -41,13 +37,11 @@ instance Show Gene where
show (GeneInt x) = "Int: " <> show x show (GeneInt x) = "Int: " <> show x
show (GeneFloat x) = "Float: " <> show x show (GeneFloat x) = "Float: " <> show x
show (GeneBool x) = "Bool: " <> show x show (GeneBool x) = "Bool: " <> show x
show (GeneString x) = "String: " <> x
show (StateFunc _) = "Func: unnamed" show (StateFunc _) = "Func: unnamed"
show (PlaceInput x) = "In: " <> x show (PlaceInput x) = "In: " <> x
show (GeneIntVector xs) = "Int Vec: " <> show xs show (GeneIntVector xs) = "Int Vec: " <> show xs
show (GeneFloatVector xs) = "Float Vec: " <> show xs show (GeneFloatVector xs) = "Float Vec: " <> show xs
show (GeneBoolVector xs) = "Bool Vec: " <> show xs show (GeneBoolVector xs) = "Bool Vec: " <> show xs
show (GeneStringVector xs) = "String Vec: " <> show xs
show Close = "Close" show Close = "Close"
show (Block xs) = "Block: " <> show xs show (Block xs) = "Block: " <> show xs
@ -56,11 +50,9 @@ data State = State
_int :: [Int], _int :: [Int],
_float :: [Float], _float :: [Float],
_bool :: [Bool], _bool :: [Bool],
_string :: [String],
_intVector :: [[Int]], _intVector :: [[Int]],
_floatVector :: [[Float]], _floatVector :: [[Float]],
_boolVector :: [[Bool]], _boolVector :: [[Bool]],
_stringVector :: [[String]],
_parameter :: [Gene], _parameter :: [Gene],
_input :: Map.Map String Gene _input :: Map.Map String Gene
} }
@ -75,12 +67,10 @@ emptyState =
_int = [], _int = [],
_float = [], _float = [],
_bool = [], _bool = [],
_string = [],
_parameter = [], _parameter = [],
_intVector = [], _intVector = [],
_floatVector = [], _floatVector = [],
_boolVector = [], _boolVector = [],
_stringVector = [],
_input = Map.empty _input = Map.empty
} }
@ -91,11 +81,9 @@ exampleState =
_int = [32, 56], _int = [32, 56],
_float = [3.23, 9.235], _float = [3.23, 9.235],
_bool = [True, False], _bool = [True, False],
_string = ["abc", "123"],
_parameter = [], _parameter = [],
_intVector = [[1,2], [5,6,8]], _intVector = [[1,2], [5,6,8]],
_floatVector = [[1.234, 9.21], [5.42, 6.221, 8.5493]], _floatVector = [[1.234, 9.21], [5.42, 6.221, 8.5493]],
_boolVector = [[True, False], [False, False, True]], _boolVector = [[True, False], [False, False, True]],
_stringVector = [["def", "567"], ["gamer", "fellah", "live action how to train your dragon"]],
_input = Map.empty _input = Map.empty
} }