 
 		push 'function applyLeaveRules (prevPosition) {'
 
-		push 'var terrainItem = getTerrainItem(prevPosition)'
-
-		push 'var inventoryItem = getInventoryItem()'
+		push 'const terrainItem = getTerrainItem(prevPosition)'
 
 		ruleLines = makeList()
 		rules.forEach (rule) ->


		push 'function applyNearRules (position) {'

		push 'var inventoryItem = getInventoryItem()'

		push 'getNeighbors(position).forEach((neighbor) => {'

		push 'var terrainItem = getTerrainItem(neighbor)'

		ruleLines = makeList()
		rules.forEach (rule) ->

			when '_inventory'
				'inventoryItem'
			else
				"'#{reference}'"


	makeList = ->
