public List <Action> getBestPlayfield() { //Helpfunctions.Instance.startTimer(); chanceCount = 0; Playfield selectedMove = null; bestValue = float.MinValue; //Playfield tempBoard = new Playfield(board); currentState = new Node(null, board, null, 0); List <Action> actionList = new List <Action>(); if (expand(currentState, HeuristicType.LethalCheck, 500) == 1) { actionList.AddRange(currentState.children[0].state.getLastTurnAction()); actionList.Add(null); return(actionList); } int count = expandDecision(currentState, firstNumberIter); if (count == 0) { actionList.AddRange(currentState.children[0].state.getLastTurnAction()); actionList.Add(null); return(actionList); } //if (!this.isOpenHand) //{ // sampleWorld(currentState); //} UCT(currentState); int depth = currentState.depth; while (currentState.depth == depth) { int maxVisit = 0; Node selectedChild = null; foreach (Node child in currentState.children) { if (child.numVisited > maxVisit) { maxVisit = child.numVisited; selectedMove = child.state; selectedChild = child; } } currentState.printChildren(); actionList.Add(selectedChild.move); currentState = selectedChild; if (selectedChild.numVisited <= 50) { int result = expandDecision(currentState, firstNumberIter); if (result != 0) //chance node { break; } else { UCT(currentState); } } } return(actionList); }