MuffinMonster

Class Task 13#

Oct 20th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication8
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int tom = 10, jerry = 40, move, total= 0;
  14.             Random r = new Random();
  15.             Console.WriteLine("Tom the cat will have the first turn");
  16.             Console.Write("Press 'Enter' to continue... ");
  17.             Console.ReadKey();
  18.             while (tom > 0 && tom <= 50 && jerry > 0 && jerry <= 50 && tom != jerry)
  19.             {
  20.                 Console.WriteLine("It's your turn Tom, press 'Enter' to randomize your move");
  21.                 Console.ReadKey();
  22.                 move = r.Next(-5, 6);
  23.                 tom += move;
  24.                 total++;
  25.                 Console.WriteLine("You're standing on place number " + tom);
  26.                 if (tom == jerry)
  27.                 {
  28.                     Console.Write("T");
  29.                     System.Threading.Thread.Sleep(50);
  30.                     Console.Write("o");
  31.                     System.Threading.Thread.Sleep(50);
  32.                     Console.Write("m");
  33.                     System.Threading.Thread.Sleep(50);
  34.                     Console.Write(" ");
  35.                     Console.Write("W");
  36.                     System.Threading.Thread.Sleep(50);
  37.                     Console.Write("i");
  38.                     System.Threading.Thread.Sleep(50);
  39.                     Console.Write("n");
  40.                     System.Threading.Thread.Sleep(50);
  41.                     Console.Write("s");
  42.                     System.Threading.Thread.Sleep(50);
  43.                 }
  44.                 else if (tom > 50 || tom < 1)
  45.                 {
  46.                     Console.WriteLine("Tom, you are out of the desk, sorry...");
  47.                     Console.ReadKey();
  48.                 }
  49.                 if (tom != jerry && tom > 0 && tom < 50)
  50.                 {
  51.                     Console.WriteLine("It's your turn Jerry, press 'Enter' to randomize your move");
  52.                     Console.ReadKey();
  53.                     move = r.Next(-5, 6);
  54.                     jerry += move;
  55.                 total++;
  56.                     Console.WriteLine("You're standing on place number " + jerry);
  57.                     if (jerry == tom)
  58.                     {
  59.                         Console.Write("J");
  60.                         System.Threading.Thread.Sleep(50);
  61.                         Console.Write("e");
  62.                         System.Threading.Thread.Sleep(50);
  63.                         Console.Write("r");
  64.                         System.Threading.Thread.Sleep(50);
  65.                         Console.Write("r");
  66.                         System.Threading.Thread.Sleep(50);
  67.                         Console.Write("y");
  68.                         System.Threading.Thread.Sleep(50);
  69.                         Console.Write(" ");
  70.                         Console.Write("W");
  71.                         System.Threading.Thread.Sleep(50);
  72.                         Console.Write("i");
  73.                         System.Threading.Thread.Sleep(50);
  74.                         Console.Write("n");
  75.                         System.Threading.Thread.Sleep(50);
  76.                         Console.Write("s");
  77.                         System.Threading.Thread.Sleep(50);
  78.                     }
  79.                     else if (jerry > 50 || jerry < 1)
  80.                     {
  81.                         Console.WriteLine("Jerry, you are out of the desk, sorry...");
  82.                         Console.ReadKey();
  83.                     }
  84.                 }
  85.             }
  86.         }
  87.     }
  88. }
Add Comment
Please, Sign In to add comment