Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Mutual-recursion/LSL/mutual-recursion.lsl
Normal file
30
Task/Mutual-recursion/LSL/mutual-recursion.lsl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
integer iDEPTH = 100;
|
||||
integer f(integer n) {
|
||||
if(n==0) {
|
||||
return 1;
|
||||
} else {
|
||||
return n-m(f(n - 1));
|
||||
}
|
||||
}
|
||||
integer m(integer n) {
|
||||
if(n==0) {
|
||||
return 0;
|
||||
} else {
|
||||
return n-f(m(n - 1));
|
||||
}
|
||||
}
|
||||
default {
|
||||
state_entry() {
|
||||
integer x = 0;
|
||||
string s = "";
|
||||
for(x=0 ; x<iDEPTH ; x++) {
|
||||
s += (string)(f(x))+" ";
|
||||
}
|
||||
llOwnerSay(llList2CSV(llParseString2List(s, [" "], [])));
|
||||
s = "";
|
||||
for(x=0 ; x<iDEPTH ; x++) {
|
||||
s += (string)(m(x))+" ";
|
||||
}
|
||||
llOwnerSay(llList2CSV(llParseString2List(s, [" "], [])));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue