distance abs(cy if distance smallestdistancewe want the closest treasure chest smallestdistance distance if smallestdistance = xy is directly on treasure chest chests remove([xy] return 'you have found sunken treasure chest! else if smallestdistance board[ ][ystr(smallestdistance return 'treasure detected at distance of % from the sonar device (smallestdistance else board[ ][ ' return 'sonar did not detect anything all treasure chests out of range def enterplayermove() let the player type in their move return two-item list of int xy coordinates print('where do you want to drop the next sonar device( - - (or type quit)' while true move input( if move lower(='quit' print('thanks for playing!' sys exit( move move split( if len(move= and move[ isdigit(and move[ isdigit(and isvalidmove(int(move[ ])int(move[ ])) return [int(move[ ])int(move[ ]) print('enter number from to spacethen number from to ' def playagain() this function returns true if the player wants to play againotherwise it returns false print('do you want to play again(yes or no)' return input(lower(startswith(' '