private int TryGo(int x, int y, int deep, List <Point> vis, int curProfit) { if (deep < 0 || IsOutOfMap(x, y) || vis.Contains(new Point(x, y)) || mapObs[x, y] || brain.HasMyAgent(x, y) || brain.HasEnemyAgent(x, y)) { return(curProfit); } // he so tuy chinh bao if (startConvexHull && (deep == deepConvexHull || GAME.beforeGame.Turns - GAME.onGame.Turn <= deepConvexHull)) { var mapOwnClone = mapOwn.Clone(); foreach (var poi in vis) { mapOwnClone[poi.X, poi.Y] = beforeGame.TeamID; } curProfit += CalcConvexHull(mapOwnClone); } vis.Add(new Point(x, y)); int maxProfit = 0; // nếu đi vào ô của đối thủ thì mất 1 turn if (mapOwn[x, y] > 0 && mapOwn[x, y] != GAME.beforeGame.TeamID) { deep--; } for (int i = 0; i < 8; i++) { int cur = TryGo(x + dx[i], y + dy[i], deep - 1, new List <Point>(vis), curProfit + mapScores[x, y]); maxProfit = Math.Max(maxProfit, cur); } vis.Remove(new Point(x, y)); return(maxProfit); }