*IF statement [#i204bb42]
**Sample Code 1[#u01684dc]
 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. 

**Examples [#p8f6fdb5]


*Rational Growth [#o3f31f90]
**Sample Code [#u01684dc]
**Examples [#p8f6fdb5]

*12B method [#c43b9803]
**Sample Code [#u01684dc]
 f(T):sf(T-4)rf(T+7)
 f(8)

This code realizes the loop
 a:ssrsssrsssrsssr
 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]".

**Sample Code 2 [#yf2cc31b]
 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. 

**Sample Code 3 [#b0833cb0]
係数が1じゃないやつ
**Examples [#p8f6fdb5]

*Random walk by a numerical function [#q769cd56]
**Sample Code [#wa54fc27]
 f(T):sf(T-4)rf(T-7)
 f(255)

**Examples [#uce7bcab]
Probably, no problems in HOJ requires this method (even for "best solution") at this moment.

*Function of the form "[1]X[2]" [#g4076fa7]

*Replace in a recursive function [#eb7b48e9]
**Sample Code 1 [#e3a7c461]
 a(X):XXXXrXXXXla(srslX)
 a(r)
 (20B)
 
The code above can be compressed by replacing XXXX by another variable.
 a(X,Y):YrYla(srslX,XXXX)
 a(r,)
 (19B)

**Examples [#o5494688]

Zとか?

*Multiple recursion [#z2d43815]
**Sample Code 1 [#i62107f5]
 f(X):ssXlssf(sX)
 f()
 (12B)
This code can be compressed by recycling "ss":
 f(X):ssXlf(f(sX))
 f()
 (11B)

**Sample Code 2 [#pd3c6df3]
育たない再帰とかで


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS