public string CheckForValidHand(List <Card> _cards, bool hasFaceCard) { var returnMessage = ""; if (_cards.Count == 4 || _cards.Count == 6 || _cards.Count == 7) { returnMessage = "Fib numbers only. \nTry Again."; return(returnMessage); } if (_cards.Count > 2 && hasFaceCard && !Hand.HasFaceCardStatic(_cards)) { returnMessage = "Need to discard face card when discarding more than 2 cards. \nTry Again."; return(returnMessage); } if (CalculateScore.MatchScore(_cards) > 0) { returnMessage = "Can't discard Duplicates. \nTry Again."; return(returnMessage); } return(returnMessage); }
public void Play() { SetUpGame(); for (var turn = 0; turn < turnNumber; turn++) { foreach (Player player in players) { Console.Clear(); Console.WriteLine("Ready " + player.name); WaitForEnter(); Console.Clear(); Console.WriteLine(player.name + " turn: " + (turn + 1)); player.DisplayHand(); WaitForEnter(); Discarding(player); } } //preparing end game var finalHands = new Hand[numberPlayers]; for (var i = 0; i < numberPlayers; i++) { finalHands[i] = players[i].hand; } CalculateScore.RemoveFaceCards(finalHands, deck); foreach (Player player in players) { GameOver(player); } Console.ForegroundColor = ConsoleColor.Green; var winner = DetermineWinner.WhoWon(players); WaitForEnter(); ScrollingText.ScrollUp(winner.name + " won! with points: " + winner.currentScore + "\n"); ScrollingText.ScrollUp(winner.name + " won! with points: " + winner.currentScore + "\n"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Bye, bye now."); WaitForEnter(); }
public void GameOver(Player player) { Console.Clear(); player.DisplayHand(); Console.WriteLine("\n" + player.name + " Bonuses:\n"); player.currentScore = CalculateScore.Score(player.hand); player.currentScore += CalculateScore.FaceCardScore(player.hand); player.currentScore += CalculateScore.MatchScore(player.hand.cards); player.currentScore += CalculateScore.StraightScore(player.hand); Console.WriteLine("\nScore: " + player.currentScore + "\n"); WaitForEnter(); }