/// <summary> /// Constructor /// </summary> /// <param name="playerSettings">Playersettings</param> public AIPlayer(PlayerSettings playerSettings) { PlayerSettings = playerSettings; if (playerSettings.AlgorithmType == AlgorithmType.Random) { algorithm = new Random(); } else if (playerSettings.AlgorithmType == AlgorithmType.MiniMax) { algorithm = new MiniMax(playerSettings.PlieDepth, playerSettings.DoTransTable); } else if (playerSettings.AlgorithmType == AlgorithmType.AlphaBeta) { algorithm = new AlphaBeta(playerSettings.PlieDepth, playerSettings.DoMoveOrdering, playerSettings.DoTransTable); } }
/// <summary> /// starts a new game /// </summary> /// <param name="playerA">playersettings of player A</param> /// <param name="playerB">playersettings of player B</param> /// <param name="startBoard">a board to start with</param> /// <param name="startPlayer">player that turns first</param> public void StartGame(PlayerSettings playerA, PlayerSettings playerB, Board startBoard, int startPlayer) { Game.Instance.StartGame(playerA, playerB, startBoard, startPlayer); }
/// <summary> /// starts a new game /// </summary> /// <param name="playerA">playersettings of player A</param> /// <param name="playerB">playersettings of player B</param> public void StartGame(PlayerSettings playerA, PlayerSettings playerB) { Game.Instance.StartGame(playerA, playerB); }
/// <summary> /// starts a new game /// </summary> /// <param name="playerA">playersettings of player A</param> /// <param name="playerB">playersettings of player B</param> public void StartGame(PlayerSettings playerA, PlayerSettings playerB) { this.playerA = new AIPlayer(playerA); this.playerB = new AIPlayer(playerB); NumMovesA = 0; NumMovesB = 0; // random first player System.Random r = new System.Random(); int player = r.Next(1, 3); turnPlayerA = true; if (player == 2) turnPlayerA = false; board = new Board(); Logger.AddLine("Start new game"); MakeAIMove(); }
/// <summary> /// starts a new game with a startboard and a turningplayer /// </summary> /// <param name="playerA">playersettings of player A</param> /// <param name="playerB">playersettings of player B</param> /// <param name="startBoard">a board to start with</param> /// <param name="startPlayer">player that turns first</param> public void StartGame(PlayerSettings playerA, PlayerSettings playerB, Board startBoard, int startPlayer) { this.playerA = new AIPlayer(playerA); this.playerB = new AIPlayer(playerB); NumMovesA = 0; NumMovesB = 0; this.board = startBoard; this.turnPlayerA = (startPlayer == 0 ? true : false); Logger.AddLine("Start new game, with startboard and turningPlayer"); MakeAIMove(); }