Advertisement
Foibs

triliza unfinished

Nov 22nd, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     class Program
  6.     {
  7.  
  8.         static string[] pos = new string[9] { "0", "1", "2", "3", "4", "5", "6", "7", "8" };
  9.         static void print()
  10.         {
  11.             Console.WriteLine(" {0} | {1} | {2} ", pos[0], pos[1], pos[2]);
  12.             Console.WriteLine(" ----------");
  13.             Console.WriteLine(" {0} | {1} | {2} ", pos[3], pos[4], pos[5]);
  14.             Console.WriteLine(" ----------");
  15.             Console.WriteLine(" {0} | {1} | {2} ", pos[6], pos[7], pos[8]);
  16.         }
  17.         static void Main(string[] args)
  18.         {
  19.             print();
  20.             Console.WriteLine("\nPlayer 1: Chose a number to begin");
  21.             int i = int.Parse(Console.ReadLine());
  22.  
  23.             if(i > 0 && i < 8)
  24.             {
  25.                 pos[i] = "X";
  26.             }
  27.  
  28.             else
  29.             {
  30.                 Console.WriteLine("Wrong input, please try again");
  31.             }
  32.  
  33.             print();
  34.  
  35.             Console.WriteLine("\nPlayer 2: Chose a number to begin");
  36.             int j = int.Parse(Console.ReadLine());
  37.  
  38.             if (j > 0 && j < 8)
  39.             {
  40.                 pos[j] = "O";
  41.             }
  42.  
  43.             else
  44.             {
  45.                 Console.WriteLine("Wrong input, please try again");
  46.             }
  47.  
  48.             print();
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement