public void computerThrows() { if (userAttacks) { if (currentDeck.Cards.Count % 2 == 1) { Card thrown = currentDeck.Cards[currentDeck.Cards.Count - 1]; Card cover = computerDeck.GetCover(thrown, kozr); if (cover == null) { Collect(); info = "Computer collected"; } else { currentDeck.AddCard(cover); computerDeck.Remove(cover); } } } else { if (currentDeck.Cards.Count == 0) { Card c = computerDeck.minCard( ); currentDeck.AddCard(c); computerDeck.Remove(c); } if (currentDeck.Cards.Count % 2 == 0) { bool canThrow = false; foreach (Card c in computerDeck.Cards) { if (currentDeck.Cards.Count == 0 || currentDeck.HasRank(c.Rank)) { currentDeck.AddCard(c); computerDeck.Remove(c); canThrow = true; break; } } if (!canThrow) { Bita(); } } } if (kolod.Cards.Count == 0 && computerDeck.Cards.Count == 0) { GameOver(); info = "Game is over. Computer has won"; } }