Monaris 0.1.2 → 0.1.3
raw patch · 2 files changed
+8/−8 lines, 2 files
Files
- Monaris.cabal +2/−2
- Monaris.hs +6/−6
Monaris.cabal view
@@ -1,5 +1,5 @@ name: Monaris -version: 0.1.2 +version: 0.1.3 synopsis: A simple tetris clone description: A tetris clone written in Haskell. homepage: https://github.com/fumieval/Monaris/ @@ -7,7 +7,7 @@ license-file: LICENSE author: Fumiaki Kinishota maintainer: fumiexcel@gmail.com --- copyright: +copyright: Copyright (C) 2012-2013 Fumiaki Kinoshita category: Game build-type: Simple cabal-version: >=1.8
Monaris.hs view
@@ -141,7 +141,7 @@ else return False sp dir = do omino <- get - case filter (isJust . putF) $ map (flip (spin dir) omino) $ centers omino of + case filter (isJust . putF) $ map (flip (spin dir) omino) $ centers omino of [] -> return False xs -> put (spinStrategy omino field xs) >> return True @@ -182,15 +182,15 @@ , ?picCharWidth :: Float , ?picChars :: M.Map Char Picture , ?picBackground :: Picture, ?picBlockBackground :: Picture , ?highScore :: Int) - => Field -> Int -> Int -> (Polyomino, Color) -> (Polyomino, Color) -> Game Int -gameMain field total period (omino, color) next = do - r <- embed $ place omino color field period + => Field -> Int -> Float -> (Polyomino, Color) -> (Polyomino, Color) -> Game Int +gameMain field total line (omino, color) next = do + r <- embed $ place omino color field (floor $ 60 * 2**(-line/50)) case r of Nothing -> embed (gameOver field) >> return total Just field' -> do (field'', n) <- embed $ eliminate field' next' <- getPolyomino - gameMain field'' (total + n ^ 2) (max 1 $ period - n) next next' + gameMain field'' (total + n ^ 2) (line + fromIntegral n) next next' where embed (Pure a) = return a embed m = do @@ -271,7 +271,7 @@ let loop h = do let ?highScore = h _ <- gameTitle - score <- join $ gameMain initialField 0 60 <$> getPolyomino <*> getPolyomino + score <- join $ gameMain initialField 0 0 <$> getPolyomino <*> getPolyomino when (?highScore < score) $ embedIO $ writeFile highscorePath (show score) loop (max score ?highScore)