2022-12-22 00:48:24 +01:00
|
|
|
//valid,---------------------------------#
|
|
|
|
//--------------------------------##
|
|
|
|
//-------------------------------###
|
|
|
|
//------------------------------##-#
|
|
|
|
//-----------------------------#####
|
|
|
|
//----------------------------##---#
|
|
|
|
//---------------------------###--##
|
|
|
|
//--------------------------##-#-###
|
|
|
|
//-------------------------#######-#
|
|
|
|
//------------------------##-----###
|
|
|
|
//-----------------------###----##-#
|
|
|
|
//----------------------##-#---#####
|
|
|
|
//---------------------#####--##---#
|
|
|
|
//--------------------##---#-###--##
|
|
|
|
//-------------------###--####-#-###
|
|
|
|
//------------------##-#-##--#####-#
|
|
|
|
//-----------------########-##---###
|
|
|
|
//----------------##------####--##-#
|
|
|
|
//---------------###-----##--#-#####
|
|
|
|
//--------------##-#----###-####---#
|
|
|
|
//-------------#####---##-###--#--##
|
|
|
|
//------------##---#--#####-#-##-###
|
|
|
|
//-----------###--##-##---########-#
|
|
|
|
//----------##-#-######--##------###
|
|
|
|
//---------#######----#-###-----##-#
|
|
|
|
//--------##-----#---####-#----#####
|
|
|
|
//-------###----##--##--###---##---#
|
|
|
|
//------##-#---###-###-##-#--###--##
|
|
|
|
//-----#####--##-###-######-##-#-###
|
|
|
|
//----##---#-#####-###----########-#
|
|
|
|
//---###--####---###-#---##------###
|
|
|
|
//--##-#-##--#--##-###--###-----##-#
|
|
|
|
//-########-##-#####-#-##-#----#####
|
|
|
|
//##------######---########---##---#
|
|
|
|
//##-----##----#--##------#--###--##
|
2022-12-21 21:48:52 +01:00
|
|
|
//:END:
|
2022-12-15 20:34:56 +01:00
|
|
|
function bool bool bool => bool rule110
|
|
|
|
{
|
|
|
|
if
|
|
|
|
{
|
|
|
|
if
|
|
|
|
{
|
|
|
|
if
|
|
|
|
{
|
|
|
|
false
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if
|
|
|
|
{
|
|
|
|
deq true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-19 12:13:40 +01:00
|
|
|
|
2022-12-22 00:08:13 +01:00
|
|
|
arr val { bool 34 }
|
2022-12-21 21:48:52 +01:00
|
|
|
|
2022-12-22 00:08:13 +01:00
|
|
|
33 true val.write
|
|
|
|
printArrays
|
2022-12-21 21:48:52 +01:00
|
|
|
|
|
|
|
function int => bool int check
|
2022-12-19 12:13:40 +01:00
|
|
|
{
|
2022-12-21 21:48:52 +01:00
|
|
|
0 dup 1 > -
|
2022-12-19 12:13:40 +01:00
|
|
|
}
|
|
|
|
|
2022-12-21 21:48:52 +01:00
|
|
|
function => fullApply
|
2022-12-19 12:13:40 +01:00
|
|
|
{
|
2022-12-22 00:08:13 +01:00
|
|
|
// 0 b c
|
|
|
|
0 1 false val.read val.read
|
|
|
|
0 rule110 val2.write
|
|
|
|
val.length 1 - 1 dup - req
|
|
|
|
val.read val.read false
|
|
|
|
rule110 val.length 1
|
|
|
|
req - req val2.write
|
2022-12-21 21:48:52 +01:00
|
|
|
true 1
|
|
|
|
while
|
2022-12-19 12:13:40 +01:00
|
|
|
{
|
2022-12-21 21:48:52 +01:00
|
|
|
// i-1 i
|
|
|
|
1 dup - req
|
|
|
|
// i a | i a i | a i b | i b a i 1
|
|
|
|
val.read dup val.read req dup 1
|
|
|
|
// i a b i+1 | i+1 i a b | i a b c
|
|
|
|
req swp + req req req val.read
|
|
|
|
// i d
|
|
|
|
req rule110
|
|
|
|
// i d i | i
|
|
|
|
dup val2.write
|
|
|
|
checkUp-1
|
2022-12-19 12:13:40 +01:00
|
|
|
}
|
2022-12-22 00:08:13 +01:00
|
|
|
deq
|
2022-12-19 12:13:40 +01:00
|
|
|
}
|
|
|
|
|
2022-12-21 21:48:52 +01:00
|
|
|
function int => bool int checkUp
|
|
|
|
{
|
|
|
|
// i+1 l i+1
|
|
|
|
1 + val.length dup < req
|
|
|
|
}
|
2022-12-19 12:13:40 +01:00
|
|
|
|
2022-12-21 21:48:52 +01:00
|
|
|
function int => bool int checkUp-1
|
|
|
|
{
|
|
|
|
// i+1 l 1 | l 1 i+1 | i+1 l-1 i+1
|
|
|
|
1 + val.length 1 req - dup
|
|
|
|
// i+1 b
|
|
|
|
< req
|
|
|
|
}
|
2022-12-19 12:13:40 +01:00
|
|
|
|
2022-12-22 00:08:13 +01:00
|
|
|
arr val2 { bool 34 }
|
2022-12-21 21:48:52 +01:00
|
|
|
|
|
|
|
function => copyArrays
|
2022-12-19 12:13:40 +01:00
|
|
|
{
|
2022-12-21 21:48:52 +01:00
|
|
|
true 0
|
2022-12-19 12:13:40 +01:00
|
|
|
while
|
|
|
|
{
|
2022-12-21 21:48:52 +01:00
|
|
|
dup val2.read
|
|
|
|
dup val.write
|
|
|
|
checkUp
|
2022-12-19 12:13:40 +01:00
|
|
|
}
|
2022-12-21 21:48:52 +01:00
|
|
|
deq
|
2022-12-19 12:13:40 +01:00
|
|
|
}
|
|
|
|
|
2022-12-22 00:08:13 +01:00
|
|
|
function bool => str boolToSym
|
2022-12-19 12:13:40 +01:00
|
|
|
{
|
2022-12-21 21:48:52 +01:00
|
|
|
if
|
|
|
|
{
|
2022-12-22 00:08:13 +01:00
|
|
|
"#"
|
2022-12-21 21:48:52 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-12-22 00:08:13 +01:00
|
|
|
"-"
|
2022-12-21 21:48:52 +01:00
|
|
|
}
|
2022-12-19 12:13:40 +01:00
|
|
|
}
|
|
|
|
|
2022-12-21 21:48:52 +01:00
|
|
|
function => printArrays
|
2022-12-19 12:13:40 +01:00
|
|
|
{
|
2022-12-21 21:48:52 +01:00
|
|
|
true 0
|
|
|
|
while
|
|
|
|
{
|
2022-12-22 00:08:13 +01:00
|
|
|
dup val.read req boolToSym req print
|
2022-12-21 21:48:52 +01:00
|
|
|
checkUp
|
|
|
|
}
|
|
|
|
deq
|
|
|
|
"" println
|
2022-12-19 12:13:40 +01:00
|
|
|
}
|
|
|
|
|
2022-12-22 00:08:13 +01:00
|
|
|
true 33
|
2022-12-21 21:48:52 +01:00
|
|
|
while
|
2022-12-19 12:13:40 +01:00
|
|
|
{
|
2022-12-21 21:48:52 +01:00
|
|
|
fullApply
|
|
|
|
copyArrays
|
|
|
|
printArrays
|
|
|
|
check
|
2022-12-19 12:13:40 +01:00
|
|
|
}
|
2022-12-22 00:08:13 +01:00
|
|
|
deq
|