Manhattan Directions Code Golf This code golf challenge is to show directions through numbers.

When the user enters a number, then that means a direction change as follows:

0 means stay still
1 means forward (initially from left to right and initially start with `:`)
2 means turn right
3 means turn left
4 means go backward


I will show you an example: 122123333114

1 means 1 step forward 

:═&gt;


2 means 1 step to the right  

   :═╗
     ‖
     V


2 means 1 step to the right   

    :═╗
      ‖
    &lt;═╝


1 means 1 step forward  

    :═╗
      ‖
   &lt;══╝


2 means 1 step to the right 

   ^:═╗
   ‖  ‖
   ╚══╝


3 means 1 step to the left 

 &lt;═╗:═╗
   ‖  ‖
   ╚══╝


3 means 1 step to the left 

 ╔═╗:═╗
 ‖ ‖  ‖
 V ╚══╝


3 means 1 step to the left 

 ╔═╗:═╗
 ‖ ‖  ‖
 ╚═&gt;══╝


3 means 1 step to the left 

 ╔═^:═╗
 ‖ ‖  ‖
 ╚═╝══╝


1 means 1 step forward

   ^
 ╔═‖:═╗
 ‖ ‖  ‖
 ╚═╝══╝


1 means 1 step forward

   ^
   ‖
 ╔═‖:═╗
 ‖ ‖  ‖
 ╚═╝══╝


4 means 1 step backward

   ‖
 ╔═V:═╗
 ‖ ‖  ‖
 ╚═╝══╝


These are the rules:


Start with : and the initial direction will be from left to right


If starting with 0, then start with:

:


If starting with 1, then start with:

:=&gt;


If starting with 2 then start with:

:╗
 ‖
 V


If starting with 3, then start with:

 ^
 ‖
:╝


If starting with 4, then start with:

&lt;=:



Any other numbers or letters in the input will be ignored


T6@1 92J;{4 will mean 124


If two arrows came on top of each other, the new arrow should overwrite the old one


An example of this:

 ╔═╗:═╗
 ‖ ‖  ‖
 V ╚══╝


3 means 1 step to the left 

 ╔═╗:═╗
 ‖ ‖  ‖
 ╚═&gt;══╝



Arrow head should be &gt; for left to right direction
Arrow head should be &lt; for right to left direction
Arrow head should be V for top to bottom direction
Arrow head should be ^ for bottom to top direction


Do not forget the joint if you turn.

:╗
 ‖
 V

  :
&lt;═╝

^
‖ 
╚:

╔═&gt;
:


I hope I did not miss anything.
If you have any questions or if I missed anything, I will be editing this post.
Ruby, 302 306 322 327 bytes

+4 bytes to fix the edge case with the \$-i\$ direction (its angle is negative so we need to mod 4)
+16 bytes for even more edge case fixes in the stepping algorithm...
+5 bytes to fix the edge case where no inputs from 1-4 are present.


P=Math::PI/2
b=0i;f=d=p
c={b=&gt;?:}
gsub(/[1-4]/){x=$&amp;.to_i;d||=1
c[b+=d]=&quot;╗╝╚╔╗&quot;[d.arg/P%4+x%2]if x[1]&gt;0
d*=[0,1,1i,-1i,-1][x]
c[b+=d]=&quot;═║&quot;[d.imag.abs]if x&lt;4||!f
f=1}
c[b+=d]=&quot;&gt;V&lt;^&quot;[d.arg/P]if d
q=c.keys.map &amp;:rect
q=q.pop.zip *q
i,j=q[0].minmax
k,l=q[1].minmax
puts (k..l).map{|y|(i..j).map{|x|c[x+y*1i]||' '}*''}

Try it online!
Explanation
We initiate the grid as a hash table where the keys are complex numbers (real is the X-axis, imaginary is the Y-axis, lower numbers are closer to the top-left corner). This is convenient because we can initialize the direction variable as \$1\$, multiply by \$i\$ to turn right, and multiply by \$-i\$ to turn left. Also, we can quickly determine which way we're facing by dividing the direction's angle by \$\pi/2\$ and use that in our lookup tables.
Our algorithm, then, is roughly as follows:

Get the next number from the input in the range 1-4.
If the number is 2-3, step once and add the correct corner piece.
Look up the corresponding direction change and multiply.
Step once and add the correct straight piece. (Don't need to step if we turn around.)
Repeat until done.
Step and add the arrow piece.
Print the grid.

Code explanation (out of date, will fix later)
P=Math::PI/2                            # Save PI/2
b=0i;d=1                                # Set initial coordinates and direction
c={b=&gt;?:}                               # Create grid with starting `:`
gsub(/[1-4]/){x=$&amp;.to_i                 # For each number 1-4
c[b+=d]=&quot;╗╝╚╔╗&quot;[d.arg/P+x%2]if x[1]&gt;0   # If 2-3 (second bit is a 1), step and write the corner piece
                                        # If turning left (3), +1 to the index
d*=[0,1,1i,-1i,-1][x]                   # Multiply direction to turn accordingly
c[b+=d]=&quot;═‖&quot;[d.imag.abs]                # Step and write the straight piece
}                                       # (end the loop)
c[b]=&quot;&gt;V&lt;^&quot;[d.arg/P]                    # Write the corresponding arrow piece
q=c.keys.map &amp;:rect                     # Get the filled-in grid spaces as X,Y coordinates
i,*_,j=q.map(&amp;:first).sort              # Find the min and max X coordinate
k,*_,l=q.map(&amp;:last).sort               # Find the min and max Y coordinate
puts (k..l).map{|y|                     # For each Y coordinate in range
      (i..j).map{|x|                    # For each X coordinate in range
                    c[x+y*1i]||' '      # Get the character, or space if not present
                }*''                    # Join characters on that Y coordinate and print
        }