Exemple #1
0
        public void move(ref IBoard board)
        {
            Console.WriteLine("### TURN FOR " + name.ToUpper() + " ###\n");

            for(;;)
            {
                Position position;

                try
                {
                    Console.Write("Move Row: ");
                    position.row = int.Parse(Console.ReadLine());
                    Console.Write("Move Column:");
                    position.column = int.Parse(Console.ReadLine());

                    if (board.move(this, position))
                    {
                        break;
                    }
                    else
                    {
                        Console.WriteLine("\nInvalid Move, Try Again :)\n");
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("\nInvalid Move, Try Again :)\n");
                }

            }
        }
Exemple #2
0
        public void move(ref IBoard board)
        {
            for (;;)
            {
                Position position;
                Random random = new Random();

                position.row = random.Next(0, 3);
                position.column = random.Next(0, 3);

                if (board.move(this, position))
                {
                    Console.WriteLine("Bot moved to (" + position.row + ", " + position.column + ")");
                    break;
                }
            }
        }