code in python for robot chasing problem split in 4 parts