private void initTable() { int numOfMen = calcNumOfMen(); m_Table = new CheckerSquare[m_Size, m_Size]; initUpperSide(); // space of 2 lines between the oponnents CheckersMan cMan = new CheckersMan(CheckersMan.eType.None); for (int i = (m_Size - 1) / 2; i < ((m_Size / 2) + 1); i++) { for (int j = 0; j < m_Size; j++) { m_Table[i, j] = new CheckerSquare(i, j, cMan); } } initBottomSide(); }
private void initUpperSide() { CheckersMan cMan; // occupy the squares on the upper side of the table for (int i = 0; i < ((m_Size - 1) / 2); i++) { for (int j = 0; j < m_Size; j++) { if ((i + j) % 2 == 1) { cMan = new CheckersMan(CheckersMan.eType.O); m_Table[i, j] = new CheckerSquare(i, j, cMan); } else { cMan = new CheckersMan(CheckersMan.eType.None); m_Table[i, j] = new CheckerSquare(i, j, cMan); } } } }
private void initBottomSide() { CheckersMan cMan; int bottomSide = (m_Size / 2) + 1; // put men on the bottom side of the table for (int i = bottomSide; i < m_Size; i++) { for (int j = 0; j < m_Size; j++) { if ((i + j) % 2 == 1) { cMan = new CheckersMan(CheckersMan.eType.X); m_Table[i, j] = new CheckerSquare(i, j, cMan); } else { cMan = new CheckersMan(CheckersMan.eType.None); m_Table[i, j] = new CheckerSquare(i, j, cMan); } } } }