from itertools import product
def gear_combo(weight, head=None, chest=None, hands=None, legs=None, feet=None, shield=None):
# Default gear options
gear_options = {
'Head': [1.5, 2.6, 4.7] if head is None else [head],
'Chest': [0, 3.5, 6.2, 11] if chest is None else [chest],
'Hands': [1.5, 2.6, 4.7] if hands is None else [hands],
'Legs': [2.0, 3.5, 6.3] if legs is None else [legs],
'Feet': [1.5, 2.6, 4.7] if feet is None else [feet],
'Shield': [0, 2.7, 5.4, 11] if shield is None else [shield]
}
all_combos = product(*gear_options.values())
best_combo = None
max_total = 0
for combo in all_combos:
total = sum(combo)
if total <= weight and total > max_total:
best_combo = combo
max_total = total
if best_combo:
selected_gear = dict(zip(gear_options.keys(), best_combo))
return {
'Total Weight': round(max_total, 2),
'Gear Selection': selected_gear
}
else:
return "No valid gear combination within the weight limit."
# Example usage:
# Position featherlight light (kg) medium (kg) heavy (kg)
# Head na 1.5 2.6 4.7
# Chest 0 3.5 6.2 11
# Hands na 1.5 2.6 4.7
# Legs na 2 3.5 6.3
# Feet na 1.5 2.6 4.7
# Shield na 2.7 5.4 11
print(gear_combo(23)) # Use all default choices
print(gear_combo(23, chest=3.5, shield=2.7)) # Force chest and shield to specific values