// killme.txt

var generator(n){
	if(n<2)return PROGRAM({1,5,18,3,7,"x","y"}[#]);
	a=(int)(n/{1.4,2}[#]);
	if(#?1:0)a=n-a;
	b=n-a;
	operators={"+","-","*","|","&"};
	command=PROGRAM("#"+operators[#]+"#");
	command.setSub({0},generator(a));
	command.setSub({1},generator(b));
	return command;
}


void main(functionName){
	if(!isset(functionName)){
		main(getThisFunctionName());
		main("generator");
		return;
		}
	f=getFunction(functionName);
	ids=f.getIDs()+{f.Root()};
	pos=ids[#];
	next=f.Next(pos);
	isElse=0;
	if(typeof(next)=="vector")isElse=rand()%next.size();
	pos=f.insertDown(pos,isElse);
	f.setCommand(pos,generator(5));
	pos=f.insertDown(pos);
	f.setIF(pos,"#?1:0");
/*
	pos=f.insertDown(pos,0);
	f.setCommand(pos,generator(4));
*/
}

