MartinEesmaa

Movement game of X and O

Feb 15th, 2022 (edited)
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Again_of_lesson_16th_February_2022
  7. {
  8.     class Program
  9.     {
  10.         public static void Main()
  11.         {
  12.             string[] move = { "_", "_", "_" };
  13.             while (true)
  14.             {
  15.                 for (int i = 0; i < 3; i++)
  16.                 {
  17.                     Console.WriteLine(move[i]);
  18.                 }
  19.                 Console.WriteLine(move);
  20.                 Console.WriteLine("Enter your move, 0  to 2");
  21.                 int input = Convert.ToInt32(Console.ReadLine());
  22.                 if (move[input] == "_")
  23.                 {
  24.                     move[input] = "X";
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.WriteLine("Invalid move");
  29.                 }
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment