Пример #1
0
        public OthelloBoard(OthelloBoard i_Board)
        {
            m_BoardSize    = i_Board.M_BoardSize;
            m_OthelloBoard = new Point[m_BoardSize, m_BoardSize];

            char maxBoardLatitude = (char)('A' + m_BoardSize);

            for (int i = 0; i < m_BoardSize; i++)
            {
                for (char c = 'A'; c < maxBoardLatitude; c++)
                {
                    m_OthelloBoard[i, (int)(c - 'A')] = new Point(i + 1, c, i_Board.m_OthelloBoard[i, (int)(c - 'A')].M_CellValue);
                }
            }
        }
Пример #2
0
        ////public static void PrintBoard(OthelloBoard i_OthelloBoard)
        ////{
        ////    for (int i = 0; i < i_OthelloBoard.m_BoardSize; i++)
        ////    {
        ////        if (i == 0)
        ////        {
        ////            if (i_OthelloBoard.m_BoardSize == 8)
        ////            {
        ////                Console.WriteLine("    A   B   C   D   E   F   G   H");
        ////                Console.WriteLine("  =================================");
        ////            }
        ////            else
        ////            {
        ////                Console.WriteLine("    A   B   C   D   E   F");
        ////                Console.WriteLine("  =========================");
        ////            }
        ////        }

        ////        for (char c = 'A'; c < (char)('A' + i_OthelloBoard.m_BoardSize); c++)
        ////        {
        ////            if (c == 'A')
        ////            {
        ////                string outputMessage = string.Format("{0} | {1} |", i + 1, i_OthelloBoard.m_OthelloBoard[i, c - 'A'].M_CellValue);
        ////                Console.Write(outputMessage);
        ////            }
        ////            else
        ////            {
        ////                string outputMessage = string.Format(" {0} |", i_OthelloBoard.m_OthelloBoard[i, c - 'A'].M_CellValue);
        ////                Console.Write(outputMessage);
        ////            }
        ////        }

        ////        if (i_OthelloBoard.m_BoardSize == 8)
        ////        {
        ////            Console.WriteLine("\n  =================================");
        ////        }
        ////        else
        ////        {
        ////            Console.WriteLine("\n  =========================");
        ////        }
        ////    }

        ////    Console.WriteLine();
        ////}

        public static bool IsValidDiscPlacement(OthelloBoard i_OthelloBoard, int i_Longtitude, char i_Latitude, OthelloPlayer i_Player)
        {
            return(i_OthelloBoard.M_OthelloBoard[i_Longtitude - 1, i_Latitude - 'A'].M_IsAvailableCell == true);
        }