From 156c6db9d264b37a4a1de193a357ea83f8776ffb Mon Sep 17 00:00:00 2001 From: Andre Padez Date: Sun, 2 Nov 2025 16:55:46 +0000 Subject: [PATCH] feat: display optimalSteps and efficiency metrics on scoreboard - Show optimal steps required for the maze - Display player efficiency percentage (100% = perfect play) - Metrics appear after maze loads (when optimalSteps > 0) - Separated from final score with visual divider - Helps players understand their navigation performance --- example/src/App.tsx | 59 +++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/example/src/App.tsx b/example/src/App.tsx index cb89a9a..45c2c98 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -10,7 +10,7 @@ function App() { const gameManager = useGame({ cols, rows }, useKeyBindings); const { containerRef, gameStatus, scoreManager } = gameManager; - const { timeValue, keystrokes, finalScore } = scoreManager; + const { timeValue, keystrokes, optimalSteps, efficiency, finalScore } = scoreManager; const formatTime = (ms: number) => { const seconds = Math.floor(ms / 1000); @@ -23,28 +23,41 @@ function App() {

VIMazing vim-maze v{version} example

- {(gameStatus === "started" || gameStatus === "has-key" || gameStatus === "game-won") && ( -
-
-
Time
-
{formatTime(timeValue)}
-
-
-
Keystrokes
-
{keystrokes}
-
- {gameStatus === "game-won" && finalScore && ( - <> -
-
-
Final Score
-
{finalScore}
-
- - )} -
- )} -
+ {(gameStatus === "started" || gameStatus === "has-key" || gameStatus === "game-won") && ( +
+
+
Time
+
{formatTime(timeValue)}
+
+
+
Keystrokes
+
{keystrokes}
+
+ {optimalSteps > 0 && ( + <> +
+
+
Optimal Steps
+
{optimalSteps}
+
+
+
Efficiency
+
{efficiency}%
+
+ + )} + {gameStatus === "game-won" && finalScore && ( + <> +
+
+
Final Score
+
{finalScore}
+
+ + )} +
+ )} +