return string from the board data structure at certain row boardrow ' for in range( ) boardrow +board[ ][row return boardrow def getnewboard() create new board data structure board [ for in range( )the main list is list of lists board append([] for in range( )each list in the main list has singlecharacter strings use different characters for the ocean to make it more readable if random randint( = board[xappend('~' else board[xappend('`' return board def getrandomchests(numchests) create list of chest data structures (two-item lists of xy int coordinates chests [ for in range(numchests) chests append([random randint( )random randint( )] return chests def isvalidmove(xy) return true if the coordinates are on the boardotherwise false return > and and < def makemove(boardchestsxy) change the board data structure with sonar device character remove treasure chests from the chests list as they are found return false if this is an invalid move otherwisereturn the string of the result of this move if not isvalidmove(xy) return false smallestdistance any chest will be closer than for cxcy in chests if abs(cx xabs(cy ) distance abs(cx elsepost questions to