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