English Page
Elementary Techniques | Techniques of Function | Techniques of Recursion |Techniques of Number
a(X,T):XXa(sX,T-1)XX a(a(,3)a(r,9)r,1)
a(X,T):a(sX,T-1)XX a(ra(r,6),100)
a(T):rsrrsr b(T):a(2-T)b(T-5) c(T):b(T)sc(T-1) c(20)
In this code, b(T) equals "rsrrsr" if T≡1 mod 5, and no moves otherwise.
a(T):sa(T-5) b(T):a(T)rb(T+7) b(1)
The speed of growth is "7/5".
f(T):sf(T-4)rf(T+7) f(8)
This code realizes the loop
a:ssrsssrsssrsssra a
In this loop, the number of "s" equals 4 + 7, and the number of "r" equals 7.
In generally, the code
f(T):[1]f(T-A)[2]f(T+B)
implies a loop with (A+B) times of "[1]" and B times of "[2]".
a(T):sa(T-37)ra(T+83) a(1)
Since 83/37 approximately equals 9/4, this code is similar to
a(T):sa(T-4)ra(T+9) a(1)
but the small difference changes the direction of the movement.
Therefore, "square minus square" shape can be drawn by a 12B code.
f(T):sf(T-15)rf(T+T+63) f(1)
Some new sequence can be obtained by changing the coefficient of degree = 1.
In this case, the periodic sequence
1,[5,5,6,7],[5,5,6,7],[5,5,6,7],...
appears.
f(T):sf(T-4)rf(T-7) f(255)
Probably, no problems in HOJ requires this method (even for "best solution") at this moment.
a(T,A):ra(T-A,A) f(T):a(T,64)sa(T,16)sa(T,4)sa(T,1)s
By f(1 to 255), you can make all patterns of four step move, except "ssss".
a(T,X):X b(A,B,X):b(A-127,B,s)a(128-A,Xb(A+A,B-1,r)) f(T):b(T,8,r)
All strings of length=8, made of "s" and "r" can be made by f(1 to 255), but for "srrrrrrr" ans "rrrrrrrr".
a(T,X):X b(A,B):lb(A-81,B)a(82-A,llsb(A+A+A,B-1)) f(T):b(T,5)
f(X,T):rXf(f(sX,T-1),10) f(,1)
f(X,T):Xf(rf(sX,T-1),10) f(,1)