Correction to AI HW1

Changed criteria for loop detection from path cost to depth cost.