this stuff is broken rn. It's bed time
This commit is contained in:
parent
eab4932d54
commit
2399b7660b
@ -7,6 +7,7 @@ import HushGP.Instructions.Opens
|
||||
import HushGP.State
|
||||
import HushGP.Utility
|
||||
import HushGP.Instructions
|
||||
import Debug.Trace
|
||||
|
||||
tempPlushy :: [Gene]
|
||||
tempPlushy = [
|
||||
@ -15,9 +16,11 @@ tempPlushy = [
|
||||
GeneInt 1,
|
||||
GeneInt 0,
|
||||
StateFunc (instructionIntDiv, "instructionIntDiv"),
|
||||
Skip,
|
||||
GeneInt (-15),
|
||||
StateFunc (instructionIntSub, "instructionIntSub"),
|
||||
StateFunc (instructionNoOpBlock, "instructionNoOpBlock"),
|
||||
-- StateFunc (instructionNoOpBlock, "instructionNoOpBlock"),
|
||||
StateFunc (instructionExecIf, "instructionExecIf"),
|
||||
Close,
|
||||
Close
|
||||
]
|
||||
@ -72,6 +75,10 @@ plushyToPush' openPlushy push
|
||||
| firstPlushy == Close = if any isOpen push
|
||||
then plushyToPush' (drop 1 openPlushy) (if numOpen (push !! openIndex) == 1 then preOpen <> [Block postOpen] else preOpen <> [Block (postOpen <> [decOpen (Open (numOpen (push !! openIndex)))])])
|
||||
else plushyToPush' (drop 1 openPlushy) push
|
||||
| firstPlushy == Skip =
|
||||
case uncons openPlushy of
|
||||
Just (_, _ : xs) -> plushyToPush' xs push
|
||||
_ -> plushyToPush' (drop 1 openPlushy) push
|
||||
| otherwise = plushyToPush' (drop 1 openPlushy) (push <> [firstPlushy])
|
||||
where
|
||||
firstPlushy :: Gene
|
||||
|
@ -15,7 +15,7 @@ import HushGP.Instructions.VectorCharInstructions
|
||||
-- To be used in plushy conversion.
|
||||
instructionOpens :: Map.Map Gene Int
|
||||
instructionOpens = Map.fromList [
|
||||
(StateFunc (instructionExecIf, "instructionsExecIf"), 2),
|
||||
(StateFunc (instructionExecIf, "instructionExecIf"), 2),
|
||||
(StateFunc (instructionExecDup, "instructionExecDup"), 1),
|
||||
(StateFunc (instructionExecDupN, "instructionExecDupN"), 1),
|
||||
(StateFunc (instructionExecPop, "instructionExecPop"), 1),
|
||||
|
@ -74,4 +74,5 @@ interpretExec state@(State {_exec = e : es}) =
|
||||
(GeneVectorCharERC (val, _)) -> interpretExec (state & exec .~ es & vectorChar .~ val : view vectorChar state)
|
||||
Close -> undefined -- This should never happen. Will be converted to Blocks in the Plushy -> Exec stack process
|
||||
(Open _) -> undefined -- This should also never happen. Should be converted in Plushy -> Exec stack process
|
||||
Skip -> undefined -- This should double also never happen.
|
||||
interpretExec state = state
|
||||
|
@ -26,6 +26,7 @@ data Gene
|
||||
| PlaceInput String
|
||||
| Close
|
||||
| Open Int
|
||||
| Skip
|
||||
| Block [Gene]
|
||||
| GeneIntERC (Integer, StdGen)
|
||||
| GeneFloatERC (Double, StdGen)
|
||||
@ -129,6 +130,7 @@ instance Show Gene where
|
||||
show (GeneVectorChar xs) = "Char Vec: " <> show xs
|
||||
show Close = "Close"
|
||||
show (Open x) = "Open: " <> show x
|
||||
show Skip = "Skip"
|
||||
show (Block xs) = "Block: " <> show xs
|
||||
show (GeneIntERC x) = "Int ERC: " <> show x
|
||||
show (GeneFloatERC x) = "Float ERC: " <> show x
|
||||
|
Loading…
x
Reference in New Issue
Block a user