Write a function
count_near_positions() that takes two arguments:
checkers_positions – a list of all checker positions in a rectangle board during play (which are tuples
(x, y)). Each tuple on the list corresponds to the consecutive checker's position during the game.
treasure_position – the position (as a tuple) of a treasure on that game board.
Calculate how many times the checker's distance from the treasure was less than 2 during a game and return the result in your function. Here's how you can count the distance between the treasure with coordinates (x_1, y_1) and the checker with coordinates (x_2, y_2):
distance =|x_1 - x_2| + |y_1 - y_2|