Skip to content
Snippets Groups Projects
root.lus 848 B
-------------------------------------------------------
--Settings:
type status = enum { I, C, EB, EF };
type state = struct { st:status; par:int; d:int };

type action = enum { Rc,Reb,Ref,Ri,Rr };
const actions_number = 5;

function action_of_int(i : int ) returns (a : action);
let
  a = if i = 0 then Rc
  else if i = 1 then Reb
  else if i = 2 then Ref
  else if i = 3 then Ri
  else Rr;
tel;

-------------------------------------------------------
--Step and Enable functions(for root):
function root_enable<<const degree:int>>(this : state; neighbors : state^degree)
returns (enabled : bool^actions_number);
let
  enabled = [ false, false, false, false, false ] ;
tel;

function root_step<<const degree:int>>(
  this : state;
  neighbors : state^degree;
  action : action)
returns (new : state);
let
  new = state { st=C; par=-1; d=0 };
tel;