Skip to content

Commit

Permalink
Lua AIs: remove unused debug output
Browse files Browse the repository at this point in the history
(cherry-picked from commit 83c4ef2)
  • Loading branch information
mattsc committed Oct 7, 2018
1 parent 5bc44fc commit 98e5f08
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 17 deletions.
2 changes: 0 additions & 2 deletions data/ai/lua/battle_calcs.lua
Expand Up @@ -1013,13 +1013,11 @@ function battle_calcs.attack_combo_stats(tmp_attackers, tmp_dsts, defender, cach
-- if (p > 0) then
-- local dhp_norm = (hp - av) / defender.max_hitpoints * wesnoth.unit_types[defender.type].cost
-- local dvar = p * dhp_norm^2
--print(hp,p,av, dvar)
-- outcome_variance = outcome_variance + dvar
-- n_outcomes = n_outcomes + 1
-- end
--end
--outcome_variance = outcome_variance / n_outcomes
--print('outcome_variance', outcome_variance)

-- Note that this is a variance, not a standard deviations (as in, it's squared),
-- so it does not matter much for low-variance attacks, but takes on large values for
Expand Down
9 changes: 0 additions & 9 deletions data/ai/lua/generic_rush_engine.lua
Expand Up @@ -283,13 +283,11 @@ return {
if AH.print_eval() then AH.done_eval_messages(start_time, ca_name) end
return 0
end
--print('#units, #enemies', #units, #enemies)

-- First check if attacks are possible for any unit
local return_value = 200000
-- If one with > 50% chance of kill is possible, set return_value to lower than combat CA
local attacks = ai.get_attacks()
--print(#attacks)
for i,a in ipairs(attacks) do
if (#a.movements == 1) and (a.chance_to_kill > 0.5) then
return_value = 90000
Expand All @@ -311,7 +309,6 @@ return {

-- If an enemy can get within one move of the village, we want to hold it
if enemy_attack_map:get(v[1], v[2]) then
--print(' within enemy reach', v[1], v[2])
village_rating = village_rating + 100
end

Expand Down Expand Up @@ -345,7 +342,6 @@ return {
if (cost <= u.moves) then
village_rating = village_rating - 1
reachable = true
--print('Can reach:', u.id, v[1], v[2], cost)
local rating = 0

-- Prefer strong units if enemies can reach the village, injured units otherwise
Expand All @@ -362,7 +358,6 @@ return {
if (rating > best_unit_rating) then
best_unit_rating, best_unit = rating, u
end
--print(' rating:', rating)
end
end
end
Expand All @@ -375,7 +370,6 @@ return {
max_rating, best_village, best_unit = rating, v, village_ratings[v][2]
end
end
--print('max_rating', max_rating)

if (max_rating > -9e99) then
self.data.unit, self.data.village = best_unit, best_village
Expand Down Expand Up @@ -418,14 +412,12 @@ return {
} },
canrecruit = 'no'
}
--print('#poisoners', #poisoners)
if (not poisoners[1]) then
if AH.print_eval() then AH.done_eval_messages(start_time, ca_name) end
return 0
end

local attacks = AH.get_attacks(poisoners)
--print('#attacks', #attacks)
if (not attacks[1]) then
if AH.print_eval() then AH.done_eval_messages(start_time, ca_name) end
return 0
Expand Down Expand Up @@ -463,7 +455,6 @@ return {
-- For the same attacker/defender pair, go to strongest terrain
local attack_defense = 100 - attacker:defense(wesnoth.get_terrain(a.dst.x, a.dst.y))
rating = rating + attack_defense / 2.
--print('rating', rating)

-- And from village everything else being equal
local is_village = wesnoth.get_terrain_info(wesnoth.get_terrain(a.dst.x, a.dst.y)).village
Expand Down
1 change: 0 additions & 1 deletion data/campaigns/Eastern_Invasion/ai/ca_ogres_flee.lua
Expand Up @@ -86,7 +86,6 @@ function ca_ogres_flee:execution()

--AH.put_labels(rating_map)
end
--print(best_unit.id, best_unit.x, best_unit.y, best_hex[1], best_hex[2], max_rating)

if best_hex then
AH.movefull_outofway_stopunit(ai, best_unit, best_hex[1], best_hex[2])
Expand Down
1 change: 0 additions & 1 deletion data/campaigns/Son_Of_The_Black_Eye/ai/ca_transport_S6.lua
Expand Up @@ -40,7 +40,6 @@ function ca_transport:execution()
then
transport_map:insert(u.x, u.y)
table.insert(transports, u)
--print("----> Inserting " .. u.id, u.x, u.y, u.variables.destination_x, u.variables.destination_y)
else
blocked_hex_map:insert(u.x, u.y)
end
Expand Down
Expand Up @@ -8,12 +8,10 @@ function ca_aggressive_attack_no_suicide:evaluation(cfg, data)
side = wesnoth.current.side,
formula = 'attacks_left > 0'
}
--print('#units', #units)
if (not units[1]) then return 0 end

-- Get all possible attacks
local attacks = AH.get_attacks(units, { include_occupied = true })
--print('#attacks', #attacks)
if (not attacks[1]) then return 0 end

-- Now find the best of the possible attacks
Expand All @@ -38,7 +36,6 @@ function ca_aggressive_attack_no_suicide:evaluation(cfg, data)

-- Also, take strongest unit first
rating = rating + attacker.hitpoints / 10.
--print('rating:', rating, attacker.id, defender.id)

if (rating > max_rating) then
max_rating = rating
Expand Down
1 change: 0 additions & 1 deletion data/campaigns/The_Rise_Of_Wesnoth/ai/ca_retreat.lua
Expand Up @@ -9,7 +9,6 @@ function retreat:evaluation(cfg, data)
side = wesnoth.current.side,
formula = 'movement_left > 0'
}
--print('#units', #units)
if (not units[1]) then return 0 end

local unit, dst, enemy_threat = R.retreat_injured_units(units)
Expand Down

0 comments on commit 98e5f08

Please sign in to comment.