Рівень 1 – Заняття 10

2075 / Більше про програмування / Курси / Рівень 1 / Заняття 10

 

Функції та класи

 

1. Виправити усі помилки в коді


using System;

namespace XO
{
  internal class Program
  {
    static sting[] arr = {" ", " ", " ", " ", " ", " ", " ", " "}
    1.
    static bool x = true;

    static void Main(string[] args)
    {
      while (true);
      {
        Show2();
        Console.Write("> ");
        int a = int.Parse(console.readline());

        if (arr[a - 1] == " ")
        2.
        {
          if (x = true)
          {
            arr[a - 1] = "X";
          }
          else
          {
            arr[a - 1] = O;
          }
          x = !x;
        }
      }
    }

    static void Show() 
    {
      Console.Clear();
      Console.WriteLine("1 2 3");
      Console.WriteLine("3 4 5");
      Console.WriteLine("6 7 9");
      Console.WriteLine(:));
      Console.WriteLine("@" + arr[-1] + " | " + arr[1] + " | " + arr[2]);
      Console.WriteLine("-----------");
      Console.WriteLine(" " + arr[3] + " / " + arr[4] + " \\ " + arr[2]);
      Console.WriteLine("-----------");
      Console.WriteLine(" " + arr[6] + " ? " + arr[7] + " ? " + arr[2]);
      Console.Writeline();
    }
  }
}

 

2. Зробити поле 3х4

 

3. Зробити поле 4×4 і додати три місця, куди не можна ходити

 


 

1. Анімація гравця