-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from cassioegc/vini
Adicionando algumas funcoes
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
data Player = Player { | ||
points :: Int, | ||
lifes :: Int, | ||
nickname :: String, | ||
chooseLetter :: Bool, | ||
typeWord :: Bool, | ||
synonyms :: Bool, | ||
syllables :: Bool | ||
} deriving (Show, Read) | ||
|
||
data Level = Level { | ||
name :: String | ||
} | ||
|
||
inicializeBonus :: Player -> Player | ||
inicializeBonus gamer = Player { | ||
points = points gamer, | ||
lifes = lifes gamer, | ||
nickname = nickname gamer, | ||
chooseLetter = True, | ||
typeWord = True, | ||
synonyms = True, | ||
syllables = True | ||
} | ||
|
||
setBonus :: Player -> String -> Bool -> Player | ||
setBonus gamer kind value = | ||
| kind EQ "choose_letter" = Player { | ||
points = points gamer, | ||
lifes = lifes gamer, | ||
nickname = nickname gamer, | ||
chooseLetter = value, | ||
typeWord = typeWord gamer, | ||
synonyms = synonyms gamer, | ||
syllables = syllables gamer | ||
} | ||
| kind EQ "type_word" = Player { | ||
points = points gamer, | ||
lifes = lifes gamer, | ||
nickname = nickname gamer, | ||
chooseLetter = chooseLetter gamer, | ||
typeWord = value, | ||
synonyms = synonyms gamer, | ||
syllables = syllables gamer | ||
} | ||
| kind EQ "synonyms" = Player { | ||
points = points gamer, | ||
lifes = lifes gamer, | ||
nickname = nickname gamer, | ||
chooseLetter = chooseLetter gamer, | ||
typeWord = typeWord gamer, | ||
synonyms = value, | ||
syllables = syllables gamer | ||
} | ||
| kind EQ "syllables" = Player { | ||
points = points gamer, | ||
lifes = lifes gamer, | ||
nickname = nickname gamer, | ||
chooseLetter = chooseLetter gamer, | ||
typeWord = typeWord gamer, | ||
synonyms = synonyms gamer, | ||
syllables = value | ||
} |