public void autoTester(bool printstuff, string data = "", bool logg = true) { help.logg("simulating board "); BoardTester bt = new BoardTester(data); if (!bt.datareaded) { return; } //calculate the stuff posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = Settings.Instance.simulateEnemysTurn; if (logg) { help.logg("readed:"); help.logg(posmoves[0].getCompleteBoardForSimulating("", "", "")); } if (logg) { foreach (Playfield p in this.posmoves) { p.printBoard(); } } help.logg("ownminionscount " + posmoves[0].ownMinions.Count); help.logg("owncardscount " + posmoves[0].owncards.Count); foreach (var item in this.posmoves[0].owncards) { help.logg("card " + item.card.name + " is playable :" + item.canplayCard(posmoves[0]) + " cost/mana: " + item.manacost + "/" + posmoves[0].mana); } help.logg("ability " + posmoves[0].ownHeroAblility.card.name + " is playable :" + posmoves[0].ownHeroAblility.card.canplayCard(posmoves[0], 2) + " cost/mana: " + posmoves[0].ownHeroAblility.card.getManaCost(posmoves[0], 2) + "/" + posmoves[0].mana); // lethalcheck + normal DateTime strt = DateTime.Now; doallmoves(false, true); help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); double timeneeded = 0; if (bestmoveValue < 10000) { posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = Settings.Instance.simulateEnemysTurn; strt = DateTime.Now; doallmoves(false, false); timeneeded = (DateTime.Now - strt).TotalSeconds; help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); } if (printstuff) { this.mainTurnSimulator.printPosmoves(); simmulateWholeTurn(); help.logg("calculated " + timeneeded); } }
public void autoTester(Bot botbase) { help.logg("simulating board "); BoardTester bt = new BoardTester(); hp.printHero(); hp.printOwnMinions(); hp.printEnemyMinions(); hm.printcards(); //calculate the stuff posmoves.Clear(); posmoves.Add(new Playfield()); foreach (Playfield p in this.posmoves) { p.printBoard(); } help.logg("ownminionscount " + posmoves[0].ownMinions.Count); help.logg("owncardscount " + posmoves[0].owncards.Count); foreach (var item in this.posmoves[0].owncards) { help.logg("card " + item.card.name + " is playable :" + item.card.canplayCard(posmoves[0]) + " cost/mana: " + item.card.cost + "/" + posmoves[0].mana); } doallmoves(false, botbase); foreach (Playfield p in this.posmoves) { p.printBoard(); } }
public void testExternal() { BoardTester bt = new BoardTester(""); this.currentMana = Hrtprozis.Instance.currentMana; this.ownMaxMana = Hrtprozis.Instance.ownMaxMana; this.enemyMaxMana = Hrtprozis.Instance.enemyMaxMana; printstuff(true); readActionFile(); }
public void doData(string data, Socket server) { calculatedBords++; Ai.Instance.updateTwoTurnSim(); BoardTester bt = new BoardTester(data); Playfield p = new Playfield(); Console.WriteLine("Recalc-check############################ "); bool dontNeedCalc = Ai.Instance.nextMoveGuess != null && p.isEqual(Ai.Instance.nextMoveGuess, true); Console.WriteLine("############################"); if (dontNeedCalc) { Ai.Instance.nextMoveGuess.printBoard(); skipped++; Console.WriteLine("####DONT RECALC############################ skipped " + skipped + " of " + calculatedBords); Ai.Instance.doNextCalcedMove(); Ai.Instance.nextMoveGuess.printBoard(); } else { Ai.Instance.autoTester(false, data, false); Ai.Instance.nextMoveGuess = new Playfield(); } //save calculated move Helpfunctions.Instance.resetBuffer(); Helpfunctions.Instance.writeToBuffer("board " + Ai.Instance.currentCalculatedBoard); Helpfunctions.Instance.writeToBuffer("value " + Ai.Instance.bestmoveValue); if (Ai.Instance.bestmove != null) { if (!dontNeedCalc) { Ai.Instance.nextMoveGuess.doAction(Ai.Instance.bestmove); } Ai.Instance.bestmove.print(true); foreach (Action a in Ai.Instance.bestActions) { a.print(true); } } Helpfunctions.Instance.writeBufferToActionFile(server); Ai.Instance.currentCalculatedBoard = "1"; Helpfunctions.Instance.ErrorLog("wait for next board..."); //sf.readActionFile(); }
public void autoTester(Behavior bbase, bool printstuff) { help.logg("simulating board "); BoardTester bt = new BoardTester(); this.botBase = bbase; hp.printHero(); hp.printOwnMinions(); hp.printEnemyMinions(); hm.printcards(); //calculate the stuff posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = this.simulateEnemyTurn; foreach (Playfield p in this.posmoves) { p.printBoard(); } help.logg("ownminionscount " + posmoves[0].ownMinions.Count); help.logg("owncardscount " + posmoves[0].owncards.Count); foreach (var item in this.posmoves[0].owncards) { help.logg("card " + item.card.name + " is playable :" + item.canplayCard(posmoves[0]) + " cost/mana: " + item.manacost + "/" + posmoves[0].mana); } help.logg("ability " + posmoves[0].ownHeroAblility.name + " is playable :" + posmoves[0].ownHeroAblility.canplayCard(posmoves[0], 2) + " cost/mana: " + posmoves[0].ownHeroAblility.getManaCost(posmoves[0], 2) + "/" + posmoves[0].mana); // lethalcheck + normal DateTime strt = DateTime.Now; doallmoves(false, true); help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); if (bestmoveValue < 10000) { posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = this.simulateEnemyTurn; strt = DateTime.Now; doallmoves(false, false); help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); } this.mainTurnSimulator.printPosmoves(); help.logg("bestfield"); bestboard.printBoard(); if (printstuff) { simmulateWholeTurn(); } }
public void autoTester(Bot bbase) { help.logg("simulating board "); BoardTester bt = new BoardTester(); this.botBase = bbase; hp.printHero(); hp.printOwnMinions(); hp.printEnemyMinions(); hm.printcards(); //calculate the stuff posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = this.simulateEnemyTurn; foreach (Playfield p in this.posmoves) { p.printBoard(); } help.logg("ownminionscount " + posmoves[0].ownMinions.Count); help.logg("owncardscount " + posmoves[0].owncards.Count); foreach (var item in this.posmoves[0].owncards) { help.logg("card " + item.card.name + " is playable :" + item.canplayCard(posmoves[0]) + " cost/mana: " + item.manacost + "/" + posmoves[0].mana); } help.logg("ability " + posmoves[0].ownHeroAblility.name + " is playable :" + posmoves[0].ownHeroAblility.canplayCard(posmoves[0], 2) + " cost/mana: " + posmoves[0].ownHeroAblility.getManaCost(posmoves[0], 2) + "/" + posmoves[0].mana); // lethalcheck + normal DateTime strt = DateTime.Now; doallmoves(false, true); help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); if (bestmoveValue < 10000) { posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = this.simulateEnemyTurn; strt = DateTime.Now; doallmoves(false, false); help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); } foreach (Playfield p in this.posmoves) { p.printBoard(); } help.logg("bestfield"); bestboard.printBoard(); //simmulateWholeTurn(); }
public void autoTester(Bot botbase) { help.logg("simulating board "); BoardTester bt = new BoardTester(); hp.printHero(); hp.printOwnMinions(); hp.printEnemyMinions(); hm.printcards(); //calculate the stuff posmoves.Clear(); posmoves.Add(new Playfield()); foreach (Playfield p in this.posmoves) { p.printBoard(); } help.logg("ownminionscount " + posmoves[0].ownMinions.Count); help.logg("owncardscount " + posmoves[0].owncards.Count); foreach (var item in this.posmoves[0].owncards) { help.logg("card " + item.card.name + " is playable :" + item.card.canplayCard(posmoves[0]) + " cost/mana: " + item.card.cost + "/" + posmoves[0].mana); } help.logg("ability " + posmoves[0].ownHeroAblility.name + " is playable :" + posmoves[0].ownHeroAblility.canplayCard(posmoves[0]) + " cost/mana: " + posmoves[0].ownHeroAblility.cost + "/" + posmoves[0].mana); // lethalcheck + normal doallmoves(false, botbase, true); if (bestmoveValue < 10000) { posmoves.Clear(); posmoves.Add(new Playfield()); doallmoves(false, botbase, false); } foreach (Playfield p in this.posmoves) { p.printBoard(); } help.logg("bestfield"); bestboard.printBoard(); //simmulateWholeTurn(); }
public void autoTester(bool printstuff, string data = "", bool logg=true) { help.logg("simulating board "); BoardTester bt = new BoardTester(data); if (!bt.datareaded) return; //calculate the stuff posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = Settings.Instance.simulateEnemysTurn; if (logg) { help.logg("readed:"); help.logg(posmoves[0].getCompleteBoardForSimulating("", "", "")); } if (logg) { foreach (Playfield p in this.posmoves) { p.printBoard(); } } help.logg("ownminionscount " + posmoves[0].ownMinions.Count); help.logg("owncardscount " + posmoves[0].owncards.Count); foreach (var item in this.posmoves[0].owncards) { help.logg("card " + item.card.name + " is playable :" + item.canplayCard(posmoves[0]) + " cost/mana: " + item.manacost + "/" + posmoves[0].mana); } help.logg("ability " + posmoves[0].ownHeroAblility.card.name + " is playable :" + posmoves[0].ownHeroAblility.card.canplayCard(posmoves[0], 2) + " cost/mana: " + posmoves[0].ownHeroAblility.card.getManaCost(posmoves[0], 2) + "/" + posmoves[0].mana); // lethalcheck + normal DateTime strt = DateTime.Now; doallmoves(false, true); help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); double timeneeded = 0; if (bestmoveValue < 10000) { posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = Settings.Instance.simulateEnemysTurn; strt = DateTime.Now; doallmoves(false, false); timeneeded = (DateTime.Now - strt).TotalSeconds; help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); } if (printstuff) { this.mainTurnSimulator.printPosmoves(); simmulateWholeTurn(this.mainTurnSimulator.bestboard); help.logg("calculated " + timeneeded); } if (bt.boardToSimulate >= 0) { int input = 0; while (input >= 0) { Console.WriteLine("write Index of board you want to simulate:"); String cnslrdl = Console.ReadLine(); try { input = Convert.ToInt32(cnslrdl); simmulateWholeTurn(this.mainTurnSimulator.getBoard(input)); } catch { Console.WriteLine("testmode ended..."); input = -1; } } } else { Console.WriteLine("notestmode"); } }
public void autoTester(bool printstuff, string data = "") { help.logg("simulating board "); BoardTester bt = new BoardTester(data); if (!bt.datareaded) return; hp.printHero(); hp.printOwnMinions(); hp.printEnemyMinions(); hm.printcards(); //calculate the stuff posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = Settings.Instance.simulateEnemysTurn; foreach (Playfield p in this.posmoves) { p.printBoard(); } help.logg("ownminionscount " + posmoves[0].ownMinions.Count); help.logg("owncardscount " + posmoves[0].owncards.Count); foreach (var item in this.posmoves[0].owncards) { help.logg("card " + item.card.name + " is playable :" + item.canplayCard(posmoves[0]) + " cost/mana: " + item.manacost + "/" + posmoves[0].mana); } help.logg("ability " + posmoves[0].ownHeroAblility.card.name + " is playable :" + posmoves[0].ownHeroAblility.card.canplayCard(posmoves[0], 2) + " cost/mana: " + posmoves[0].ownHeroAblility.card.getManaCost(posmoves[0], 2) + "/" + posmoves[0].mana); // lethalcheck + normal DateTime strt = DateTime.Now; doallmoves(false, true); help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); double timeneeded = 0; if (bestmoveValue < 10000) { posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = Settings.Instance.simulateEnemysTurn; strt = DateTime.Now; doallmoves(false, false); timeneeded = (DateTime.Now - strt).TotalSeconds; help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); } if (printstuff) { this.mainTurnSimulator.printPosmoves(); simmulateWholeTurn(); help.logg("calculated " + timeneeded); } }
public void testExternal() { BoardTester bt = new BoardTester(""); this.currentMana = Hrtprozis.Instance.currentMana; this.ownMaxMana = Hrtprozis.Instance.ownMaxMana; this.enemyMaxMana = Hrtprozis.Instance.enemyMaxMana; printstuff(true); readActionFile(); }
public List <double> autoTester(bool printstuff, string data = "", int mode = 0) //-mode: 0-all, 1-lethalcheck, 2-normal { List <double> retval = new List <double>(); double calcTime = 0; help.logg("simulating board "); BoardTester bt = new BoardTester(data); if (!bt.datareaded) { return(retval); } hp.printHero(); hp.printOwnMinions(); hp.printEnemyMinions(); hm.printcards(); //calculate the stuff posmoves.Clear(); Playfield pMain = new Playfield(); pMain.print = printstuff; posmoves.Add(pMain); foreach (Playfield p in this.posmoves) { p.printBoard(); } help.logg("ownminionscount " + posmoves[0].ownMinions.Count); help.logg("owncardscount " + posmoves[0].owncards.Count); foreach (var item in this.posmoves[0].owncards) { help.logg("card " + item.card.name + " is playable :" + item.canplayCard(posmoves[0], true) + " cost/mana: " + item.manacost + "/" + posmoves[0].mana); } help.logg("ability " + posmoves[0].ownHeroAblility.card.name + " is playable :" + posmoves[0].ownHeroAblility.card.canplayCard(posmoves[0], 2, true) + " cost/mana: " + posmoves[0].ownHeroAblility.card.getManaCost(posmoves[0], 2) + "/" + posmoves[0].mana); DateTime strt = DateTime.Now; // lethalcheck if (mode == 0 || mode == 1) { doallmoves(false, true); calcTime = (DateTime.Now - strt).TotalSeconds; help.logg("calculated " + calcTime); retval.Add(calcTime); } if (Settings.Instance.berserkIfCanFinishNextTour > 0 && bestmoveValue > 5000) { } else if (bestmoveValue < 10000) { // normal if (mode == 0 || mode == 2) { posmoves.Clear(); pMain = new Playfield(); pMain.print = printstuff; posmoves.Add(pMain); strt = DateTime.Now; doallmoves(false, false); calcTime = (DateTime.Now - strt).TotalSeconds; help.logg("calculated " + calcTime); retval.Add(calcTime); } } if (printstuff) { this.mainTurnSimulator.printPosmoves(); simmulateWholeTurn(); help.logg("calculated " + calcTime); } return(retval); }
public void autoTester(bool printstuff, string data = "", bool logg = true) { help.logg("simulating board "); BoardTester bt = new BoardTester(data); if (!bt.datareaded) { return; } //calculate the stuff posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = Settings.Instance.simulateEnemysTurn; if (logg) { help.logg("readed:"); help.logg(posmoves[0].getCompleteBoardForSimulating("", "", "")); } if (logg) { foreach (Playfield p in this.posmoves) { p.printBoard(); } } help.logg("ownminionscount " + posmoves[0].ownMinions.Count); help.logg("owncardscount " + posmoves[0].owncards.Count); foreach (var item in this.posmoves[0].owncards) { help.logg("card " + item.card.name + " is playable :" + item.canplayCard(posmoves[0]) + " cost/mana: " + item.manacost + "/" + posmoves[0].mana); } help.logg("ability " + posmoves[0].ownHeroAblility.card.name + " is playable :" + posmoves[0].ownHeroAblility.card.canplayCard(posmoves[0], 2) + " cost/mana: " + posmoves[0].ownHeroAblility.card.getManaCost(posmoves[0], 2) + "/" + posmoves[0].mana); // lethalcheck + normal DateTime strt = DateTime.Now; doallmoves(false, true); help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); double timeneeded = 0; if (bestmoveValue < 10000) { posmoves.Clear(); posmoves.Add(new Playfield()); posmoves[0].sEnemTurn = Settings.Instance.simulateEnemysTurn; strt = DateTime.Now; doallmoves(false, false); timeneeded = (DateTime.Now - strt).TotalSeconds; help.logg("calculated " + (DateTime.Now - strt).TotalSeconds); } if (printstuff) { this.mainTurnSimulator.printPosmoves(); simmulateWholeTurn(this.mainTurnSimulator.bestboard); help.logg("Best Board Actions:"); this.mainTurnSimulator.bestboard.printActions(); help.logg(""); help.logg("calculated " + timeneeded); } if (bt.boardToSimulate >= 0) { int input = 0; while (input >= 0) { Console.WriteLine("write Index of board you want to simulate:"); String cnslrdl = Console.ReadLine(); try { input = Convert.ToInt32(cnslrdl); simmulateWholeTurn(this.mainTurnSimulator.getBoard(input)); } catch { Console.WriteLine("testmode ended..."); input = -1; } } } else { Console.WriteLine("notestmode"); } }
public List <double> autoTester(bool printstuff, string data = "", int mode = 0) //-mode: 0-all, 1-lethalcheck, 2-normal { var retval = new List <double>(); double calcTime = 0; this.help.logg("simulating board "); var bt = new BoardTester(data); if (!bt.datareaded) { return(retval); } this.hp.printHero(); this.hp.printOwnMinions(); this.hp.printEnemyMinions(); this.hm.printcards(); //calculate the stuff this.posmoves.Clear(); var pMain = new Playfield(); pMain.print = printstuff; this.posmoves.Add(pMain); foreach (var p in this.posmoves) { p.printBoard(); } this.help.logg($"ownminionscount {this.posmoves[0].ownMinions.Count}"); this.help.logg($"owncardscount {this.posmoves[0].owncards.Count}"); foreach (var item in this.posmoves[0].owncards) { this.help.logg( $"card {item.card} is playable :{item.canplayCard(this.posmoves[0], true)} cost/mana: {item.manacost}/{this.posmoves[0].mana}"); } this.help.logg( $"ability {this.posmoves[0].ownHeroAblility.card} is playable :{this.posmoves[0].ownHeroAblility.card.canplayCard(this.posmoves[0], 2, true)} cost/mana: {this.posmoves[0].ownHeroAblility.card.getManaCost(this.posmoves[0], 2)}/{this.posmoves[0].mana}"); var strt = DateTime.Now; // lethalcheck if (mode == 0 || mode == 1) { this.doallmoves(false, true); calcTime = (DateTime.Now - strt).TotalSeconds; this.help.logg($"calculated {calcTime}"); retval.Add(calcTime); } if (Settings.Instance.berserkIfCanFinishNextTour > 0 && this.bestmoveValue > 5000) { } else if (this.bestmoveValue < 10000) { // normal if (mode == 0 || mode == 2) { this.posmoves.Clear(); pMain = new Playfield(); pMain.print = printstuff; this.posmoves.Add(pMain); strt = DateTime.Now; this.doallmoves(false, false); calcTime = (DateTime.Now - strt).TotalSeconds; this.help.logg($"calculated {calcTime}"); retval.Add(calcTime); } } if (printstuff) { this.mainTurnSimulator.printPosmoves(); this.simmulateWholeTurn(); this.help.logg($"calculated {calcTime}"); } return(retval); }