public int run(int step) { // AI first. int point = 0; int max = -9999; for (int i = 0; i < virture_itemAI.Length; i++) { if (virture_itemAI[i] != null) { point = virture_itemAI[i].run(step); //Console.Write("" + point + " "); if (point > max) { if (itemAI[i].getStatusItem() == 2) // horse { virture_BestsuperItem = virture_itemAI[i]; bestsuperItem = itemAI[i]; bestIndexItemSuper = i; } listAnswer = virture_itemAI[i].getListAnswer(); listAnswerDoubleKill = virture_itemAI[i].getListDoubleKill(); Console.Write("\nNODE MAX : " + i + "\n"); swapToBestAnswer(); max = point; } } } return(max); }
public AIBoardHorse(int row, int col, AIBoradSection[,] tableBoardSectionForAI, Item[] itemAI, Item[] itemPlayer) { this.row = row; this.col = col; this.tableBoardSectionForAI = new AIBoradSection[row, col]; //this.point = new int[itemAI.Length]; // initial Object item. this.itemAI = new Item[itemAI.Length]; this.itemPlayer = new Item[itemPlayer.Length]; this.virture_itemAI = new AI_item[itemAI.Length]; // Clone value in object parameter to Object AI. for (int i = 0; i < itemAI.Length; i++) { // Clone Object item. if (itemAI[i] != null) { this.itemAI[i] = itemAI[i].clone(); //Console.Write("\n" + itemAI[i].getIdRow() + "," + itemAI[i].getIdCol()); } } for (int i = 0; i < itemPlayer.Length; i++) { // Clone Object item. if (itemPlayer[i] != null) { this.itemPlayer[i] = itemPlayer[i].clone(); //Console.Write("\n" + itemPlayer[i].getIdRow() + "," + itemPlayer[i].getIdCol()); } } //Console.Write("\n"); // Copy value table. for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { // Copy data in object parameter. this.tableBoardSectionForAI[i, j] = tableBoardSectionForAI[i, j].cloneAIBoardHorseSection(); //Console.Write("" + tableBoardSectionForAI[i, j].getPlayerHolder() + " "); } //Console.Write("\n"); } // item . for (int i = 0; i < virture_itemAI.Length; i++) { //set table item view. if (this.itemAI[i] != null) { virture_itemAI[i] = new AI_item(this.row, this.col, this.tableBoardSectionForAI, this.itemAI[i], this.itemPlayer); } } }