From b7926662e19cee7368d77ff97877d92aae987bad Mon Sep 17 00:00:00 2001
From: Rowan Torbitzky-Lane <rowan.a.tl@protonmail.com>
Date: Fri, 14 Feb 2025 01:20:54 -0600
Subject: [PATCH] fix skip not working

---
 src/HushGP/Genome.hs | 8 ++++----
 src/HushGP/State.hs  | 2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/HushGP/Genome.hs b/src/HushGP/Genome.hs
index a791c6a..ff3dec5 100644
--- a/src/HushGP/Genome.hs
+++ b/src/HushGP/Genome.hs
@@ -69,17 +69,17 @@ plushyToPush plushy = plushyToPush' (concatMap (\x -> if isOpenerList x then x <
 -- | Internal function used to convert a plushy genome with opens in it into a push genome.
 plushyToPush' :: [Gene] -> [Gene] -> [Gene]
 plushyToPush' openPlushy push
-  | null openPlushy = if any isOpen push
+  | null openPlushy = trace "null" $ trace ("plushy: " <> show openPlushy) $ trace ("push: " <> show push) $ trace "--------------------" $ if any isOpen push
         then plushyToPush' [Close] push
         else push
-  | firstPlushy == Close = if any isOpen push
+  | firstPlushy == Close = trace "Close" $ trace ("plushy: " <> show openPlushy) $ trace ("push: " <> show push) $ trace "--------------------" $ 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 =
+  | firstPlushy == Skip = trace "Skip" $ trace ("plushy: " <> show openPlushy) $ trace ("push: " <> show push) $ trace "--------------------" $
     case uncons openPlushy of
       Just (_, _ : xs) -> plushyToPush' xs push
       _ -> plushyToPush' (drop 1 openPlushy) push
-  | otherwise = plushyToPush' (drop 1 openPlushy) (push <> [firstPlushy])
+  | otherwise = trace "otherwise" $ trace ("plushy: " <> show openPlushy) $ trace ("push: " <> show push) $ trace "--------------------" $ plushyToPush' (drop 1 openPlushy) (push <> [firstPlushy])
   where
       firstPlushy :: Gene
       firstPlushy
diff --git a/src/HushGP/State.hs b/src/HushGP/State.hs
index 39c6e9d..5dad5a7 100644
--- a/src/HushGP/State.hs
+++ b/src/HushGP/State.hs
@@ -53,6 +53,7 @@ instance Eq Gene where
   GeneVectorChar xs == GeneVectorChar ys = xs == ys
   Close == Close = True
   Open x == Open y = x == y
+  Skip == Skip = True
   StateFunc (_, nameX) == StateFunc (_, nameY) = nameX == nameY
   Block x == Block y = x == y
   GeneIntERC (x, _) == GeneIntERC (y, _) = x == y
@@ -91,6 +92,7 @@ instance Ord Gene where
   GeneVectorChar xs <= GeneVectorChar ys = xs <= ys
   Close <= Close = True
   Open x <= Open y = x <= y
+  Skip <= Skip = True
   StateFunc (_, nameX) <= StateFunc (_, nameY) = nameX <= nameY
   Block x <= Block y = x <= y
   GeneIntERC (x, _) <= GeneIntERC (y, _) = x <= y