/// <summary> /// running game /// </summary> public void Run(bool artifcialIntelligence) { InitializePlayers(artifcialIntelligence); PrintPlayers(); Console.ReadKey(); //****************Main game body*********************// var rounds = 0; do { rounds++; _board.PrintBoard(_gameRecord); if (_gameHelper.CheckBoard(_gameRecord, _players)) { //if player get win number in row _endGame = true; _board.PrintWinner(_players, !_playerTurn); } else { if (rounds > _configuration.GetCurrentConfig().BoardSize *_configuration.GetCurrentConfig().BoardSize) { //if board is full with no winner _endGame = true; Console.WriteLine("\n\n SPLIT! \n"); Console.ReadKey(); } else { //ticking tacking toeing _board.PrintBottom(_players, _playerTurn); GetPlayerPick(artifcialIntelligence && !_playerTurn); _playerTurn = !_playerTurn; //switching turns } } } while (!_endGame); }
public string[][] CreateGameRecordTable() { var size = _configuration.GetCurrentConfig().BoardSize; string[][] resultTable = new string[size][]; for (int i = 0; i < size; i++) { resultTable[i] = new string[size]; for (int j = 0; j < size; j++) //********// { resultTable[i][j] = "_"; } } return(resultTable); }
public BoardManager(ConfigurationFile getInstance) { _config = getInstance.GetCurrentConfig(); }