New answers tagged path-finding
3
votes
Delannoy numbers
K (ngn/k), 18 bytes
{0/x(+':+\)/1,y#1}
Try it online!
Port of my APL answer that does not use the binomial coefficient built-in. See the linked answer for the ...
2
votes
Train Route Planning
05AB1E, 44 bytes
æʒø2£ø˜Á2ôćRJs€ËP*}ε0svy¦¦`U©%∞<®*+Dr@ÏнX+]ß
Outputs an empty string if no valid route can be found.
What a mess.. Those arbitrary ...
2
votes
Train Route Planning
Python 3, 119 bytes
f=lambda a,n=0,t=0:t*(n==1)or min([f(a-{(x,y,s,i,d)},y,s-(s-t)//i*i+d)for x,y,s,i,d in a if x==n]or[max(sum(a,()))**2])
Try it online!
3
votes
Train Route Planning
Python3, 111 bytes:
f=lambda t,s=0,D=0:min(m)if(m:=[D]*(s==1)+[K for a,b,c,d,e in t if a==s and(K:=f(t,b,max(c%d-D,0)+D+e))])else[]
Try it online!
3
votes
Train Route Planning
JavaScript (ES6), 102 bytes
Expects an array of tuples [ from, to, base, interval, duration ]. Returns \$+\infty\$ if there's no solution.
...
Top 50 recent answers are included
Related Tags
path-finding × 131code-golf × 110
grid × 38
graph-theory × 16
ascii-art × 14
code-challenge × 14
maze × 14
decision-problem × 11
puzzle-solver × 9
game × 7
string × 5
geometry × 5
king-of-the-hill × 5
sequence × 4
graphical-output × 4
matrix × 4
sorting × 4
optimization × 4
array × 4
math × 3
combinatorics × 3
permutations × 3
fastest-code × 3
chess × 3
hexagonal-grid × 3