if not isvalidmove(xy)return false in the sonar gamethe game board is updated to display number for each sonar device dropped to show how far away the closest treasure chest is so when the player makes move by giving the program an and coordinatethe board changes based on the positions of the treasure chests the makemove(function takes four parametersthe game board data structurethe treasure chests data structureand the and coordinates line returns false if the and coordinates if was passed do not exist on the game board if isvalidmove(returns falsethen makemove(will itself return false otherwisemakemove(will return string value describing what happened in response to the moveif the coordinates land directly on the treasuremakemove(returns 'you have found sunken treasure chest!if the coordinates are within distance of or lessmakemove(returns 'treasure detected at distance of % from the sonar device (where % is replaced with the integer distanceotherwisemakemove(will return 'sonar did not detect anything all treasure chests out of range chest smallestdistance any chest will be closer than for cxcy in chestsif abs(cx xabs(cy )distance abs(cx xelsedistance abs(cy yif distance smallestdistancewe want the closest treasure smallestdistance distance given the coordinates of where the player wants to drop the sonar device and list of xy coordinates for the treasure chestsyou'll need an algorithm to find out which treasure chest is closest post questions to