public void SetUpGame(char whiteGap, char blackGap) { Core.Color userColor = m_BoardRotated ? Core.Color.White : Core.Color.Black; m_User = new HumanPlayer(userColor); m_User.TurnTaken += EnableControl; m_User.MoveProduced += DisableControl; Player opponent; if (m_LocalMultiplayer) { opponent = new HumanPlayer(userColor.Inverse()); if (!m_BoardRotated) { m_ControlEnabled = true; } } else { MiniMaxAI opponentAI = new MiniMaxAI(userColor.Inverse(), c_AIThinkingTime); opponentAI.TurnTaken += OpponentBeginThinking; opponentAI.MoveProduced += OpponentEndThinking; opponent = opponentAI; } m_GameManager = new GameManager(whiteGap, blackGap, m_User, opponent); m_GameManager.MoveMade += RenderChanges; m_GameManager.MoveMade += CheckEndGame; }
private Player CreatePlayer(string playerType, Colour colour, int depth = 0) { switch (playerType.ToLower()) { case "human": return(new HumanPlayer(board, colour)); case "minimaxai": case "minmaxai": case "minimax": case "minmax": IAI ai = new MiniMaxAI(board, colour, depth); return(new AIPlayer(board, colour, ai)); case "learningai": throw new NotImplementedException(); default: throw new TakException("Player not recognised."); } }