This commit is contained in:
weiss
2020-04-25 20:00:03 +02:00
parent f0ab6ad122
commit f41d806029
5 changed files with 66 additions and 41 deletions

View File

@@ -1,16 +1,22 @@
module Main where
import System.Environment
import Codingame
import Simulation.Board
import Simulation.Data
import Data.Vector as V
main :: IO ()
-- main = test
main = bundle
main = do
bundle
print $ sim1 (2,4)
--test
test :: IO ()
test = print $ Prelude.reverse $ loop1 (0,0) 10 []
test = do
args <- getArgs
let simDepth = if Prelude.length args > 0 then read $ Prelude.head args :: Int else 3
print $ Prelude.reverse $ loop1 (0,0) simDepth []
loop1 :: Pos -> Int -> [Pos] -> [Pos]
loop1 pos depth acc
@@ -21,7 +27,7 @@ loop1 pos depth acc
in loop1 sim (depth - 1) acc'
sim1 :: Pos -> (Int, Pos)
sim1 pos = simulate board1 (0, 100, pos, singleton (0,4))
sim1 pos = (\(val, (_,_, pos, _)) -> (val, pos)) (simulate board1 (0, 100, pos, singleton (0,4)))
board1 :: Board
board1 = fromList $ fmap fromList