Translate Ruby pick_up_the_gold(grid) method into pseudocode