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 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 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); }