From 25837857ca9a1cb9cd64b668c1e55b2920921e5f Mon Sep 17 00:00:00 2001 From: ashleystrahle Date: Sat, 9 Jul 2022 21:36:51 +1000 Subject: [PATCH] update --- StripJackNaked/Program.cs | 56 ++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/StripJackNaked/Program.cs b/StripJackNaked/Program.cs index 5e617cf..b105494 100644 --- a/StripJackNaked/Program.cs +++ b/StripJackNaked/Program.cs @@ -7,39 +7,18 @@ namespace StripJackNaked public const int PlayerCount = 2; } - public class Kitty + internal class Kitty { public static List Pile = new(); } - public class Player + internal class Player { public List Hand = new(); } - class Program + internal class Program { - public static int NextPlayer(int CurrentPlayer) { return ++CurrentPlayer % Constants.PlayerCount; } - - public static bool PlayCard(List From) { return Actions.MoveCard(From, Kitty.Pile); } - - public static void TakePile(List Winner) - { - while (Kitty.Pile.Count() > 0) - { - _ = Actions.MoveCard(Kitty.Pile, Winner); - } - } - - public static void ShowList(List Cards) - { - foreach (Card card in Cards) - { - Console.Write(card.NamedValue + ((card == Cards.LastOrDefault()) ? "" : ", ")); - } - Console.WriteLine(); - } - private static void Main() { // Init players @@ -63,7 +42,7 @@ namespace StripJackNaked // Init first round int CardsToDraw = 1; - Card ActivePictureCard = null; + Card? ActivePictureCard = null; int ActivePlayer = 0; // Player 0 goes first @@ -113,5 +92,32 @@ namespace StripJackNaked } Console.WriteLine("Player " + NextPlayer(ActivePlayer) + " Won!"); } + + private static int NextPlayer(int CurrentPlayer) + { + return ++CurrentPlayer % Constants.PlayerCount; + } + + private static bool PlayCard(List From) + { + return Actions.MoveCard(From, Kitty.Pile); + } + + private static void TakePile(List Winner) + { + while (Kitty.Pile.Count() > 0) + { + _ = Actions.MoveCard(Kitty.Pile, Winner); + } + } + + private static void ShowList(List Cards) + { + foreach (Card card in Cards) + { + Console.Write(card.NamedValue + ((card == Cards.LastOrDefault()) ? "" : ", ")); + } + Console.WriteLine(); + } } } \ No newline at end of file