/// <summary> /// Create root Node /// </summary> /// <param name="player"></param> /// <param name="opponentPlayer"></param> public Node(Player player, Player opponentPlayer) { board = AIHandler.CloneBoard(_GameManager.board); this.player = AIHandler.ClonePlayer(player); this.opponentPlayer = AIHandler.ClonePlayer(opponentPlayer); captureBoxesPlayer = (player == _GameManager.players[0] ? AIHandler.CloneCaptureBoxesInitial(_GameManager.players[0].captureBench) : AIHandler.CloneCaptureBoxesInitial(_GameManager.players[1].captureBench)); captureBoxesOpponentPlayer = (opponentPlayer == _GameManager.players[0] ? AIHandler.CloneCaptureBoxesInitial(_GameManager.players[0].captureBench) : AIHandler.CloneCaptureBoxesInitial(_GameManager.players[1].captureBench)); isInitialPlayer = true; }
/// <summary> /// Create a children node, and apply the move given to get to the new state of the game /// </summary> /// <param name="parentNode">the parent node of this node</param> /// <param name="move">the move to get to the new state from parentNode</param> /// <param name="player">the current player in this node</param> /// <param name="opponentPlayer">the opponent player</param> /// <param name="makeTree"> will parent and children be insitialised</param> public Node(Node parentNode, Move move, Player player, Player opponentPlayer) { board = AIHandler.CloneBoard(parentNode.board); this.player = AIHandler.ClonePlayer(player); this.opponentPlayer = AIHandler.ClonePlayer(opponentPlayer); captureBoxesPlayer = AIHandler.CloneCaptureBoxesNode(parentNode.captureBoxesPlayer); captureBoxesOpponentPlayer = AIHandler.CloneCaptureBoxesNode(parentNode.captureBoxesOpponentPlayer); isInitialPlayer = parentNode.isInitialPlayer; Move m = AIHandler.CloneMove(move); m.play(this); _GameManager.AIupdateAllTokenMoves(this); isInitialPlayer = isInitialPlayer == true ? false : true; }