From 62a1a0c92068a490bc04388f2621d11c4dad388b Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Tue, 12 Sep 2023 08:40:30 -0400 Subject: [PATCH] edit(hanabi)!: increase hanabi payout function --- aincrad/tests.py | 6 +++--- hanabi/models.py | 2 +- hanabi/templates/hanabi/hanabicontest_list.html | 10 ++++------ hanabi/tests.py | 2 +- rpg/templates/rpg/meters/spades.html | 6 ++++++ 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/aincrad/tests.py b/aincrad/tests.py index 8f45efa9..c9974ca3 100644 --- a/aincrad/tests.py +++ b/aincrad/tests.py @@ -562,13 +562,13 @@ def test_hanabi_contest(self) -> None: ) self.assertEqual(len(resp.json()["names"]), 9) self.assertAlmostEqual( - HanabiReplay.objects.get(replay_id=812).spades_score, 4.0 + HanabiReplay.objects.get(replay_id=812).spades_score, 6.0 ) self.assertAlmostEqual( - HanabiReplay.objects.get(replay_id=811).spades_score, 3.0 + HanabiReplay.objects.get(replay_id=811).spades_score, 5.0 ) self.assertAlmostEqual( - HanabiReplay.objects.get(replay_id=271).spades_score, 0.6328125 + HanabiReplay.objects.get(replay_id=271).spades_score, 1.265625 ) self.assertEqual(HanabiParticipation.objects.all().count(), 9) self.assertEqual( diff --git a/hanabi/models.py b/hanabi/models.py index bbc6f45d..931b5db0 100644 --- a/hanabi/models.py +++ b/hanabi/models.py @@ -140,7 +140,7 @@ def get_absolute_url(self) -> str: def get_base_spades(self) -> float: num_suits = self.contest.num_suits - return 2 * (self.game_score / (5 * num_suits)) ** num_suits + return 4 * (self.game_score / (5 * num_suits)) ** 4 class HanabiParticipation(models.Model): diff --git a/hanabi/templates/hanabi/hanabicontest_list.html b/hanabi/templates/hanabi/hanabicontest_list.html index 9820aab2..2796e5b7 100644 --- a/hanabi/templates/hanabi/hanabicontest_list.html +++ b/hanabi/templates/hanabi/hanabicontest_list.html @@ -191,13 +191,11 @@

Contest Format

  • You earn - \[ 2 \cdot \left( - \frac{ \text{your game score} } - { 5 \cdot \text{number of suits} } - \right)^{ \text{number of suits} } \] + \[ 4 \cdot \left( \frac{ \text{your game score} } + { 5 \cdot \text{number of suits} } \right)^4 \] spades. For example, if you score 23/25, - you earn $2 \cdot (23/25)^5 \approx 1.318$ spades. + you earn $4 \cdot (23/25)^4 \approx 2.866$ spades.
  • In addition, you get +1 bonus spade if you have the @@ -209,7 +207,7 @@

    Contest Format

    and the lowest turn count among such teams.
  • - Thus, the maximum possible spades per contest is $2+1+1=4$. + Thus, the maximum possible spades per contest is $4+1+1=6$. Here, a "participating team" is any team that has at least one OTIS student. diff --git a/hanabi/tests.py b/hanabi/tests.py index 218d972f..d296baa3 100644 --- a/hanabi/tests.py +++ b/hanabi/tests.py @@ -38,7 +38,7 @@ def test_contest(self) -> None: self.assertEqual(contest.max_score, 25) replay = HanabiReplayFactory.create(contest=contest, game_score=23) - self.assertAlmostEqual(replay.get_base_spades(), 1.3181630464) + self.assertAlmostEqual(replay.get_base_spades(), 2.86557184) class HanabiViewTests(EvanTestCase): diff --git a/rpg/templates/rpg/meters/spades.html b/rpg/templates/rpg/meters/spades.html index d3519997..8ec19039 100644 --- a/rpg/templates/rpg/meters/spades.html +++ b/rpg/templates/rpg/meters/spades.html @@ -56,6 +56,12 @@ Varies + + + Hanabi + + 0♠ - 6♠ +

    The above list is not exhaustive; spades can be awarded for other things too.