diff --git a/src/Koogle.Application/Games/GameProgress.cs b/src/Koogle.Application/Games/GameProgress.cs
index fbb556b..53dae84 100644
--- a/src/Koogle.Application/Games/GameProgress.cs
+++ b/src/Koogle.Application/Games/GameProgress.cs
@@ -21,13 +21,15 @@ public record BeforeThrowState(
/// Whether a circle (Kranz) was scored.
/// Whether all 9 pins were knocked down.
/// Whether the throw was a gutter (Rinne).
+/// Whether all remaining pins are hit (Abgeräumt).
public record AfterThrowState(
ThrowPanelSnapshot ThrowPanel,
Guid CurrentPlayerId,
int PinsKnocked,
bool IsCircle,
bool IsStrike,
- bool IsGutter
+ bool IsGutter,
+ bool IsCleared
);
///
@@ -81,7 +83,7 @@ public record ThrowPanelSnapshot
ThrowCounterPerRound = throwCounterPerRound,
TotalThrowCounter = totalThrowCounter,
ThrowMode = throwMode,
- BellValue = bellValue
+ BellValue = bellValue,
};
}
@@ -102,6 +104,15 @@ public static class GameProgressExtensions
public static int StandingPinCount(this ThrowPanelSnapshot snapshot)
=> snapshot.Pins.Count(p => p == PinStatus.Standing);
+ ///
+ /// No remaining pins, no matter if others are fallen or disabled
+ ///
+ ///
+ ///
+ public static bool IsCleared(this ThrowPanelSnapshot snapshot)
+ => snapshot.Pins.Count(p => p == PinStatus.Standing) == 0;
+
+
///
/// Checks if a circle (Kranz) was scored - 8 outer pins down, center standing.
/// Pin layout: 1=top, 5=center, 9=bottom
@@ -127,10 +138,10 @@ public static class GameProgressExtensions
}
///
- /// Checks if all 9 pins were knocked down (strike).
+ /// Checks if all 9 pins were knocked down (strike) in a single throw.
///
public static bool IsStrike(this ThrowPanelSnapshot snapshot)
- => snapshot.Pins.All(p => p == PinStatus.Fallen);
+ => snapshot.Pins.All(p => p == PinStatus.Fallen) && snapshot.PinCount() == 9;
///
/// Checks if no pins were knocked down (gutter/Rinne).
@@ -167,7 +178,8 @@ public static class GameProgressExtensions
PinsKnocked: pinsKnocked,
IsCircle: afterThrow.IsCircle(),
IsStrike: afterThrow.IsStrike(),
- IsGutter: isGutter
+ IsGutter: isGutter,
+ IsCleared: afterThrow.IsCleared()
);
}
}
diff --git a/src/Koogle.Application/Games/Training/TrainingGameLogicService.cs b/src/Koogle.Application/Games/Training/TrainingGameLogicService.cs
index 3516069..4fc914d 100644
--- a/src/Koogle.Application/Games/Training/TrainingGameLogicService.cs
+++ b/src/Koogle.Application/Games/Training/TrainingGameLogicService.cs
@@ -58,6 +58,11 @@ public class TrainingGameLogicService : IGameLogicService
stats.GutterCount++;
}
+ if (afterThrow.IsCleared)
+ {
+ stats.ClearedCount++;
+ }
+
// Determine if player should rotate (round complete)
var shouldRotate = afterThrow.ThrowPanel.IsRoundComplete();
diff --git a/src/Koogle.Application/Games/Training/TrainingGameModel.cs b/src/Koogle.Application/Games/Training/TrainingGameModel.cs
index 28663e7..3f39b5d 100644
--- a/src/Koogle.Application/Games/Training/TrainingGameModel.cs
+++ b/src/Koogle.Application/Games/Training/TrainingGameModel.cs
@@ -21,6 +21,11 @@ public record TrainingPlayerStats
///
public int ThrowCount { get; set; }
+ ///
+ /// Total number of pins have been cleared.
+ ///
+ public int ClearedCount { get; set; }
+
///
/// Total number of pins knocked down.
///
diff --git a/src/Koogle.Web/Components/Game/Training/TrainingBoard.razor b/src/Koogle.Web/Components/Game/Training/TrainingBoard.razor
index 7686ec7..9799390 100644
--- a/src/Koogle.Web/Components/Game/Training/TrainingBoard.razor
+++ b/src/Koogle.Web/Components/Game/Training/TrainingBoard.razor
@@ -13,10 +13,10 @@
@inject IState DayState
-
+ @*
Training - Tafel
-
+ *@
@if (_playerStats.Count == 0)
{
@@ -36,16 +36,19 @@
Spieler
Würfe
Kegel
+ Abgeräumt
Kränze
- Strikes
- Rinnen
+ alle 9
+ Gossen
⌀
@if (context.IsCurrentPlayer)
{
-
+
@context.PlayerName
@@ -58,6 +61,7 @@
@context.ThrowCount
@context.PinCount
+ @context.ClearedCount
@if (context.CircleCount > 0)
{
@@ -180,6 +184,7 @@
PlayerId = playerId,
PlayerName = playerName,
ThrowCount = stats.ThrowCount,
+ ClearedCount = stats.ClearedCount,
PinCount = stats.PinCount,
CircleCount = stats.CircleCount,
StrikeCount = stats.StrikeCount,
@@ -208,6 +213,7 @@
public Guid PlayerId { get; init; }
public string PlayerName { get; init; } = "";
public int ThrowCount { get; init; }
+ public int ClearedCount { get; init; }
public int PinCount { get; init; }
public int CircleCount { get; init; }
public int StrikeCount { get; init; }