Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
26
Task/Maze-solving/Uiua/maze-solving.uiua
Normal file
26
Task/Maze-solving/Uiua/maze-solving.uiua
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# 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 #
|
||||
.
|
||||
Start ← 1_1
|
||||
End ← -Start ×2 H_W
|
||||
Heur ← /+⌵-End # Manhattan distance.
|
||||
# (pos grid) -> 1-4 next steps, in bounds, without walls in the way.
|
||||
Ns ← ≡⊡1▽:⟜(≡(=@ ⊡)⊙¤≡GetWall)≡⊟¤:InBounds Nfour.
|
||||
astar(Ns|Heur|≍End) Start # Solve (costs = 1 => djikstra)
|
||||
$"_ moves" ⊙⟜(⍜(⊡|+33)):°□⊢
|
||||
Loading…
Add table
Add a link
Reference in a new issue