Ejemplo n.º 1
0
        public char[,] Contact(char[,] sch)
        {
            Pole Pl = new Pole();
            bool d = true;
            int  x = 0, y = 0, x1 = 0, y1 = 0;
            char buf = 'r';

            while (d)
            {
                switch (Console.ReadKey(true).Key)
                {
                case ConsoleKey.UpArrow:
                    if (x != 0)
                    {
                        sch[x, y] = buf;
                        x1        = x;
                        y1        = y;
                        x--;
                        buf       = sch[x, y];
                        sch[x, y] = '⃞';
                        Console.Clear();
                        Pl.Vivod(sch);
                    }
                    break;

                case ConsoleKey.DownArrow:
                    if (x != 7)
                    {
                        sch[x, y] = buf;
                        x1        = x;
                        y1        = y;
                        x++;
                        buf       = sch[x, y];
                        sch[x, y] = '⃞';
                        Console.Clear();
                        Pl.Vivod(sch);
                    }
                    break;

                case ConsoleKey.LeftArrow:
                    if (y != 0)
                    {
                        sch[x, y] = buf;
                        x1        = x;
                        y1        = y;
                        y--;
                        buf       = sch[x, y];
                        sch[x, y] = '⃞';
                        Console.Clear();
                        Pl.Vivod(sch);
                    }
                    break;

                case ConsoleKey.RightArrow:
                    if (y != 7)
                    {
                        sch[x, y] = buf;
                        x1        = x;
                        y1        = y;
                        y++;
                        buf       = sch[x, y];
                        sch[x, y] = '⃞';
                        Console.Clear();
                        Pl.Vivod(sch);
                    }
                    break;

                case ConsoleKey.Enter:

                    d = false;
                    break;

                default:
                    Console.WriteLine("Неверная клавиша попробуйте ещё раз!");
                    break;
                }
            }
            Figuri Fg = new Figuri();

            Fg.Peshka(sch, x, y, x1, y1);
            return(sch);
        }