From 9d8f59779245f2accedf6931c33ce4d662a0eee8 Mon Sep 17 00:00:00 2001 From: LQ63 Date: Thu, 23 Oct 2025 09:32:24 +0200 Subject: [PATCH] feat(ui): added rules added /rules to webui --- .../app/controllers/HomeController.scala | 6 +- knockoutwhistweb/app/views/main.scala.html | 5 ++ knockoutwhistweb/app/views/rules.scala.html | 61 +++++++++++++++++++ knockoutwhistweb/conf/routes | 2 + 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 knockoutwhistweb/app/views/rules.scala.html diff --git a/knockoutwhistweb/app/controllers/HomeController.scala b/knockoutwhistweb/app/controllers/HomeController.scala index bcdf17b..b60f978 100644 --- a/knockoutwhistweb/app/controllers/HomeController.scala +++ b/knockoutwhistweb/app/controllers/HomeController.scala @@ -41,7 +41,11 @@ class HomeController @Inject()(val controllerComponents: ControllerComponents) e Redirect("/sessions") } } - + def rules(): Action[AnyContent] = { + Action { implicit request => + Ok(views.html.rules.apply()) + } + } def sessions(): Action[AnyContent] = { Action { implicit request => Ok(views.html.sessions.apply(PodGameManager.listSessions())) diff --git a/knockoutwhistweb/app/views/main.scala.html b/knockoutwhistweb/app/views/main.scala.html index 091c4ac..fc87637 100644 --- a/knockoutwhistweb/app/views/main.scala.html +++ b/knockoutwhistweb/app/views/main.scala.html @@ -110,6 +110,11 @@ align-items: center; height: 100%; } + #rules { + color: white; + font-size: 1.5em; + font-family: Arial; + } diff --git a/knockoutwhistweb/app/views/rules.scala.html b/knockoutwhistweb/app/views/rules.scala.html new file mode 100644 index 0000000..60d351b --- /dev/null +++ b/knockoutwhistweb/app/views/rules.scala.html @@ -0,0 +1,61 @@ +@() + +@main("Rules") { +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Rules Overview and Equipment
SectionDetails
PlayersTwo to seven players. The aim is to be the last player left in the game.
AimTo be the last player left in at the end of the game, with the object in each hand being to win a majority of tricks.
EquipmentA standard 52-card pack is used.
Card RanksIn each suit, cards rank from highest to lowest: A K Q J 10 9 8 7 6 5 4 3 2.
Deal (First Hand)The dealer deals seven cards to each player. One card is turned up to determine the trump suit for the round.
Deal (Subsequent Hands)The deal rotates clockwise. The player who took the most tricks in the previous hand selects the trump suit. If there's a tie for the highest number of tricks, players cut cards to decide who calls trumps. One fewer card is dealt in each successive hand until the final hand consists of one card each.
PlayThe player to the dealer's left (eldest hand) leads the first trick. Any card can be led. Other players must follow suit if possible. A player with no cards of the suit led may play any card.
Winning a TrickThe highest card of the suit led wins, unless a trump is played, in which case the highest trump wins. The winner of the trick leads the next.
Leading TrumpsSome rules disallow leading trumps before the suit has been 'broken' (a trump has been played to the lead of another suit). Leading trumps is always permissible if a player holds only trumps.
KnockoutAt the end of each hand, any player who took no tricks is knocked out and takes no further part in the game.
Winning the GameThe game is won when a player takes all the tricks in a round, as all other players are knocked out, leaving only one player remaining.
+
+} \ No newline at end of file diff --git a/knockoutwhistweb/conf/routes b/knockoutwhistweb/conf/routes index fe99cc4..3d2cb6d 100644 --- a/knockoutwhistweb/conf/routes +++ b/knockoutwhistweb/conf/routes @@ -10,3 +10,5 @@ GET /sessions controllers.HomeController.sessions() GET /ingame/:id controllers.HomeController.ingame(id: String) # Map static resources from the /public folder to the /assets URL path GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset) + +GET /rules controllers.HomeController.rules()