mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
Solitaire: Award bonus points based on time elapsed
The exact formula used for bonus points seems to vary by implementation. This uses Klondike Solitaire's formula: https://en.wikipedia.org/wiki/Klondike_(solitaire)#Scoring
This commit is contained in:
parent
0f80e9e4db
commit
5d4cca7e0c
Notes:
sideshowbarker
2024-07-18 17:23:55 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/5d4cca7e0c7 Pull-request: https://github.com/SerenityOS/serenity/pull/7464
1 changed files with 11 additions and 3 deletions
|
@ -115,9 +115,17 @@ int main(int argc, char** argv)
|
|||
if (timer->is_active())
|
||||
timer->stop();
|
||||
|
||||
if ((reason == Solitaire::GameOverReason::Victory) && (score > high_score)) {
|
||||
update_high_score(score);
|
||||
statusbar.set_text(1, String::formatted("High Score: {}", high_score));
|
||||
if (reason == Solitaire::GameOverReason::Victory) {
|
||||
if (seconds_elapsed >= 30) {
|
||||
uint32_t bonus = (20'000 / seconds_elapsed) * 35;
|
||||
statusbar.set_text(0, String::formatted("Score: {} (Bonus: {})", score, bonus));
|
||||
score += bonus;
|
||||
}
|
||||
|
||||
if (score > high_score) {
|
||||
update_high_score(score);
|
||||
statusbar.set_text(1, String::formatted("High Score: {}", high_score));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue