|
@ -1,5 +1,3 @@ |
|
|
{-# OPTIONS -Wall #-} |
|
|
|
|
|
|
|
|
|
|
|
module Strategy0 where |
|
|
module Strategy0 where |
|
|
|
|
|
|
|
|
import qualified Data.PQueue.Prio.Max as PQ |
|
|
import qualified Data.PQueue.Prio.Max as PQ |
|
@ -9,22 +7,19 @@ import Datatypes.Game (Command(..)) |
|
|
import qualified Datatypes.Game as Game |
|
|
import qualified Datatypes.Game as Game |
|
|
import VM |
|
|
import VM |
|
|
|
|
|
|
|
|
import Debug.Trace (trace) |
|
|
|
|
|
|
|
|
|
|
|
commandsList :: [Command] |
|
|
commandsList :: [Command] |
|
|
commandsList = [MoveSE, MoveSW, MoveW, MoveE] |
|
|
commandsList = [MoveSE, MoveSW, MoveW, MoveE] |
|
|
|
|
|
|
|
|
type Queue = PQ.MaxPQueue Int Game |
|
|
type Queue = PQ.MaxPQueue Int Game |
|
|
|
|
|
|
|
|
strat0 :: Game -> ([Command],Int) |
|
|
strat0 :: Game -> ([Command],Int) |
|
|
strat0 game | trace (show game) False = undefined |
|
|
|
|
|
strat0 game = let firstQueue = PQ.singleton (Game.score game) game |
|
|
strat0 game = let firstQueue = PQ.singleton (Game.score game) game |
|
|
(incomplete, completed) = findBest maxIter firstQueue [] |
|
|
(incomplete, completed) = findBest maxIter firstQueue [] |
|
|
(_, bestIncomplete) = PQ.findMax incomplete |
|
|
(_, bestIncomplete) = PQ.findMax incomplete |
|
|
resultGame = findListMax (bestIncomplete:completed) |
|
|
resultGame = findListMax (bestIncomplete:completed) |
|
|
in trace (show resultGame) (reverse (Game.history resultGame), Game.score resultGame) |
|
|
|
|
|
|
|
|
in (reverse (Game.history resultGame), Game.score resultGame) |
|
|
where |
|
|
where |
|
|
maxIter = 30000 |
|
|
|
|
|
|
|
|
maxIter = 50000 |
|
|
|
|
|
|
|
|
findListMax :: [Game] -> Game |
|
|
findListMax :: [Game] -> Game |
|
|
findListMax (x:xs) = innerFindListMax x xs where |
|
|
findListMax (x:xs) = innerFindListMax x xs where |
|
|