Simple algorithm to generate grid road from point to point

Hi,
I have problem with creating ‘for’ loops to generate tile based road from point to point. It should looks like on the pictures with examples - road should ‘break’ symmetrically depending on the start and end coordinates in all directions.
5411343--549762--upload_2020-1-27_8-28-55.png5411343--549765--upload_2020-1-27_8-30-57.png

Thanks for help in advance!

5411343--549756--upload_2020-1-27_8-25-31.png
5411343--549762--upload_2020-1-27_8-28-55.png

can use this to walk through those coordinates,

Thank you.
But how to ‘translate’ this to c#?

i have one version here (need to remove some of those extras there though)

here’s unityscript version (without those extras)

Thank you very much.
It works very well.
Can I use your implementation for my project? Is it cc0?

yes go ahead, i’ve converted it from that wiki article example