Esempio n. 1
0
        public void printBoard()
        {
            string        newLine = Environment.NewLine;
            char          rowCharIndicator;
            char          coinType;
            StringBuilder board = new StringBuilder();
            Coin          currentCoin;

            for (int i = 0; i < m_BoardSize; i++)
            {
                board.Append("   " + PlaceIndexConvertor.GetCapitalCharByIndex(i));
            }

            board.Append(newLine);
            board.Append(getStringBorder() + newLine);
            for (int row = 0; row < m_BoardSize; row++)
            {
                rowCharIndicator = PlaceIndexConvertor.GetSmallCharByIndex(row);
                board.Append(rowCharIndicator + "|");
                for (int column = 0; column < m_BoardSize; column++)
                {
                    if (m_Board[row, column] != null)
                    {
                        currentCoin = m_Board[row, column];
                        if (currentCoin.IsKing)
                        {
                            coinType = m_Board[row, column].Type.Equals(Constants.k_FirstCoinType) ? 'U' : 'K';
                            board.Append(" " + coinType + " |");
                        }
                        else
                        {
                            coinType = m_Board[row, column].Type;
                            board.Append(" " + coinType + " |");
                        }
                    }
                    else
                    {
                        board.Append("   |");
                    }
                }

                board.Append(newLine);
                board.Append(getStringBorder());
                board.Append(newLine);
            }

            Console.WriteLine(board.ToString());
        }
Esempio n. 2
0
 public Square(int i_Column, int i_Row)
 {
     this.m_Column = PlaceIndexConvertor.GetCapitalCharByIndex(i_Column);
     this.m_Row    = PlaceIndexConvertor.GetSmallCharByIndex(i_Row);
 }
Esempio n. 3
0
        private void setCoinInBoard(int i_RowIndex, int i_ColumnIndex)
        {
            char coinType;

            if (i_RowIndex < m_BoardSize / 2)
            {
                coinType = Constants.k_FirstCoinType;
            }
            else
            {
                coinType = Constants.k_SecondCoinType;
            }

            m_Board[i_RowIndex, i_ColumnIndex] = new Coin(PlaceIndexConvertor.GetSmallCharByIndex(i_RowIndex), PlaceIndexConvertor.GetCapitalCharByIndex(i_ColumnIndex), coinType);
        }