Context
I'm trying to create a maze resolver.
Question
Is it possible to sort & filter a list of [x, y] coordinates, more or less like dominoes, connecting 2 known coordinates ?
Input
# [2, 2] is start
# [6, 2] is end
[[2, 2], [4, 2], [5, 2], [2, 3], [4, 3], [2, 4], [3, 4], [4, 4], [2, 5], [4, 5], [5, 5], [6, 2]]
Wanted output
# Shortest path from Start to End
[[2, 2], [2, 3], [2, 4], [3, 4], [4, 4], [4, 3], [4, 2], [5, 2], [6, 2]]