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
|
| GeneFloat Float
|
||||||
| GeneBool Bool
|
| GeneBool Bool
|
||||||
| GeneString String
|
| GeneString String
|
||||||
|
| GeneIntVector [Int]
|
||||||
|
| GeneFloatVector [Float]
|
||||||
|
| GeneBoolVector [Bool]
|
||||||
|
| GeneStringVector [String]
|
||||||
| StateFunc (State -> State)
|
| StateFunc (State -> State)
|
||||||
| PlaceInput String
|
| PlaceInput String
|
||||||
| Close
|
| Close
|
||||||
@ -22,6 +26,10 @@ instance Eq Gene where
|
|||||||
GeneBool x == GeneBool y = x == y
|
GeneBool x == GeneBool y = x == y
|
||||||
GeneString x == GeneString 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
|
||||||
|
GeneFloatVector xs == GeneFloatVector 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]
|
||||||
@ -34,6 +42,10 @@ instance Show Gene where
|
|||||||
show (GeneString x) = "String: " <> 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 (GeneFloatVector xs) = "Float 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
|
||||||
|
|
||||||
@ -43,6 +55,10 @@ data State = State
|
|||||||
float :: [Float],
|
float :: [Float],
|
||||||
bool :: [Bool],
|
bool :: [Bool],
|
||||||
string :: [String],
|
string :: [String],
|
||||||
|
vectorInt :: [[Int]],
|
||||||
|
vectorFloat :: [[Float]],
|
||||||
|
vectorBool :: [[Bool]],
|
||||||
|
vectorString :: [[String]],
|
||||||
parameter :: [Gene],
|
parameter :: [Gene],
|
||||||
input :: Map.Map String Gene
|
input :: Map.Map String Gene
|
||||||
}
|
}
|
||||||
@ -57,6 +73,10 @@ emptyState =
|
|||||||
bool = [],
|
bool = [],
|
||||||
string = [],
|
string = [],
|
||||||
parameter = [],
|
parameter = [],
|
||||||
|
vectorInt = [],
|
||||||
|
vectorFloat = [],
|
||||||
|
vectorBool = [],
|
||||||
|
vectorString = [],
|
||||||
input = Map.empty
|
input = Map.empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user