diff --git a/app/Main.hs b/app/Main.hs index 20d6f72..267ca50 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,14 +1,13 @@ -module Main where +module Main (main) where -import Data.Map qualified as Map -import Graphics.Vty import Control.Exception ( bracket ) import Data.List.NonEmpty (NonEmpty(..)) import Data.List.NonEmpty qualified as NonEmpty -import Data.Set qualified as Set -import System.Environment ( getArgs ) import Data.Map (Map) import Data.Map qualified as Map +import Data.Set qualified as Set +import Graphics.Vty +import System.Environment ( getArgs ) import Model import Rendering ( render ) @@ -108,14 +107,20 @@ worldList :: Map.Map String World worldList = Map.fromList [ ("world0", world0) , ("small", smallWorld) + , ("enter2", enter2) + , ("eat11", eat11) , ("center8", center8) , ("center13", center13) , ("clone11", clone11) + , ("transfer8", transfer8) , ("transfer14", transfer14) , ("transfer20", transfer20) , ("transfer26", transfer26) , ("transfer27", transfer27) , ("open4", open4) + , ("swap3", swap3) + , ("swap4", swap4) + , ("swap5", swap5) , ("cycle10", cycle10) , ("player10", player10) , ("player11", player11) @@ -176,6 +181,61 @@ smallWorld = Set.empty (Location 'b' 0 0) + +enter2 :: World +enter2 = parse + "player p\n\ + \block t white boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓t▓a▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block a white interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓ ▓▓\n\ + \▓▓ cpb ▓▓\n\ + \▓▓ ▓▓\n\ + \▓▓▓▓ ▓▓▓▓\n\ + \▓▓▓▓ =▓\n\ + \▓▓ -▓\n\ + \▓▓▓▓ ▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block c yellow interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓ ▓▓▓\n\ + \▓▓▓ \n\ + \▓▓▓ ▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block b blue boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block p magenta boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓ ▓▓▓ ▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n" + center8 :: World center8 = parse "player p\n\ @@ -284,6 +344,81 @@ center13 = parse \▓▓▓▓▓▓▓▓▓\n\ \▓▓▓▓▓▓▓▓▓\n" + +transfer8 :: World +transfer8 = parse + "player p\n\ + \block t cyan boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓t▓a▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block a cyan interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓ ▓▓▓\n\ + \▓▓ xb ▓▓▓\n\ + \▓▓ g▓▓\n\ + \▓▓ py ▓▓▓\n\ + \▓▓ ▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block g green interesting\n\ + \ ▓▓▓ \n\ + \ ▓ \n\ + \ \n\ + \▓ ▓\n\ + \▓▓ = ▓▓\n\ + \▓ ▓\n\ + \ \n\ + \ ▓ \n\ + \ ▓▓▓ \n\ + \block b blue interesting\n\ + \ \n\ + \ \n\ + \ ▓▓▓ \n\ + \ ▓▓ ▓▓ \n\ + \ ▓ ▓ \n\ + \ ▓▓ ▓▓ \n\ + \ ▓▓▓ \n\ + \ \n\ + \ \n\ + \block x yellow boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block y yellow boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block p magenta boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓ ▓▓▓ ▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n" + clone11 :: World clone11 = parse "player p\n\ @@ -590,86 +725,213 @@ world0 = World { ] } -cycle10 :: World -cycle10 = - World - (Map.fromList - [('g', - Box (Location 'g' 3 3) - (Original (makeWalls [ - "▓▓▓▓ ▓▓▓▓", - "▓▓▓▓ ▓▓▓▓", - "▓▓▓▓ ▓▓▓▓", - "▓ ▓▓▓", - "▓ ▓▓▓", - "▓ ▓▓▓", - "▓ ▓▓▓", - "▓ ▓ ▓", - "▓ ▓ ▓" - ])) - (withForeColor defAttr green) - False), - ('G', - Box - (Location 'g' 0 (-2)) - (Link 'g') - (withForeColor defAttr green) - True), - ('p', - Box - (Location 'g' 0 0) - (Original (makeWalls [ - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓ ▓▓▓ ▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓" - ])) - (withForeColor defAttr magenta) - True), - ('y', - Box - (Location 'g' (-4) 0) - (Original (makeWalls [ - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓ ", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓", - "▓▓▓▓▓▓▓▓▓" - ])) - (withForeColor defAttr yellow) - False), - ('1', - Box - (Location 'g' (-2) 0) - (Original (solid 9)) - (withForeColor defAttr red) - True), - ('2', - Box - (Location 'g' 2 0) - (Original (solid 9)) - (withForeColor defAttr red) - True), - ('3', - Box - (Location 'g' 2 (-2)) - (Original (solid 9)) - (withForeColor defAttr red) - True) - ]) - 'p' - Set.empty - (Location 'y' 0 3) +swap3 :: World +swap3 = parse + "player p\n\ + \block b blue interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓ ▓▓\n\ + \▓ b y ▓▓\n\ + \▓ ▓\n\ + \▓ p g ▓\n\ + \▓ ▓\n\ + \▓▓▓▓ ▓▓▓▓\n\ + \block g green interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \ -▓▓▓\n\ + \▓▓▓▓ -▓▓\n\ + \▓▓▓▓= -▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block y yellow interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block p magenta boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓ ▓▓▓ ▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n" +swap4 :: World +swap4 = parse + "player p\n\ + \block b blue interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓ ▓\n\ + \▓ b g ▓\n\ + \▓ - ▓\n\ + \▓ = ▓p \n\ + \▓ - ▓\n\ + \▓ y ▓\n\ + \▓ ▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block g green interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ ▓ ▓\n\ + \▓ ▓\n\ + \▓▓-▓ ▓\n\ + \▓▓▓▓ ▓\n\ + \▓▓▓▓ ▓▓▓▓\n\ + \block p magenta boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓ ▓▓▓ ▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block y yellow boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n" + + +swap5 :: World +swap5 = parse + "player p\n\ + \block b blue interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ g y ▓\n\ + \▓ p \n\ + \▓ b r ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block g green interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ - - ▓\n\ + \▓ = ▓\n\ + \▓ - - ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓▓▓▓ ▓▓▓▓\n\ + \block y yellow interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \ ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓▓▓ ▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block r red interesting\n\ + \▓▓▓▓ ▓▓▓▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓ ▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block p magenta boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓ ▓▓▓ ▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n" + +cycle10 :: World +cycle10 = parse + "player p\n\ + \block g green interesting\n\ + \▓▓▓▓c▓▓▓▓\n\ + \▓▓▓▓1▓▓▓▓\n\ + \▓▓▓▓ ▓▓▓▓\n\ + \▓ ▓▓▓\n\ + \▓ G p ▓▓▓\n\ + \▓ ▓▓▓\n\ + \▓ 2 3 ▓▓▓\n\ + \▓ ▓g▓\n\ + \▓ ▓ ▓\n\ + \link G g green\n\ + \block c yellow interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓ \n\ + \▓▓▓ = \n\ + \▓▓▓ \n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block p magenta boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓ ▓▓▓ ▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block 1 red boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block 2 red boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block 3 red boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n" player10 :: World player10 = @@ -1227,6 +1489,70 @@ infiniteEnter20 = Set.empty (Location 'w' (-3) 3) +eat11 :: World +eat11 = parse + "player p\n\ + \block t red boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓t▓r▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block r red interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓ ▓▓\n\ + \▓▓ p y ▓▓\n\ + \▓▓ ▓▓\n\ + \▓▓ b g ▓▓\n\ + \▓▓= -▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block p magenta boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓ ▓▓▓ ▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block b blue interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \ ▓▓\n\ + \ ▓▓\n\ + \ ▓▓\n\ + \ ▓▓\n\ + \ ▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \block g green interesting\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓-▓▓▓▓\n\ + \▓▓▓▓ ▓▓▓▓\n\ + \▓▓▓▓ ▓▓▓▓\n\ + \▓▓▓▓ ▓▓▓▓\n\ + \▓▓▓▓-▓▓▓▓\n\ + \block y yellow boring\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n\ + \▓▓▓▓▓▓▓▓▓\n" + multiInfinite5 :: World multiInfinite5 = parse "player p\n\ @@ -1283,31 +1609,31 @@ multiInfinite8 = parse \epsilon 1 b blue\n\ \ \n\ \ ▓ \n\ - \ \n\ - \ ▓▓\n\ - \ B ▓ \n\ - \ ▓▓\n\ - \ \n\ + \ ▓ \n\ + \ ▓ ▓▓\n\ + \ ▓ B ▓ \n\ + \ ▓ ▓▓\n\ + \ ▓ \n\ \ \n\ \ \n\ \epsilon 2 1 blue\n\ \ \n\ \ \n\ - \ ▓ \n\ - \ ▓▓\n\ - \ ▓ \n\ - \ ▓▓\n\ - \ \n\ + \ ▓▓ ▓ \n\ + \ ▓ ▓▓\n\ + \ ▓ ▓ \n\ + \ ▓ ▓▓\n\ + \ ▓▓ \n\ \ \n\ \ C x \n\ \epsilon 3 2 blue\n\ \ \n\ \ \n\ - \ \n\ - \ ▓▓\n\ - \ = ▓ \n\ - \ ▓▓\n\ - \ \n\ + \ ▓▓ \n\ + \ ▓ ▓▓\n\ + \ ▓▓ = ▓ \n\ + \ ▓ ▓▓\n\ + \ ▓▓ \n\ \ \n\ \ \n\ \block x yellow boring\n\