Browse Source

stratery scores output from main1.hs standardized to main0

adaptedStrategy0
Zolfa 9 years ago
parent
commit
ef0a0ccbd0
2 changed files with 5 additions and 5 deletions
  1. +3
    -3
      src/Main1.hs
  2. +2
    -2
      src/Strategy1.hs

+ 3
- 3
src/Main1.hs View File

@ -24,11 +24,11 @@ main = do args <- getArgs
str <- BS.readFile file str <- BS.readFile file
(id, gmseed) <- return (readInput str) (id, gmseed) <- return (readInput str)
commandspoints <- return (map (\(seed,game) -> strat1 game) gmseed) commandspoints <- return (map (\(seed,game) -> strat1 game) gmseed)
(commands,pointslastnotes) <- return $ unzip commandspoints
(commands,points) <- return $ unzip commandspoints
seeds <- return ((map (\(seed, _) -> seed)) gmseed) seeds <- return ((map (\(seed, _) -> seed)) gmseed)
putStrLn . encodeJSON $ (packAll id seeds commands) putStrLn . encodeJSON $ (packAll id seeds commands)
print pointslastnotes
-- writeFile ("scores") (scoredata id (fst $ unzip gmseed) points)
-- print points
writeFile ("scores") (scoredata id (fst $ unzip gmseed) points)
packAll :: Int -> [Int] -> [[Command]] -> [JSONSer] packAll :: Int -> [Int] -> [[Command]] -> [JSONSer]


+ 2
- 2
src/Strategy1.hs View File

@ -4,9 +4,9 @@ import Datatypes
import VM import VM
strat1 :: Game -> ([Command],(Int,Notes))
strat1 :: Game -> ([Command],Int)
strat1 game = if new_notes == GameOver strat1 game = if new_notes == GameOver
then (new_command : [], (score new_game, new_notes))
then (new_command : [], score new_game)
else (new_command : (fst $ strat1 new_game), snd $ strat1 new_game) else (new_command : (fst $ strat1 new_game), snd $ strat1 new_game)
where where
(new_game_se,notes_se) = step game MoveSE (new_game_se,notes_se) = step game MoveSE


Loading…
Cancel
Save