fn siminit{ simend=128 simlimit=32 name=$mynum type=space act=0 mainval=0 ext=0 if(~ yes no){ if(~ $mynum 0??0){ type=planet mainval=10 ext=1 } if(~ $mynum 000?){ type=freighter mainval=10 ext=1 } if(~ $mynum 11??){ type=starbase mainval=25 ext=2 } } state=($name $type $act $mainval $ext) sendout=($mynum $type $ext) echo ___INITIATE $dim dimensional simulation echo $state } fn updatestate{ name=$state(1) type=$state(2) act=$state(3) mainval=$state(4) ext=$state(5) } fn msgproc{ rname=$body(1) rtype=$body(2) rext=$body(3) if(~ $rname adm) type=update switch($type){ case update type=$body(2) act=$body(3) mainval=$body(4) ext=$body(5) echo _____ $type warps in from a wormhole case starbase mainval=`{echo $mainval '-' $ext |hoc} switch($rtype){ case space act=`{echo $act '-' 1 |hoc} case starbase act=`{echo $act '+' 2 |hoc} mainval=`{echo $mainval '-' $rext |hoc} echo $cvt starbase $rname drained $rext energy case freighter act=`{echo $act '+' 2 |hoc} mainval=`{echo $mainval '+' $rext |hoc} echo $cvt freighter $rname supplied $rext energy case planet act=`{echo $act '+' 1 |hoc} ext=`{echo $ext '+' $rext |hoc} echo $cvt planet $rname boosted production $rext } case freighter mainval=`{echo $mainval '-' $ext |hoc} switch($rtype){ case space act=`{echo $act '-' 1 |hoc} case freighter act=`{echo $act '+' 2 |hoc} mainval=`{echo $mainval '-' $rext |hoc} echo $cvt freighter $rname drained $rext fuel case starbase act=`{echo $act '+' 2 |hoc} mainval=`{echo $mainval '+' $rext |hoc} echo $cvt freighter $rname supplied $rext fuel case planet act=`{echo $act '+' 1 |hoc} ext=`{echo $mainval '+' $rext |hoc} echo $cvt planet $rname supplied $rext fuel } case planet mainval=`{echo $mainval '+' $ext |hoc} switch($rtype){ case space act=`{echo $act '-' 1 |hoc} case starbase act=`{echo $act '+' 1 |hoc} ext=`{echo $rext '+' 1 |hoc} echo $cvt starbase $rname increased production case freighter act=`{echo $act '+' 1 |hoc} mainval=`{echo $mainval '+' $rext |hoc} echo $cvt freighter $rname supplied $rext wealth case planet mainval=0 ext=0 echo $cvt planet $rname collided and destroyed the economy } } } fn tickstate{ if(test $act -gt 50){ echo $cvt OVERLOAD $name $act RESET act=25 mainval=10 ext=1 } if(test $mainval -lt 10) mainval=10 if(test $ext -lt 1) ext=1 state=($name $type $act $mainval $ext) sendout=($name $type $ext) # echo recv $rname $rtype $ext echo $cvt^':' $state }