comment out/remove debugging code

This commit is contained in:
Rowan Torbitzky-Lane 2025-02-14 17:00:13 -06:00
parent 153f4264e2
commit 054d321102

View File

@ -6,24 +6,28 @@ import Data.Map qualified as Map
import HushGP.Instructions.Opens import HushGP.Instructions.Opens
import HushGP.State import HushGP.State
import HushGP.Utility import HushGP.Utility
import HushGP.Instructions -- import HushGP.Instructions
import Debug.Trace -- import Debug.Trace
tempPlushy :: [Gene] -- tempPlushy :: [Gene]
tempPlushy = [ -- tempPlushy = [
StateFunc (instructionIntDiv, "instructionIntDiv"), -- StateFunc (instructionIntDiv, "instructionIntDiv"),
StateFunc (instructionExecDup, "instructionExecDup"), -- StateFunc (instructionExecDup, "instructionExecDup"),
GeneInt 1, -- GeneInt 1,
GeneInt 0, -- GeneInt 0,
StateFunc (instructionIntDiv, "instructionIntDiv"), -- StateFunc (instructionIntDiv, "instructionIntDiv"),
Skip, -- Skip,
GeneInt (-15), -- GeneInt (-15),
StateFunc (instructionIntSub, "instructionIntSub"), -- StateFunc (instructionExecDup, "instructionExecDup"),
-- StateFunc (instructionNoOpBlock, "instructionNoOpBlock"), -- StateFunc (instructionIntSub, "instructionIntSub"),
StateFunc (instructionExecIf, "instructionExecIf"), -- StateFunc (instructionFloatMul, "instructionFloatMul"),
Close, -- Skip,
Close -- Close,
] -- -- StateFunc (instructionNoOpBlock, "instructionNoOpBlock"),
-- StateFunc (instructionExecIf, "instructionExecIf"),
-- Close,
-- Close
-- ]
-- | Makes a random plushy from variables in a passed argMap and -- | Makes a random plushy from variables in a passed argMap and
-- a passed list of instructions. -- a passed list of instructions.
@ -69,17 +73,17 @@ plushyToPush plushy = plushyToPush' (concatMap (\x -> if isOpenerList x then x <
-- | Internal function used to convert a plushy genome with opens in it into its push phenotype. -- | Internal function used to convert a plushy genome with opens in it into its push phenotype.
plushyToPush' :: [Gene] -> [Gene] -> [Gene] plushyToPush' :: [Gene] -> [Gene] -> [Gene]
plushyToPush' openPlushy push plushyToPush' openPlushy push
| null openPlushy = trace "null" $ trace ("plushy: " <> show openPlushy) $ trace ("push: " <> show push) $ trace "--------------------" $ if any isOpen push | null openPlushy = if any isOpen push
then plushyToPush' [Close] push then plushyToPush' [Close] push
else push else push
| firstPlushy == Close = trace "Close" $ trace ("plushy: " <> show openPlushy) $ trace ("push: " <> show push) $ trace ("openIndex: " <> show openIndex) $ trace ("preOpen: " <> show preOpen) $ trace ("postOpen: " <> show postOpen) $ trace "--------------------" $ if any isOpen 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)))]) 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 else plushyToPush' (drop 1 openPlushy) push
| firstPlushy == Skip = trace "Skip" $ trace ("plushy: " <> show openPlushy) $ trace ("push: " <> show push) $ trace "--------------------" $ | firstPlushy == Skip =
case uncons openPlushy of case uncons openPlushy of
Just (_, _ : xs) -> plushyToPush' xs push Just (_, _ : xs) -> plushyToPush' xs push
_ -> plushyToPush' (drop 1 openPlushy) push _ -> plushyToPush' (drop 1 openPlushy) push
| otherwise = trace "otherwise" $ trace ("plushy: " <> show openPlushy) $ trace ("push: " <> show push) $ trace "--------------------" $ plushyToPush' (drop 1 openPlushy) (push <> [firstPlushy]) | otherwise = plushyToPush' (drop 1 openPlushy) (push <> [firstPlushy])
where where
firstPlushy :: Gene firstPlushy :: Gene
firstPlushy firstPlushy