fai 'ai/formula/lib/recruitment.fai'

def recruit_army(ai*,unit_map)
	choose(
		filter(
			filter(
				keys( unit_map ), 'unit',
				get_unit_type( unit ).cost <= my_side.gold
			), 'unit_type',
			(
				unit_map[unit_type] -
				(
					(
						100 * 
						size(
							filter(
								my_units, 
								type = unit_type
							)
						)
					) / 
					size(my_units)
				)
			) >= 0
		),
		value
	);
	



faiend