Browse Source

vm fix

adaptedStrategy0
Slash 9 years ago
parent
commit
d56c2893c2
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      src/VM.hs

+ 3
- 1
src/VM.hs View File

@ -47,7 +47,7 @@ lockUnit :: Game -> Game
lockUnit game = game { lockUnit game = game {
board = newBoard, board = newBoard,
units = otherUnits, units = otherUnits,
visitedUnits = Set.empty,
visitedUnits = initialVisitedUnits otherUnits,
oldLines = clearedLines, oldLines = clearedLines,
score = Game.score game + newScore score = Game.score game + newScore
} where } where
@ -56,6 +56,8 @@ lockUnit game = game {
(newBoard, clearedLines) = Board.clearLines mergedBoard (newBoard, clearedLines) = Board.clearLines mergedBoard
size = Set.size $ Unit.members currentUnit size = Set.size $ Unit.members currentUnit
newScore = moveScore size clearedLines (Game.oldLines game) newScore = moveScore size clearedLines (Game.oldLines game)
initialVisitedUnits [] = Set.empty
initialVisitedUnits (u:us) = Set.singleton (hash u)
testStep = let unit = Unit (0, 0) (Set.fromList [(2,9)]) testStep = let unit = Unit (0, 0) (Set.fromList [(2,9)])
board = Board 5 10 (Set.fromList [(0,8),(1,8),(0,9),(1,9),(4,8),(3,9),(4,9)]) board = Board 5 10 (Set.fromList [(0,8),(1,8),(0,9),(1,9),(4,8),(3,9),(4,9)])


Loading…
Cancel
Save