Esempio n. 1
0
        private bool validDiaganalMove(Location too, Board board)
        {
            bool     occupied;
            bool     inReach;
            Occupant O = new Occupant(board);

            if (O.Team(too) == 'X')
            {
                occupied = false;
            }
            else
            {
                occupied = true;
                Console.WriteLine("someone else is all ready there");
                return(false);
            }
            if (this.Local.Add(1, 1 * this.Direction).Equals(too))
            {
                inReach = true;
            }
            else if (this.Local.Add(-1, 1 * Direction).Equals(too))
            {
                inReach = true;
            }
            else
            {
                inReach = false;
                Console.WriteLine("That is not in reach");
                return(false);
            }
            if (inReach & !occupied)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public static void Print(Board board)
        {
            Console.WriteLine();
            Occupant O = new Occupant(board);

            for (int row = 8; row > 0; row--)
            {
                Console.Write("|");
                for (int col = 1; col < 9; col++)
                {
                    if (O.Team(col, row) == 'X')
                    {
                        Console.Write(" |");
                    }
                    else
                    {
                        Console.Write(O.Team(col, row) + "|");
                    }
                }
                Console.WriteLine("\n - - - - - - - -");
            }
            Console.WriteLine();
        }