This repo proposes an approximate solution to the problem:
“A player faces a grid board game with multiple coins. At random, a number K of coins will be selected. Find the expected number of steps the player will need to take to collect all coins. The player may start at any coin and can only move up, down, right or left. All coins are guaranteed to be reachable from all other coins.”
An explanation of the code and the logic behind it is available in this article