Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication8
- {
- class Program
- {
- static void Main(string[] args)
- {
- int tom = 10, jerry = 40, move, total= 0;
- Random r = new Random();
- Console.WriteLine("Tom the cat will have the first turn");
- Console.Write("Press 'Enter' to continue... ");
- Console.ReadKey();
- while (tom > 0 && tom <= 50 && jerry > 0 && jerry <= 50 && tom != jerry)
- {
- Console.WriteLine("It's your turn Tom, press 'Enter' to randomize your move");
- Console.ReadKey();
- move = r.Next(-5, 6);
- tom += move;
- total++;
- Console.WriteLine("You're standing on place number " + tom);
- if (tom == jerry)
- {
- Console.Write("T");
- System.Threading.Thread.Sleep(50);
- Console.Write("o");
- System.Threading.Thread.Sleep(50);
- Console.Write("m");
- System.Threading.Thread.Sleep(50);
- Console.Write(" ");
- Console.Write("W");
- System.Threading.Thread.Sleep(50);
- Console.Write("i");
- System.Threading.Thread.Sleep(50);
- Console.Write("n");
- System.Threading.Thread.Sleep(50);
- Console.Write("s");
- System.Threading.Thread.Sleep(50);
- }
- else if (tom > 50 || tom < 1)
- {
- Console.WriteLine("Tom, you are out of the desk, sorry...");
- Console.ReadKey();
- }
- if (tom != jerry && tom > 0 && tom < 50)
- {
- Console.WriteLine("It's your turn Jerry, press 'Enter' to randomize your move");
- Console.ReadKey();
- move = r.Next(-5, 6);
- jerry += move;
- total++;
- Console.WriteLine("You're standing on place number " + jerry);
- if (jerry == tom)
- {
- Console.Write("J");
- System.Threading.Thread.Sleep(50);
- Console.Write("e");
- System.Threading.Thread.Sleep(50);
- Console.Write("r");
- System.Threading.Thread.Sleep(50);
- Console.Write("r");
- System.Threading.Thread.Sleep(50);
- Console.Write("y");
- System.Threading.Thread.Sleep(50);
- Console.Write(" ");
- Console.Write("W");
- System.Threading.Thread.Sleep(50);
- Console.Write("i");
- System.Threading.Thread.Sleep(50);
- Console.Write("n");
- System.Threading.Thread.Sleep(50);
- Console.Write("s");
- System.Threading.Thread.Sleep(50);
- }
- else if (jerry > 50 || jerry < 1)
- {
- Console.WriteLine("Jerry, you are out of the desk, sorry...");
- Console.ReadKey();
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment