private void PlayCard(int index)
        {
            var card = Hand.GetAt(index);

            if (card == null)
            {
                return;
            }

            var lastPlayedCard = LocationPile.Cards.LastOrDefault();

            if (lastPlayedCard != null && card.Suit == lastPlayedCard.Suit)
            {
                return;
            }

            Hand.RemoveAt(index);
            LocationPile.Add(card);

            if (LocationPile.CheckDoorUnlocked())
            {
                var door = Deck.FindDoor(lastPlayedCard.Color);
                if (door != null)
                {
                    DoorPile.Add(door);
                }
                bool win;
                if (CheckGameOver(out win))
                {
                    return;
                }
            }

            DrawUp();
        }
 public OnirimGame()
 {
     DiscardPile  = new DiscardPile();
     LocationPile = new LocationPile();
     LimboPile    = new LimboPile();
     DoorPile     = new DoorPile();
     Hand         = new Hand();
     Deck         = new Deck();
 }
 private void Print()
 {
     Console.Clear();
     DiscardPile.Print();
     LimboPile.Print();
     DoorPile.Print();
     LocationPile.Print();
     Hand.Print();
     Deck.Print();
 }
        private void ResolveDoorCard(DoorCard doorCard)
        {
            var matchingKey = Hand.Cards.FirstOrDefault(p => p.Suit == LocationSuit.Key && p.Color == doorCard.Color);

            if (matchingKey != null)
            {
                PrintUserOption("Do you want to use a key to open the door? (Y/N)");
                var key = Console.ReadKey(true);
                if (key.Key == ConsoleKey.Y)
                {
                    Hand.Remove(matchingKey);
                    DiscardPile.Add(matchingKey);
                    DoorPile.Add(doorCard);
                    return;
                }
            }

            LimboPile.Add(doorCard);
        }