From 6fe42b8840fd3508615e022cc65dad28a335abcd Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 15 Mar 2025 21:59:11 +0900 Subject: feat(frontend): enhance score bar ratio --- frontend/app/components/Gaming/ScoreBar.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'frontend/app/components') diff --git a/frontend/app/components/Gaming/ScoreBar.tsx b/frontend/app/components/Gaming/ScoreBar.tsx index 4eac3ad..cacdd50 100644 --- a/frontend/app/components/Gaming/ScoreBar.tsx +++ b/frontend/app/components/Gaming/ScoreBar.tsx @@ -14,7 +14,12 @@ export default function ScoreBar({ scoreA, scoreB, bgA, bgB }: Props) { } else if (scoreB === null) { scoreRatio = 100; } else { - scoreRatio = (scoreB / (scoreA + scoreB)) * 100; + const rawRatio = scoreB / (scoreA + scoreB); + const k = 3.0; + const emphasizedRatio = + Math.pow(rawRatio, k) / + (Math.pow(rawRatio, k) + Math.pow(1 - rawRatio, k)); + scoreRatio = emphasizedRatio * 100; } return ( -- cgit v1.2.3-70-g09d2