add vector types to State, need to add functions now
This commit is contained in:
parent
589fd6b242
commit
733151cf2f
20
src/State.hs
20
src/State.hs
@ -11,6 +11,10 @@ data Gene
|
||||
| GeneFloat Float
|
||||
| GeneBool Bool
|
||||
| GeneString String
|
||||
| GeneIntVector [Int]
|
||||
| GeneFloatVector [Float]
|
||||
| GeneBoolVector [Bool]
|
||||
| GeneStringVector [String]
|
||||
| StateFunc (State -> State)
|
||||
| PlaceInput String
|
||||
| Close
|
||||
@ -22,6 +26,10 @@ instance Eq Gene where
|
||||
GeneBool x == GeneBool y = x == y
|
||||
GeneString x == GeneString y = x == y
|
||||
PlaceInput x == PlaceInput y = x == y
|
||||
GeneIntVector xs == GeneIntVector ys = xs == ys
|
||||
GeneFloatVector xs == GeneFloatVector ys = xs == ys
|
||||
GeneBoolVector xs == GeneBoolVector ys = xs == ys
|
||||
GeneStringVector xs == GeneStringVector ys = xs == ys
|
||||
Close == Close = True
|
||||
StateFunc _ == StateFunc _ = True -- This line is probably not the best thing to do
|
||||
Block [x] == Block [y] = [x] == [y]
|
||||
@ -34,6 +42,10 @@ instance Show Gene where
|
||||
show (GeneString x) = "String: " <> x
|
||||
show (StateFunc _) = "Func: unnamed"
|
||||
show (PlaceInput x) = "In: " <> x
|
||||
show (GeneIntVector xs) = "Int Vec: " <> show xs
|
||||
show (GeneFloatVector xs) = "Float Vec: " <> show xs
|
||||
show (GeneBoolVector xs) = "Bool Vec: " <> show xs
|
||||
show (GeneStringVector xs) = "String Vec: " <> show xs
|
||||
show Close = "Close"
|
||||
show (Block xs) = "Block: " <> show xs
|
||||
|
||||
@ -43,6 +55,10 @@ data State = State
|
||||
float :: [Float],
|
||||
bool :: [Bool],
|
||||
string :: [String],
|
||||
vectorInt :: [[Int]],
|
||||
vectorFloat :: [[Float]],
|
||||
vectorBool :: [[Bool]],
|
||||
vectorString :: [[String]],
|
||||
parameter :: [Gene],
|
||||
input :: Map.Map String Gene
|
||||
}
|
||||
@ -57,6 +73,10 @@ emptyState =
|
||||
bool = [],
|
||||
string = [],
|
||||
parameter = [],
|
||||
vectorInt = [],
|
||||
vectorFloat = [],
|
||||
vectorBool = [],
|
||||
vectorString = [],
|
||||
input = Map.empty
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user