Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. Player player = new Player();
  6. Player ai = new Player();
  7.  
  8. ai.Roll();
  9. player.Roll();
  10.  
  11. Console.WriteLine("AI has thrown: " + ai.scores + " Sum of scores: " + ai.totalScore);
  12. Console.WriteLine("You have thrown: " + player.scores + " Sum of scores: " + player.totalScore);
  13.  
  14. if (player.totalScore > ai.totalScore)
  15. Console.WriteLine("You win! Congratulations!");
  16. else if (ai.totalScore > player.totalScore)
  17. Console.WriteLine("You lose... Try again =)");
  18. else
  19. Console.WriteLine("Wow. It's draw.");
  20.  
  21. Console.ReadLine();
  22. }
  23.  
  24. public class Player
  25. {
  26. public string scores;
  27. public int totalScore;
  28. Random rnd = new Random();
  29.  
  30. public void Roll()
  31. {
  32. int tmp = rnd.Next(1, 7);
  33. scores += Convert.ToString(tmp);
  34. totalScore += tmp;
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement