Skip to main content
Even more better and more faster
Source Link
Veskah
  • 4.1k
  • 13
  • 29

PowerShell, 88 82 8080 74 71 bytes

-8 bytes thanks to Mazzy
-6 bytes thanks to AdmBorkBork and Mazzy
-3 bytes thanks to AdmBorkBork

param($n,$d)$n..1|%{"' "*'*($_,($n-$_))[$d]+($y="$y='/\|"[$d]\|'[$d])+("   "," $y"[$_%2],$y ")[$_%2]+$y}

Try it online!Try it online!

Uses [0,1,2] for NW, NE, N. Uses d as a list index twice to first get the spacing method (Drops off the list when using 2 which returns 0) and then which character to use when drawing the lines. Appends a list to the string of spaces (which innately has spaces between the members when appended as such) which builds the road. Also swaps between an open lane or a dash based on modulo math.

PowerShell, 88 82 80 bytes

-8 bytes thanks to Mazzy

param($n,$d)$n..1|%{" "*($_,($n-$_))[$d]+($y="/\|"[$d])+("   "," $y ")[$_%2]+$y}

Try it online!

Uses [0,1,2] for NW, NE, N. Uses d as a list index twice to first get the spacing method (Drops off the list when using 2 which returns 0) and then which character to use when drawing the lines. Also swaps between an open lane or a dash based on modulo math.

PowerShell, 88 82 80 74 71 bytes

-8 bytes thanks to Mazzy
-6 bytes thanks to AdmBorkBork and Mazzy
-3 bytes thanks to AdmBorkBork

param($n,$d)$n..1|%{' '*($_,($n-$_))[$d]+($y='/\|'[$d])," $y"[$_%2],$y}

Try it online!

Uses [0,1,2] for NW, NE, N. Uses d as a list index twice to first get the spacing method (Drops off the list when using 2 which returns 0) and then which character to use when drawing the lines. Appends a list to the string of spaces (which innately has spaces between the members when appended as such) which builds the road. Also swaps between an open lane or a dash based on modulo math.

Smart guy does smart things
Source Link
Veskah
  • 4.1k
  • 13
  • 29

PowerShell, 88 8282 80 bytes

-68 bytes thanks to Mazzy

param($n,$d)$n..1|%{" "*(0,$_,($n-$_))[$d]+($y="|$y="/\"[$d]\|"[$d])+("   "," $y ")[$_%2]+$y}

Try it online!Try it online!

Uses [0,1,2] for North, NW, NE, N. Uses d as a list index twice to first get the spacing method (Drops off the list when using 2 which returns 0) and then which character to use when drawing the lines. Also swaps between an open lane or a dash based on modulo math.

PowerShell, 88 82 bytes

-6 bytes thanks to Mazzy

param($n,$d)$n..1|%{" "*(0,$_,($n-$_))[$d]+($y="|/\"[$d])+("   "," $y ")[$_%2]+$y}

Try it online!

Uses [0,1,2] for North, NW, NE. Uses d as a list index twice to first get the spacing method and then which character to use when drawing the lines. Also swaps between an open lane or a dash based on modulo math.

PowerShell, 88 82 80 bytes

-8 bytes thanks to Mazzy

param($n,$d)$n..1|%{" "*($_,($n-$_))[$d]+($y="/\|"[$d])+("   "," $y ")[$_%2]+$y}

Try it online!

Uses [0,1,2] for NW, NE, N. Uses d as a list index twice to first get the spacing method (Drops off the list when using 2 which returns 0) and then which character to use when drawing the lines. Also swaps between an open lane or a dash based on modulo math.

added 172 characters in body
Source Link
Veskah
  • 4.1k
  • 13
  • 29

PowerShell, 8888 82 bytes

-6 bytes thanks to Mazzy

param($n,$d)$x="|/\"
$n..1|%{" "*(0,$_,($n-$_))[$d]+($y=$x[$d]$y="|/\"[$d])+("   "," $y ")[$_%2]+$y}

Try it online!Try it online!

Uses [0,1,2] for North, NW, NE. Uses d as a list index twice to first get the spacing method and then which character to use when drawing the lines. Also swaps between an open lane or a dash based on modulo math.

PowerShell, 88 bytes

param($n,$d)$x="|/\"
$n..1|%{" "*(0,$_,($n-$_))[$d]+($y=$x[$d])+("   "," $y ")[$_%2]+$y}

Try it online!

Uses [0,1,2] for North, NW, NE.

PowerShell, 88 82 bytes

-6 bytes thanks to Mazzy

param($n,$d)$n..1|%{" "*(0,$_,($n-$_))[$d]+($y="|/\"[$d])+("   "," $y ")[$_%2]+$y}

Try it online!

Uses [0,1,2] for North, NW, NE. Uses d as a list index twice to first get the spacing method and then which character to use when drawing the lines. Also swaps between an open lane or a dash based on modulo math.

Source Link
Veskah
  • 4.1k
  • 13
  • 29
Loading