public void checkLostActions(Playfield p) { Playfield tmpPf = new Playfield(); foreach (Action a in p.playactions) { if (a.target != null && a.own != null) { a.own.own = !a.target.own; } tmpPf.doAction(a); } MiniSimulator mainTurnSimulator = new MiniSimulator(6, 3000, 0); mainTurnSimulator.setSecondTurnSimu(settings.simulateEnemysTurn, settings.secondTurnAmount); mainTurnSimulator.setPlayAround(settings.playaround, settings.playaroundprob, settings.playaroundprob2); tmpPf.checkLostAct = true; tmpPf.isLethalCheck = p.isLethalCheck; float bestval = mainTurnSimulator.DoAllMoves(tmpPf); if (bestval > p.value) { p.playactions.Clear(); p.playactions.AddRange(mainTurnSimulator.bestboard.playactions); p.value = bestval; } }
private Ai() { this.nextMoveGuess = new Playfield { mana = -100 }; this.mainTurnSimulator = new MiniSimulator(maxdeep, maxwide, 0); // 0 for unlimited this.mainTurnSimulator.setPrintingstuff(true); for (int i = 0; i < maxNumberOfThreads; i++) { this.nextTurnSimulator.Add(new MiniSimulatorNextTurn()); this.enemyTurnSim.Add(new EnemyTurnSimulator()); this.enemySecondTurnSim.Add(new EnemyTurnSimulator()); this.nextTurnSimulator[i].thread = i; this.enemyTurnSim[i].thread = i; this.enemySecondTurnSim[i].thread = i; } }