Пример #1
0
 private void WriteOpenGroupMessage(Player player, TileGrouping groupFormed)
 {
     if (groupFormed.IsQuad())
     {
         Console.WriteLine($"{player.Name} says \"GONG.\"");
     }
     else if (groupFormed.IsTriplet())
     {
         Console.WriteLine($"{player.Name} says \"PUNG.\"");
     }
     else if (groupFormed.IsSequence())
     {
         Console.WriteLine($"{player.Name} says \"CHOW.\"");
     }
     Console.ReadKey();
     Console.WriteLine();
 }
Пример #2
0
        private void HandleClaimedDiscard(int indexOfStealingPlayer, Tile discardedTile, TileGrouping group)
        {
            var stealingPlayer = Round.GetPlayers()[indexOfStealingPlayer];

            WriteOpenGroupMessage(stealingPlayer, group);
            stealingPlayer.MakeGroupWithDiscardedTile(discardedTile, group);
            stealingPlayer.Hand.SortHand();
            mostRecentActionText = $"{stealingPlayer.Name} takes the discarded {discardedTile}.\n";
            if (group.IsQuad())
            {
                HandleClaimedDiscardForQuad(stealingPlayer);
            }
            else
            {
                WriteGameState();

                bool hasDiscardedTile = false;
                while (!hasDiscardedTile)
                {
                    hasDiscardedTile = HandleTurnAction(stealingPlayer);
                }
            }
        }