@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ia! ia!ia! ia!ia! ia!ia! ia!aei!ia! ia!aei!allei!alei!lei!kei!l", "problemId": 0} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ia! ia!ia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ia! ia!necronomiconyuggothei!ia! ia!klkkkllkbei!lei!", "problemId": 0} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "dei!kdei!bei!pdaei!ppdlakbbei!ppdlakei!ppdladpppddppppkppkl", "problemId": 10} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.yuggothei!necronomiconbdpppdei!pkbbei!dei!", "problemId": 11} |
@ -0,0 +1 @@ | |||||
{"seed": 12877, "tag": "strategy2b", "solution": "cthulhu r'lyehyogsothothia! ia!ia! ia!necronomiconei!ldappdpkppdei!l", "problemId": 11} |
@ -0,0 +1 @@ | |||||
{"seed": 16526, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconia! ia!necronomiconyogsothothyuggothei!necronomiconcthulhu r'lyehnecronomiconia! ia!ia! ia!pcthulhu r'lyehei!pei!aei!adei!kpddppaei!ddbbei!kaei!l", "problemId": 11} |
@ -0,0 +1 @@ | |||||
{"seed": 19558, "tag": "strategy2b", "solution": "cthulhu r'lyehia! ia!ia! ia!necronomiconei!aei!llei!ei!aei!aadaaddei!ayuggoth", "problemId": 11} |
@ -0,0 +1 @@ | |||||
{"seed": 20528, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconia! ia!necronomiconei!ia! ia!necronomiconei!dei!paei!l", "problemId": 11} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothyuggothia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconei!ia! ia!acthulhu r'lyehyuggothei!aei!akei!pdpkppdei!l", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 1155, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothyuggothia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ia! ia!necronomiconei!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconei!llnecronomiconei!ia! ia!aei!ayogsothothei!aei!alkei!kei!aei!l", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 12700, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothyuggothia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconei!necronomiconnecronomiconei!kei!kkaaei!aei!necronomiconia! ia!dei!aei!dei!kbei!", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 18660, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothyuggothia! ia!necronomiconei!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconcthulhu r'lyehcthulhu r'lyehnecronomiconnecronomiconcthulhu r'lyehpia! ia!ia! ia!kaia! ia!ia! ia!necronomicondei!aei!dbei!", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 19102, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothyuggothia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconei!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconia! ia!aei!llei!abei!", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 24103, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothyuggothia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconei!ia! ia!necronomiconcthulhu r'lyehyuggothcthulhu r'lyehcthulhu r'lyehcthulhu r'lyehia! ia!ia! ia!cthulhu r'lyehyogsothothnecronomiconlllei!aallei!ablldei!aei!pdaakppkppdaei!aei!l", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 24762, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothyuggothia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconei!necronomiconia! ia!ia! ia!ia! ia!ia! ia!lei!alalei!lei!ldei!aei!k", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 24803, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconia! ia!adei!aei!akaei!pdaaei!pppdei!l", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 29992, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothyuggothia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconei!ia! ia!ia! ia!ia! ia!ia! ia!ia! ia!ayogsothothei!ayuggothei!aei!pppdei!kei!", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 5864, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothyuggothia! ia!necronomiconei!aei!allei!dei!kei!l", "problemId": 12} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ia! ia!ia! ia!john bigboote r'lyehyogsothothnecronomiconei!john bigbooteyuggothjohn bigbootejohn bigbootenecronomiconia! ia!ia! ia!ia! ia!john bigbootejohn bigbootejohn bigbootejohn bigbootejohn bigbootejohn bigbootejohn bigbootejohn bigbootenecronomiconnecronomiconia! ia!ia! ia!aabbblbblei!ablia! ia!ia! ia!ia! ia!aei!l", "problemId": 18} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ia! ia!ia! ia!ia! ia!ei!ia! ia!ia! ia!ia! ia!ia! ia!ia! ia!ia! ia!ia! ia!aia! ia!ei!ei!pia! ia!aei!pia! ia!lppia! ia!ppia! ia!pabpppia! ia!ppabppppia! ia!ppppia! ia!pppabpppppia! ia!ppppabppppppaaei!ppppppaaei!pppppaabppppppabpppppppppppppppppppppppppppppppppppl", "problemId": 19} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothlyuggothklalia! ia!adei!l", "problemId": 20} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ei!aei!ei!abppabpppaalei!ppaalabpppaalbpppaabpppabppppppppppppppl", "problemId": 21} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ei!dbei!bei!pakpadpppdbddei!ppppkppkl", "problemId": 22} |
@ -0,0 +1 @@ | |||||
{"seed": 0, "tag": "strategy2b", "solution": "ia! ia!ppkbblei!kbblbdbkkbbbei!bbei!bbei!ppkl", "problemId": 23} |
@ -0,0 +1 @@ | |||||
{"seed": 18, "tag": "strategy2b", "solution": "ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ia! ia!ia! ia!ia! ia!ia! ia!aei!alllabbbakkkbdbbbbkkkpdpkkei!kkia! ia!akei!lbbknecronomiconyogsothothnecronomiconyuggothkei!kyuggothei!aei!d", "problemId": 24} |
@ -0,0 +1,67 @@ | |||||
{-# LANGUAGE DeriveGeneric #-} | |||||
module Main where | |||||
import GHC.Generics | |||||
import Data.Aeson | |||||
import Data.Aeson.Types | |||||
import qualified Data.List as List | |||||
import System.Environment | |||||
import qualified Data.ByteString.Lazy.Char8 as BS | |||||
import System.IO | |||||
import Datatypes | |||||
import Opt | |||||
import JSONDeser | |||||
import Strategy0 | |||||
import Datatypes.Game (commandsToString) | |||||
import Datatypes.Game (Command) | |||||
import PowerPhrases (charToCommand) | |||||
import qualified Datatypes.Game as Game | |||||
import Datatypes.Game (Game) | |||||
import VM (step, Notes(..)) | |||||
data JSONSer = JSONSer { problemId :: Int, | |||||
seed :: Int, | |||||
tag :: String, | |||||
solution :: String | |||||
} deriving (Show, Generic) | |||||
instance FromJSON JSONSer | |||||
instance ToJSON JSONSer | |||||
testVM :: Game -> String -> ([Notes], Int, Game) | |||||
testVM game strCmds = buildResult game commands [] where | |||||
commands = [c | (Just c) <- (map charToCommand strCmds)] | |||||
buildResult game [] notes = (reverse notes, Game.score game + (Game.powerCounterToScore $ Game.powerCounter game), game) | |||||
buildResult game (c:cs) notes = let (newGame, note) = step game c | |||||
in if elem note [ErrorSamePosition, ErrorGameEnded] | |||||
then (reverse (note:notes), 0, newGame) | |||||
else buildResult newGame cs (note:notes) | |||||
main :: IO () | |||||
main = do args <- getArgs | |||||
opt <- parseArgs args | |||||
file <- return ((optFile opt) !! 0) | |||||
seed <- return (optSeedNumber opt) | |||||
(Just commands) <- return (optPowerPhrase opt) | |||||
str <- BS.readFile file | |||||
(_, gmseed) <- return (readInput str) | |||||
let (Just (s, g)) = List.find (\(s, g) -> s == seed) gmseed | |||||
(notes, score, ng) <- return $ testVM g commands | |||||
putStrLn ("Commands: " ++ show (Game.commandsToString . reverse . Game.history $ ng)) | |||||
putStrLn ("Notes: " ++ show notes) | |||||
putStrLn ("Score: " ++ show score) | |||||
packAll :: Int -> [Int] -> [[Command]] -> [JSONSer] | |||||
packAll id seeds commandLists = zipWith (\x y -> JSONSer id x "lilik0" y) seeds commandStrings | |||||
where | |||||
commandStrings = map commandsToString commandLists | |||||
scoredata :: Int -> [Int] -> [Int] -> String | |||||
scoredata id seeds points = pretty | |||||
where | |||||
pretty = foldl (\x (a,b,c) -> (show a) ++ " " ++ (show b) ++ " " ++ (show c) ++ "\n" ++ x) "" zipdata | |||||
zipdata = zip3 ids seeds points | |||||
ids = replicate (length seeds) id | |||||
@ -0,0 +1 @@ | |||||
[{"seed":0,"tag":"strategy2b","solution":"ia! ia!ia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ia! ia!necronomiconyuggothei!ia! ia!klkkkllkbei!lei!","problemId":0}] |
@ -0,0 +1 @@ | |||||
[{"seed":0,"tag":"strategy2b","solution":"dei!kdei!bei!pdaei!ppdlakbbei!ppdlakei!ppdladpppddppppkppkl","problemId":10}] |
@ -1 +1 @@ | |||||
[{"seed":0,"tag":"strategy2","solution":"kkkkkkkkkbdpdadlkkkklkkklkbkkaddbkakpkkkkkpddddpddddpkkkkkpkkkkpkkaddddbkkkkkbkkkkkbkkkkbkkkkkbkbkkkkkbddbkbddplkkbddakkpddpkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkklddddbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbdddakkbdbkei!dei!pdpkpdpkpdpkppdei!l","problemId":11},{"seed":12877,"tag":"strategy2","solution":"kkkkkkkbbpdakkkbddbkkaddbkakkbkkkkaddbkbddpakkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkaddddbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbkakkkkkbdddakkbdbkei!dei!pdpkpdpkpdpkppdei!l","problemId":11},{"seed":16526,"tag":"strategy2","solution":"kkkkkkkkkbkkkadddbkkkaddbkakkkkkbkaddbkbddpakkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkaddddbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbkakkkkkbdddakkbdbkei!dei!pdpkpdpkpdpkppdei!l","problemId":11},{"seed":19558,"tag":"strategy2","solution":"kkkkbbbkpdpkkpkpdddbkakkpddakkkkbkkkkkbkkkkkakkkkkbkkkkkbkkbkkkkkbkbkkkkkbddbkbddpakkbddakkbddakkpddpkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkklddddbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbdddakkbdbkei!dei!pdpkpdpkpdpkppdei!l","problemId":11},{"seed":20528,"tag":"strategy2","solution":"kkkkkkkkkbkkkadddbkkkaddbkakkkkkbkaddbkbddpakkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkkkpkkkaddddbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbkkkkkbkakkkkkbdddakkbdbkei!dei!pdpkpdpkpdpkppdei!l","problemId":11}] | |||||
[{"seed":0,"tag":"strategy2b","solution":"ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothia! ia!ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.yuggothei!necronomiconbdpppdei!pkbbei!dei!","problemId":11},{"seed":12877,"tag":"strategy2b","solution":"cthulhu r'lyehyogsothothia! ia!ia! ia!necronomiconei!ldappdpkppdei!l","problemId":11},{"seed":16526,"tag":"strategy2b","solution":"ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconia! ia!necronomiconyogsothothyuggothei!necronomiconcthulhu r'lyehnecronomiconia! ia!ia! ia!pcthulhu r'lyehei!pei!aei!adei!kpddppaei!ddbbei!kaei!l","problemId":11},{"seed":19558,"tag":"strategy2b","solution":"cthulhu r'lyehia! ia!ia! ia!necronomiconei!aei!llei!ei!aei!aadaaddei!ayuggoth","problemId":11},{"seed":20528,"tag":"strategy2b","solution":"ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconia! ia!necronomiconei!ia! ia!necronomiconei!dei!paei!l","problemId":11}] |
@ -0,0 +1 @@ | |||||
[{"seed":0,"tag":"strategy2b","solution":"ia! ia!ia! ia!john bigboote r'lyehyogsothothnecronomiconei!john bigbooteyuggothjohn bigbootejohn bigbootenecronomiconia! ia!ia! ia!ia! ia!john bigbootejohn bigbootejohn bigbootejohn bigbootejohn bigbootejohn bigbootejohn bigbootejohn bigbootenecronomiconnecronomiconia! ia!ia! ia!aabbblbblei!ablia! ia!ia! ia!ia! ia!aei!l","problemId":18}] |
@ -0,0 +1 @@ | |||||
[{"seed":0,"tag":"strategy2","solution":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbpppppppppppppppppppppppppppppppppppbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbpppppppppppppppppppppppppppppppppppbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbpppppppppppppppppppppppppppppppppppbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbpppppppppppppppppppppppppppppppppppbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbpppppppppppppppppppppppppppppppppppbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbpppppppppppppppppppppppppppppppppppbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbppppppppppppppppppppabbbbbbbbbbbbei!ppppppppppppplbbbbbbbbbbbbbei!ppppppppppppplbbbbbbbbbbbbbei!ppppppppppppplbbbbei!lbbia! ia!l","problemId":19}] |
@ -1 +1 @@ | |||||
[{"seed":0,"tag":"strategy2","solution":"kpaalpaakpaalpaakppaalpaakkdddbkkbdddbkkkkkakkkkkbddddbkbdddbkkkbddbkkaddbkbdbkadbkadpkpdpkpddpkkpddpkkpddddbkakkkbddbkkbddakbdakbbbbei!pppdpkpdpkpddei!kkbdbkbdbkbbbbei!pppdpkpdpkpdpkpdpkpdppppplbbbbbbbbbbbei!l","problemId":20}] | |||||
[{"seed":0,"tag":"strategy2b","solution":"ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.necronomiconyogsothothlyuggothklalia! ia!adei!l","problemId":20}] |
@ -0,0 +1 @@ | |||||
[{"seed":0,"tag":"strategy2b","solution":"ei!aei!ei!abppabpppaalei!ppaalabpppaalbpppaabpppabppppppppppppppl","problemId":21}] |
@ -0,0 +1 @@ | |||||
[{"seed":0,"tag":"strategy2b","solution":"ei!dbei!bei!pakpadpppdbddei!ppppkppkl","problemId":22}] |
@ -0,0 +1 @@ | |||||
[{"seed":0,"tag":"strategy2b","solution":"ia! ia!ppkbblei!kbblbdbkkbbbei!bbei!bbei!ppkl","problemId":23}] |
@ -0,0 +1 @@ | |||||
[{"seed":18,"tag":"strategy2b","solution":"ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.ia! ia!ia! ia!ia! ia!ia! ia!aei!alllabbbakkkbdbbbbkkkpdpkkei!kkia! ia!akei!lbbknecronomiconyogsothothnecronomiconyuggothkei!kyuggothei!aei!d","problemId":24}] |