I was trying to have a grid of positions with a custom x and y value for every space but everything I found was not what I was looking for. This is the array I have:
var Grid = [[[72, 169], [70, 265], [70, 365], [67, 463], [64, 563]],
[[147, 166], [150, 267], [148, 367], [147, 467], [152, 565]],
[[229, 167], [229, 267], [231, 372], [231, 466], [235, 561]],
[[311, 166], [311, 267], [316, 374], [316, 468], [317, 566]],
[[393, 165], [388, 267], [393, 372], [393, 465], [400, 560]],
[[475, 165], [475, 269], [474, 376], [472, 464], [477, 560]],
[[555, 169], [555, 266], [554, 374], [553, 459], [553, 560]],
[[631, 169], [632, 271], [633, 370], [632, 465], [638, 560]],
[[711, 175], [720, 270], [719, 368], [726, 459], [724, 552]]];
The outer arrays inside are the columns. The coordinates for each space is inside them. I want to find the closest x and y positions for a given position