Maze solving: Difference between revisions

→‎{{header|Uiua}}: Made the code standalone.
(Added Uiua solution)
(→‎{{header|Uiua}}: Made the code standalone.)
 
Line 5,809:
 
<syntaxhighlight lang="uiua">
# You can delete from here to SOLVE THE MAZE
# if you're appending this to the maze generator code.
# Experimental!
["+-+-+-+-+-+-+"
"|. . .|. . .|"
"+-+-+ + + + +"
"|.|. .|.|.|.|"
"+ + +-+-+ + +"
"|.|. . . .|.|"
"+ +-+-+-+-+ +"
"|. . . . . .|"
"+-+-+-+-+-+-+"]
H ← 4
W ← 6
Nfour ← +⊙¤[¯2_0 2_0 0_2 0_¯2] # Gives N4
InBounds ← ▽⊸≡(↧⊃(/↧≥1_1|/↧< +1 × 2 H_W))
GetWall ← -:⊡1:÷2/-.
# S O L V E T H E M A Z E #
.
Line 5,818 ⟶ 5,835:
astar(Ns|Heur|≍End) Start # Solve (costs = 1 => djikstra)
$"_ moves" ⊙⟜(⍜(⊡|+33)):°□⊢
 
</syntaxhighlight>
{{out}}
159

edits