public Player(string i_PlayerName, int i_BoardSize, int i_FirstOrSecondPlayer, bool i_ComputerFlag) { m_BoardSize = i_BoardSize; m_MachineOrNot = i_ComputerFlag; r_PlayerName = i_PlayerName; m_NumberOfCheckers = NumberOfCheckersByBoardSize(i_BoardSize); if (i_FirstOrSecondPlayer == 1) { m_UpOrDown = e_LocationOfThePlayer.UP; } else { m_UpOrDown = e_LocationOfThePlayer.DOWN; } }
public void InitAllTheCheckersOfOnePlayer(int i_SizeOfBoard, e_LocationOfThePlayer i_Location) { string limitSquare = ConvertSizeOfTheBoardToSquare(i_SizeOfBoard); char[] limitSqureAsTwoChars = { limitSquare[0], limitSquare[1] }; ///------------Init all the checkers of the upper player----//// if (i_Location == e_LocationOfThePlayer.UP) { m_ListOfAllTheChecker.Clear(); char[] squreIterator = { 'B', 'a' }; ////string squreIterator = "aA"; for (int i = 0; i < m_NumberOfCheckers; i++) { m_ListOfAllTheChecker.AddLast(new Checker(new Position(new string(squreIterator)), Checker.Symbol.O)); ////Create new checker and push hit to the end of the list if (squreIterator[0] == limitSqureAsTwoChars[0]) { ////End of the line squreIterator[0] = 'A'; squreIterator[1]++; } else if (squreIterator[0] == limitSqureAsTwoChars[0] - 1) { ////End of the line squreIterator[0] = 'B'; squreIterator[1]++; } else { squreIterator[0]++; squreIterator[0]++; } } } ////------------Init all the checkers of the downer player----//// if (i_Location == e_LocationOfThePlayer.DOWN) { m_ListOfAllTheChecker.Clear(); char startSmallLetter = StartSquareSmallLetter(i_SizeOfBoard); char startBigLetter; if (i_SizeOfBoard == 8) { startBigLetter = 'A'; } else { startBigLetter = 'B'; } char[] squreIterator = { startBigLetter, startSmallLetter }; ////string squreIterator = "aA"; for (int i = 0; i < m_NumberOfCheckers; i++) { m_ListOfAllTheChecker.AddLast(new Checker(new Position(new string(squreIterator)), Checker.Symbol.X)); ////Create new checker and push him to the end of the list if (squreIterator[0] == limitSqureAsTwoChars[0] - 1) { ////End of the line squreIterator[0] = 'B'; squreIterator[1]++; } else if (squreIterator[0] == limitSqureAsTwoChars[0]) { ////End of the line squreIterator[0] = 'A'; squreIterator[1]++; } else { squreIterator[0]++; squreIterator[0]++; } } } }