-
Notifications
You must be signed in to change notification settings - Fork 1
/
Euler_Problem-015 (old).b93
35 lines (24 loc) · 1.09 KB
/
Euler_Problem-015 (old).b93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
v1234567890123456789012345678901234567890123456789
> "" 393*+ "" 01p v
v p150p140p130p120<
vp13+1g13p15+1g15p0g130<
> 01g:41g-\51g-*!#v_ ^
v < >$21g.@
v p0g13" "p14-1g14<
> 21g1+21p >31g:1-31p!#^_31g0g|
^p13+1g13p0g131p14+1g14p15-1g15<
[0,0] - [50,0] Recursion Array
[0,1] SIZE
[2,1] Count
[3,1] Array Pos
[4,1] Distance X (d: {1} )
[5,1] Distance Y (d: {0} )
{0} => Down
{1} => Right
---------------------------------------
This one was a little more complex, especially because we can't simply do recursion
In the top row we log our current path, a `0` means here "go down" and a `1` "go right".
We also remember our current position, once either X or Y has reached 20 the path is complete and we increment our counter.
Then we back trace the path until we reach a `0`, then we change it to a `1` and go on with `0` until the path is again full.
This way we iterate through all possible paths and can later output the count.
By the way, this program can work with every field size, just change the `292*+` value (an perhaps the program width so that the log fits)