Browse Source

damn2

adaptedStrategy0
Slash 9 years ago
parent
commit
7e25735e87
1 changed files with 2 additions and 7 deletions
  1. +2
    -7
      src/Strategy0.hs

+ 2
- 7
src/Strategy0.hs View File

@ -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


Loading…
Cancel
Save