Skip to content

Commit

Permalink
fix issue #9 on kosmikus' fork (High score table, number of steps)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikolaj committed Jan 31, 2011
1 parent 96a3f1e commit de46aad
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/HighScores.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -61,18 +61,20 @@ instance Binary ScoreRecord where
-- | Show a single high score. -- | Show a single high score.
showScore :: (Int, ScoreRecord) -> String showScore :: (Int, ScoreRecord) -> String
showScore (pos, score) = showScore (pos, score) =
let won = if victor score let won = if victor score
then "emerged victorious" then "emerged victorious"
else "is camping on level " ++ show (current score) ++ "," else "is camping on level " ++ show (current score) ++ ","
died = if killed score died = if killed score
then "perished on level " ++ show (current score) ++ "," then "perished on level " ++ show (current score) ++ ","
else won else won
time = calendarTimeToString . toUTCTime . date $ score time = calendarTimeToString . toUTCTime . date $ score
big = " " big = " "
lil = " " lil = " "
-- TODO: later: https://github.com/kosmikus/LambdaHack/issues#issue/9
steps = negTurn score `div` (-10)
in in
printf "%s\n%4d. %6d This hero %s after %d steps \n%son %s. \n" printf "%s\n%4d. %6d This hero %s after %d steps \n%son %s. \n"
big pos (points score) died (- (negTurn score)) lil time big pos (points score) died steps lil time


-- | The list of scores, in decreasing order. -- | The list of scores, in decreasing order.
type ScoreTable = [ScoreRecord] type ScoreTable = [ScoreRecord]
Expand Down

0 comments on commit de46aad

Please sign in to comment.