Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- Player player = new Player();
- Player ai = new Player();
- ai.Roll();
- player.Roll();
- Console.WriteLine("AI has thrown: " + ai.scores + " Sum of scores: " + ai.totalScore);
- Console.WriteLine("You have thrown: " + player.scores + " Sum of scores: " + player.totalScore);
- if (player.totalScore > ai.totalScore)
- Console.WriteLine("You win! Congratulations!");
- else if (ai.totalScore > player.totalScore)
- Console.WriteLine("You lose... Try again =)");
- else
- Console.WriteLine("Wow. It's draw.");
- Console.ReadLine();
- }
- public class Player
- {
- public string scores;
- public int totalScore;
- Random rnd = new Random();
- public void Roll()
- {
- int tmp = rnd.Next(1, 7);
- scores += Convert.ToString(tmp);
- totalScore += tmp;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement