use "../OverMind.pl" as knowledge.
order = linear.

/**
* Frees up the resources required to perform the given thing.
*/
module FreeResources(Thing) {
	if	bel(costs(Thing, MinC, GasC, _, _, _), costOverhead(MinO, GasO), NewMin is MinO - MinC, NewGas is GasO - GasC) then
				delete(costOverhead(MinO, GasO)) +
				insert(costOverhead(NewMin, NewGas)).
			
	if	bel(researchLevel(Thing, Level), NextLevel is Level + 1, atomic_list_concat([Thing, ' ', NextLevel], ThingLevel),
			costs(ThingLevel, MinC, GasC, _, _, _), costOverhead(MinO, GasO), NewMin is MinO - MinC, NewGas is GasO - GasC) then
				delete(costOverhead(MinO, GasO)) +
				insert(costOverhead(NewMin, NewGas)).
			
}
