# Move to point -> get data -> calc next point

# ------ Move to point -------
# == START ==
# distance betwen centers: 30
# map radious: 3+1 and centered (dx: 7, dy: 7)
# 3*30 = 90

# Starting point
execute if score column map matches 0 if score line map matches 0 run tp @s ^138 ^ ^138
execute if score column map matches 0 if score line map matches 1..6 run tp @s ^276 ^ ^-46
# Horizontal movement
execute if score column map matches 1..6 run tp @s ^-46 ^ ^

# ---------- Get data ---------
#tellraw @a [{"score":{"name":"line","objective":"map"}},{"score":{"name":"column","objective":"map"}}]
execute at @s if entity @e[tag=center,distance=..1,limit=1,tag=mapped] run function game:map/get/address


# -------- Next point ---------
scoreboard players add column map 1
# 7 is overflow of column
execute if score column map matches 7 run scoreboard players add line map 1
execute if score column map matches 7 run scoreboard players set column map 0

# ----------- loop or not -----
#tp @a @s
execute unless score line map matches 7 at @s run function game:map/get/loop
execute if score line map matches 7 run kill @s
