add code stack
This commit is contained in:
parent
4e42c4332b
commit
2ca1f0fe94
12
src/State.hs
12
src/State.hs
@ -1,8 +1,9 @@
|
|||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
|
||||||
module State where
|
module State where
|
||||||
|
|
||||||
import qualified Data.Map as Map
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
import Data.Map qualified as Map
|
||||||
|
|
||||||
-- The exec stack must store heterogenous types,
|
-- The exec stack must store heterogenous types,
|
||||||
-- and we must be able to detect that type at runtime.
|
-- and we must be able to detect that type at runtime.
|
||||||
@ -26,7 +27,7 @@ instance Eq Gene where
|
|||||||
GeneBool x == GeneBool y = x == y
|
GeneBool x == GeneBool 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
|
||||||
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
|
||||||
@ -47,6 +48,7 @@ instance Show Gene where
|
|||||||
|
|
||||||
data State = State
|
data State = State
|
||||||
{ _exec :: [Gene],
|
{ _exec :: [Gene],
|
||||||
|
_code :: [Gene],
|
||||||
_int :: [Int],
|
_int :: [Int],
|
||||||
_float :: [Float],
|
_float :: [Float],
|
||||||
_bool :: [Bool],
|
_bool :: [Bool],
|
||||||
@ -64,6 +66,7 @@ emptyState :: State
|
|||||||
emptyState =
|
emptyState =
|
||||||
State
|
State
|
||||||
{ _exec = [],
|
{ _exec = [],
|
||||||
|
_code = [],
|
||||||
_int = [],
|
_int = [],
|
||||||
_float = [],
|
_float = [],
|
||||||
_bool = [],
|
_bool = [],
|
||||||
@ -75,14 +78,15 @@ emptyState =
|
|||||||
}
|
}
|
||||||
|
|
||||||
exampleState :: State
|
exampleState :: State
|
||||||
exampleState =
|
exampleState =
|
||||||
State
|
State
|
||||||
{ _exec = [],
|
{ _exec = [],
|
||||||
|
_code = [],
|
||||||
_int = [32, 56],
|
_int = [32, 56],
|
||||||
_float = [3.23, 9.235],
|
_float = [3.23, 9.235],
|
||||||
_bool = [True, False],
|
_bool = [True, False],
|
||||||
_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]],
|
||||||
_input = Map.empty
|
_input = Map.empty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user