Browse Source

power phrases fixes

vm
Slash 9 years ago
parent
commit
c4cb4e3876
3 changed files with 5 additions and 5 deletions
  1. +3
    -3
      src/Datatypes/Game.hs
  2. +1
    -1
      src/Strategy0.hs
  3. +1
    -1
      src/VM.hs

+ 3
- 3
src/Datatypes/Game.hs View File

@ -49,10 +49,10 @@ new b us = Game {
} where (c:cs) = map (flip Unit.centeredIn b) us
phraseConverter :: [Command] -> String
phraseConverter s = if s == [MoveE, MoveSW, MoveW]
phraseConverter s = if s == reverse [MoveE, MoveSW, MoveW]
then "ei!"
else if s == [MoveSW, MoveSW, MoveW, MoveSE, MoveSW, MoveSW, MoveW]
then "ia ! ia!"
else if s == reverse [MoveSW, MoveSW, MoveW, MoveSE, MoveSW, MoveSW, MoveW]
then "ia! ia!"
else "PUPPA"
powerPhrases :: [[Command]]


+ 1
- 1
src/Strategy0.hs View File

@ -58,7 +58,7 @@ tryPowerPhrases game = validResults where
findBest :: Int -> Queue -> [Game] -> (Queue, [Game])
findBest 0 queue completed = (queue, completed)
findBest i queue completed =
let candidates = map (step game) commandsList -- ++ (tryPowerPhrases game)
let candidates = (tryPowerPhrases game) ++ (map (step game) commandsList)
(newQueue, newCompleted) = updateCollections candidates remQueue (game:completed)
in findBest (i - 1) newQueue newCompleted
where


+ 1
- 1
src/VM.hs View File

@ -33,7 +33,7 @@ dumbConvert RotateClockwise = 'd'
dumbConvert RotateCounterclockwise = 'k'
smartConvert cmds = innerSmartConvert cmds Game.powerPhrases where
innerSmartConvert _ [] = Nothing
innerSmartConvert cmds (p:ps) = if p `List.isPrefixOf` cmds
innerSmartConvert cmds (p:ps) = if (reverse p) `List.isPrefixOf` cmds
then Just $ Game.phraseConverter p
else innerSmartConvert cmds ps


Loading…
Cancel
Save