Keep won tricks in front of the player who took them
A trick slid off towards its winner and stopped existing. Where it went was the only record that it had been won at all, and by the third trick of a hand there was nothing on the table to say who was sitting on what — which on a real table is the most-glanced-at thing in the game, and the whole reason cards are gathered rather than binned. Each player now has a face-down pile in front of them: one card back per trick, because a trick is squared into a single bundle and put down, and from above that is what you see. The piles sit beside each player's own card, one place clockwise along their edge, which is both where a player would actually put them and the one spot on each edge nothing else was using. Wizard seats three to six so its piles go half a seat clockwise round the same ring the cards are played on. The count follows the cards, not the rules. A trick is counted the instant its last card is played, which is a beat before the gather and two before the cards arrive; reading the state directly grew the winner's pile while the trick was still lying in the middle of the table, and the cards then slid over and landed on a pile that had already counted them. rememberArrivedTricks holds the count back until the sweep has actually run. The sweep changes to suit its new destination. A gathered card is squared down towards the size of the bundle it is joining, and stays whole until the last stretch instead of fading the whole way over: it now vanishes at the same moment the pile grows by one, and that swap is only invisible if there was something there to swap. Kaiser needed a per-seat trick count, which it had never had — it scores in points, so no rule wanted one. It is defaulted for the wire and carries a test, because a field no rule depends on is a field that can quietly stop being maintained. Hearts already keeps the cards themselves and counts them by the deal. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_0132V9gE6DF9itz2z3Hn7BK9
This commit is contained in:
@@ -92,6 +92,14 @@ data class KaiserState(
|
||||
val lastTrickWinner: Int?,
|
||||
/** Points taken this hand, per team. */
|
||||
val handPoints: List<Int>,
|
||||
/**
|
||||
* Tricks taken this hand, per seat. Kaiser scores in points rather than
|
||||
* tricks, so nothing in the rules needs this — it is what the table draws
|
||||
* in front of each player, and a player who has taken four tricks and no
|
||||
* counters has still taken four tricks. Defaulted so a client on an older
|
||||
* build can still read a state from the wire.
|
||||
*/
|
||||
val tricksWon: List<Int> = List(4) { 0 },
|
||||
val scores: List<Int>,
|
||||
val log: List<String>,
|
||||
)
|
||||
|
||||
@@ -62,6 +62,7 @@ object KaiserRules : GameRules<KaiserState, KaiserMove> {
|
||||
leader = (dealer + 1) % 4,
|
||||
lastTrickWinner = null,
|
||||
handPoints = listOf(0, 0),
|
||||
tricksWon = List(4) { 0 },
|
||||
scores = scores,
|
||||
log = log,
|
||||
)
|
||||
@@ -224,10 +225,14 @@ object KaiserRules : GameRules<KaiserState, KaiserMove> {
|
||||
val handPoints = played.handPoints.toMutableList()
|
||||
handPoints[teamOf(winner)] = handPoints[teamOf(winner)] + points
|
||||
|
||||
val tricksWon = played.tricksWon.toMutableList()
|
||||
tricksWon[winner] = tricksWon[winner] + 1
|
||||
|
||||
val afterTrick = played.copy(
|
||||
trick = emptyList(),
|
||||
completedTrick = trick,
|
||||
handPoints = handPoints,
|
||||
tricksWon = tricksWon,
|
||||
leader = winner,
|
||||
turn = winner,
|
||||
lastTrickWinner = winner,
|
||||
|
||||
Reference in New Issue
Block a user