From 1d39ea54ca363780bde5e340ecb1d9781c7601f5 Mon Sep 17 00:00:00 2001
From: erwan <erwan.jahier@univ-grenoble-alpes.fr>
Date: Tue, 31 Aug 2021 15:44:01 +0200
Subject: [PATCH] Fix: the neigbors were sucessors instead of predecessors

---
 lib/algo/algo.mli               |  8 +--
 lib/sasacore/diameter.ml        |  5 +-
 lib/sasacore/simuState.ml       |  4 +-
 lib/sasacore/topology.ml        | 92 +++++++++++++++++----------------
 lib/sasacore/topology.mli       |  6 +--
 test/dfs/4.12.0/g.rif.exp       | 30 ++++++-----
 test/dfs/4.12.0/test1.rif.exp   | 44 +++++++++-------
 test/dfs/Makefile               |  8 +--
 test/dijkstra-ring/ring.rif.exp | 31 +++++++----
 tools/gg-deco/ggDeco.ml         | 14 ++---
 tools/gg/classicGraph.ml        | 40 +++++++-------
 tools/gg/graphGen.ml            | 12 ++---
 tools/gg/randomGraph.ml         | 53 +++++++++----------
 tools/gg/udgUtils.ml            | 10 ++--
 tools/rdbg4sasa/dot4sasa.ml     |  2 +-
 tools/rdbg4sasa/gtkgui.ml       |  6 +--
 16 files changed, 196 insertions(+), 169 deletions(-)

diff --git a/lib/algo/algo.mli b/lib/algo/algo.mli
index 58103e35..fdc6e0f3 100644
--- a/lib/algo/algo.mli
+++ b/lib/algo/algo.mli
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 27/08/2021 (at 14:37) by Erwan Jahier> *)
+(* Time-stamp: <modified the 31/08/2021 (at 15:43) by Erwan Jahier> *)
 (** {1 The Algorithm programming Interface}
 
     A SASA process is an instance of an algorithm defined via this
@@ -116,12 +116,14 @@ val is_connected : unit -> bool
 val links_number : unit -> int
 val diameter : unit -> int
 
-(**  {3 Trees} *)
+(**  {3 Trees}
 
-(** a tree is an a-cyclic and connected graph (directed or not) *)
+     a tree is an a-cyclic and connected graph (directed or not) *)
 val is_tree : unit -> bool
+
 (** an in-tree is a _directed_ tree where all nodes have at most one _predecessor_ *)
 val is_in_tree : unit -> bool
+
 (** an out-tree is a _directed_ tree where all nodes have at most one _successor_ *)
 val is_out_tree : unit -> bool
 
diff --git a/lib/sasacore/diameter.ml b/lib/sasacore/diameter.ml
index 5026a3da..15408355 100644
--- a/lib/sasacore/diameter.ml
+++ b/lib/sasacore/diameter.ml
@@ -9,8 +9,9 @@ let (graph_to_adjency: Topology.t -> int array array) =
   fun t->
   let taille = List.length t.nodes in
   let mat = Array.make_matrix (taille) (taille) 0 in
-  List.iter (fun n -> (List.iter (fun (_,m) ->  mat.(pos n.Topology.id t.nodes).(pos m t.nodes) <- 1 )
-                         (t.succ n.Topology.id) ) ) (t.nodes);
+  List.iter (fun n ->
+      (List.iter (fun (m) ->  mat.(pos n.Topology.id t.nodes).(pos m t.nodes) <- 1 )
+         (t.succ n.Topology.id) ) ) (t.nodes);
   mat
 
     
diff --git a/lib/sasacore/simuState.ml b/lib/sasacore/simuState.ml
index 03a5b8ee..0f49939f 100644
--- a/lib/sasacore/simuState.ml
+++ b/lib/sasacore/simuState.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 28/07/2021 (at 11:37) by Erwan Jahier> *)
+(* Time-stamp: <modified the 27/08/2021 (at 15:10) by Erwan Jahier> *)
 
 open Register
 
@@ -13,7 +13,7 @@ let (update_env_with_init : 'v Env.t -> 'v Process.t list -> 'v Env.t) =
 
 let (get_neighors: Topology.t -> Topology.node_id -> 'v -> 'v Register.neighbor list) =
   fun g source_id init ->
-    let idl = g.succ source_id in
+  let idl = g.pred source_id in
     List.map
       (fun (w, neighbor_id) ->
          let node = g.of_id neighbor_id in
diff --git a/lib/sasacore/topology.ml b/lib/sasacore/topology.ml
index b6b9b8ca..5e6bb183 100644
--- a/lib/sasacore/topology.ml
+++ b/lib/sasacore/topology.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 27/08/2021 (at 14:30) by Erwan Jahier> *)
+(* Time-stamp: <modified the 27/08/2021 (at 17:02) by Erwan Jahier> *)
 
 open Graph
 open Graph.Dot_ast
@@ -13,8 +13,8 @@ type node = {
 
 type t = {
   nodes: node list;
-  succ: node_id -> (int * node_id) list;
-  pred: node_id -> node_id list;
+  pred: node_id -> (int * node_id) list;
+  succ: node_id -> node_id list;
   of_id: node_id -> node;
   directed:bool;
   attributes:  (string * string) list;
@@ -23,15 +23,15 @@ type t = {
 type node_info_t = (string, node) Hashtbl.t
 let node_info:node_info_t = Hashtbl.create 100
 
-type node_succ_t = (string, int * node_id) Hashtbl.t
-let node_succ:node_succ_t = Hashtbl.create 100
-type node_pred_t = (string, node_id) Hashtbl.t
+type node_pred_t = (string, int * node_id) Hashtbl.t
 let node_pred:node_pred_t = Hashtbl.create 100
+type node_succ_t = (string, node_id) Hashtbl.t
+let node_succ:node_succ_t = Hashtbl.create 100
 
 let clean_tbl () =
   Hashtbl.clear node_info;
-  Hashtbl.clear node_succ;
-  Hashtbl.clear node_pred
+  Hashtbl.clear node_pred;
+  Hashtbl.clear node_succ
 
 let (of_id:Dot_ast.id -> string) =
   function Ident str | Html str | Number str | String str -> str
@@ -114,12 +114,12 @@ let (do_stmt: bool -> node list * attrs -> Dot_ast.stmt -> node list * attrs) =
         if n1 = n2 then failwith
             (Printf.sprintf
                "Bad topology: %s can not ne a neighbor of itself!" n1);
-        let pn1 = Hashtbl.find_all node_succ n1 in
-        let pn2 = Hashtbl.find_all node_succ n2 in
-        if not (List.mem (weight,n2) pn1) then
-          Hashtbl.add node_succ n1 (weight,n2);
-        if not directed && not (List.mem (weight,n1) pn2) then
-          Hashtbl.add node_succ n2 (weight,n1);
+        let pn1 = Hashtbl.find_all node_pred n1 in
+        let pn2 = Hashtbl.find_all node_pred n2 in
+        if not (List.mem (weight,n1) pn2) then
+          Hashtbl.add node_pred n2 (weight,n1);
+        if not directed && not (List.mem (weight,n2) pn1) then
+          Hashtbl.add node_pred n1 (weight,n2);
         n2
       in
       ignore (List.fold_left add_edge node nodes);
@@ -141,10 +141,10 @@ let (read: string -> t) = fun f ->
     List.fold_left (do_stmt dot_file.digraph) ([], []) dot_file.stmts
   in
   Hashtbl.iter
-    (fun pid (_, pid_succ) ->
-       Hashtbl.add node_pred pid_succ pid
+    (fun pid (_, pid_pred) ->
+       Hashtbl.add node_succ pid pid_pred
     )
-    node_succ;
+    node_pred;
   let succ str = Hashtbl.find_all node_succ str in
   let pred str = Hashtbl.find_all node_pred str in
   {
@@ -167,8 +167,9 @@ let (to_adjacency: t -> bool array array) =
     List.iteri (fun i n -> Hashtbl.add rank_node_tbl n.id i) t.nodes;
     List.iteri
       (fun i n  ->
-         List.iter (fun (_,target) ->
-             m.(i).(rank_node target) <- true) (t.succ n.id)
+         List.iter
+           (fun (target) -> m.(i).(rank_node target) <- true)
+           (t.succ n.id)
       )
       t.nodes;
     m
@@ -214,12 +215,12 @@ let directed_is_cyclic : t -> bool =
   fun g ->
   assert (g.directed);
   let t = Hashtbl.create (List.length g.nodes) in
-  let nodes = List.map (fun n -> n.id) g.nodes in
+  let nodes = List.map (fun n -> 0 (* fake weight *), n.id) g.nodes in
   let color pid = match Hashtbl.find_opt t pid with
       Some c -> c | None -> assert false
   in
-  List.iter (fun n -> Hashtbl.add t n W) nodes;
-  let rec visit pid =
+  List.iter (fun (_, n) -> Hashtbl.add t n W) nodes;
+  let rec visit (_,pid) =
     match color pid with
     | G -> raise Cycle
     | B -> ()
@@ -238,7 +239,7 @@ let is_connected : t -> bool =
     if Hashtbl.mem visited pid then acc else
       (Hashtbl.add visited pid pid;
        List.fold_left f (pid::acc)
-         (List.rev_append (List.map snd (g.succ pid)) (g.pred pid))
+         (List.rev_append (g.succ pid) (List.map snd (g.pred pid)) )
       )
   in
   let accessible = f [] (List.hd g.nodes).id in
@@ -252,19 +253,22 @@ let bfs : (t -> string -> bool * string list) =
   Queue.add n q;
   while not (Queue.is_empty q) do
     let node = Queue.take q in
-    parent := List.fold_left (fun parents (_,suc) ->
-        if List.for_all (fun disc -> disc <> suc) !discovered
-        then (
-          Queue.add suc q;
-          discovered := (suc)::!discovered;
-          function a -> if a = suc then node else parents a
-        ) else ((
-            if suc <> (parents node)
-            then
-              cyclic := true);
-           parents
-          )
-      ) !parent (t.succ node)
+    parent :=
+      List.fold_left
+        (fun parents suc ->
+           if List.for_all (fun disc -> disc <> suc) !discovered
+           then (
+             Queue.add suc q;
+             discovered := (suc)::!discovered;
+             function a -> if a = suc then node else parents a
+           ) else ((
+               if suc <> (parents node)
+               then
+                 cyclic := true);
+              parents
+             ))
+        !parent
+        (t.succ node)
   done;
   (!cyclic, !discovered)
 
@@ -301,7 +305,7 @@ let (reply: t -> string -> string -> int) =
   fun g p p_neighbor  ->
     let rec f i = function
       | [] -> (-1) (* may happen in directed graphs *)
-      | (_w,x)::t -> if x=p then i else f (i+1) t
+      | x::t -> if x=p then i else f (i+1) t
     in
     f 0 (g.succ p_neighbor)
 
@@ -309,7 +313,7 @@ let (reply_pred: t -> string -> string -> int) =
   fun g p p_neighbor  ->
     let rec f i = function
       | [] -> (-1) (* may happen in directed graphs *)
-      | x::t -> if x=p then i else f (i+1) t
+      | (_,x)::t -> if x=p then i else f (i+1) t
     in
     f 0 (g.pred p_neighbor)
 
@@ -334,15 +338,15 @@ let is_out_tree g =
 
 (* Donne les enfants d'un noeud dans un in-tree (liens partent de la racine) *)
 let children_in g pid =
-  List.map snd (g.succ pid)
+  g.succ pid
 
 (* Donne les enfants d'un noeud dans un out-tree (liens vers la racine) *)
 let children_out g pid =
-  g.pred pid
+  List.map snd (g.pred pid)
 
 (* Donne les enfants d'un noeud dans un in-out-tree *)
 let children_in_out g pid =
-  let succ = List.map snd (g.succ pid) in
+  let succ = g.succ pid in
   if is_root_pid pid then succ
   else List.tl succ
   (* pour tous les noeuds sauf la racine, le parent est la tête de succ
@@ -351,16 +355,16 @@ let children_in_out g pid =
 let parent_in g pid =
   match g.pred pid with
   | [] -> None
-  | id::_ -> Some id
+  | (_,id)::_ -> Some id
 
 let parent_out g pid =
   match g.succ pid with
   | [] -> None
-  | (_,id)::_ -> Some (id)
+  | id::_ -> Some id
 
 let parent_in_out g pid =
   if is_root_pid pid then None
-  else Some (snd (List.hd (g.succ pid)))
+  else Some (List.hd (g.succ pid))
   (* Le parent est le premier dans la liste succ pour un in-out-tree ou un rooted-tree *)
 
 let get_parent = fun g pid ->
diff --git a/lib/sasacore/topology.mli b/lib/sasacore/topology.mli
index bfde2a63..cb31a7c0 100644
--- a/lib/sasacore/topology.mli
+++ b/lib/sasacore/topology.mli
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 27/08/2021 (at 09:25) by Erwan Jahier> *)
+(* Time-stamp: <modified the 27/08/2021 (at 15:35) by Erwan Jahier> *)
 
 (** {1 Topology: internal representation of Graphs } *)
 
@@ -12,8 +12,8 @@ type node = {
 
 type t = {
   nodes: node list; (** *)
-  succ: node_id -> (int * node_id) list; (** get neighbors, with weight *)
-  pred: node_id -> node_id list;
+  pred: node_id -> (int * node_id) list; (** get neighbors, with weight *)
+  succ: node_id -> node_id list;
   of_id: node_id -> node; (** *)
   directed:bool; (** true if the graph is directed *)
   attributes:  (string * string) list (** (name, value) list of graph attributes *)
diff --git a/test/dfs/4.12.0/g.rif.exp b/test/dfs/4.12.0/g.rif.exp
index 3878613c..be13a417 100644
--- a/test/dfs/4.12.0/g.rif.exp
+++ b/test/dfs/4.12.0/g.rif.exp
@@ -2,21 +2,23 @@
 #outputs "p1_path0":int "p1_path1":int "p1_path2":int "p1_path3":int "p1_path4":int "p1_path5":int "p1_path6":int "p1_path7":int "p1_path8":int "p1_path9":int "p1_par":int "p2_path0":int "p2_path1":int "p2_path2":int "p2_path3":int "p2_path4":int "p2_path5":int "p2_path6":int "p2_path7":int "p2_path8":int "p2_path9":int "p2_par":int "p3_path0":int "p3_path1":int "p3_path2":int "p3_path3":int "p3_path4":int "p3_path5":int "p3_path6":int "p3_path7":int "p3_path8":int "p3_path9":int "p3_par":int "p4_path0":int "p4_path1":int "p4_path2":int "p4_path3":int "p4_path4":int "p4_path5":int "p4_path6":int "p4_path7":int "p4_path8":int "p4_path9":int "p4_par":int "p5_path0":int "p5_path1":int "p5_path2":int "p5_path3":int "p5_path4":int "p5_path5":int "p5_path6":int "p5_path7":int "p5_path8":int "p5_path9":int "p5_par":int "p6_path0":int "p6_path1":int "p6_path2":int "p6_path3":int "p6_path4":int "p6_path5":int "p6_path6":int "p6_path7":int "p6_path8":int "p6_path9":int "p6_par":int "p7_path0":int "p7_path1":int "p7_path2":int "p7_path3":int "p7_path4":int "p7_path5":int "p7_path6":int "p7_path7":int "p7_path8":int "p7_path9":int "p7_par":int "p8_path0":int "p8_path1":int "p8_path2":int "p8_path3":int "p8_path4":int "p8_path5":int "p8_path6":int "p8_path7":int "p8_path8":int "p8_path9":int "p8_par":int "p9_path0":int "p9_path1":int "p9_path2":int "p9_path3":int "p9_path4":int "p9_path5":int "p9_path6":int "p9_path7":int "p9_path8":int "p9_path9":int "p9_par":int "p10_path0":int "p10_path1":int "p10_path2":int "p10_path3":int "p10_path4":int "p10_path5":int "p10_path6":int "p10_path7":int "p10_path8":int "p10_path9":int "p10_par":int "Enab_p1_update_path":bool "Enab_p1_compute_parent":bool "Enab_p2_update_path":bool "Enab_p2_compute_parent":bool "Enab_p3_update_path":bool "Enab_p3_compute_parent":bool "Enab_p4_update_path":bool "Enab_p4_compute_parent":bool "Enab_p5_update_path":bool "Enab_p5_compute_parent":bool "Enab_p6_update_path":bool "Enab_p6_compute_parent":bool "Enab_p7_update_path":bool "Enab_p7_compute_parent":bool "Enab_p8_update_path":bool "Enab_p8_compute_parent":bool "Enab_p9_update_path":bool "Enab_p9_compute_parent":bool "Enab_p10_update_path":bool "Enab_p10_compute_parent":bool "p1_update_path":bool "p1_compute_parent":bool "p2_update_path":bool "p2_compute_parent":bool "p3_update_path":bool "p3_compute_parent":bool "p4_update_path":bool "p4_compute_parent":bool "p5_update_path":bool "p5_compute_parent":bool "p6_update_path":bool "p6_compute_parent":bool "p7_update_path":bool "p7_compute_parent":bool "p8_update_path":bool "p8_compute_parent":bool "p9_update_path":bool "p9_compute_parent":bool "p10_update_path":bool "p10_compute_parent":bool "legitimate":bool 
 
  -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 t f t f f f t f t f t f t f t f t f t f t f t f f f t f t f t f t f t f t f t f f 
- -1 3 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 t f t f f f t f t f f t t f t f t f t f t f t f f f t f t f f t t f t f t f t f f 
- -1 0 3 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 1 t f t f f f t f t f f f f f t f t f f t t f t f f f t f t f f f f f t f t f f t f 
- -1 0 0 3 -1 -1 -1 -1 -1 -1 0 -1 0 0 0 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 0 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f t f t f f f t f t f f t f f t f t f f f t f t f f f t f t f f t f f f 
- -1 0 0 0 3 -1 -1 -1 -1 -1 0 -1 0 0 0 0 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 1 -1 -1 -1 -1 -1 0 -1 0 0 0 0 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 -1 -1 -1 -1 -1 1 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f t f t f f f t f f f f f f f t f t f f f t f t f f f t f f f f f f f f 
- -1 0 0 0 0 3 -1 -1 -1 -1 0 -1 0 0 0 0 0 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 1 -1 -1 -1 -1 0 -1 0 0 0 0 0 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 1 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f t f t f f f f t f f f f f f t f t f f f t f t f f f f t f f f f f f f 
- -1 0 0 0 0 0 3 -1 -1 -1 0 -1 0 0 0 0 0 0 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 1 -1 -1 -1 0 -1 0 0 0 0 0 0 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f t f t f f f f f f f f f f f t f t f f f t f t f f f f f f f f f f f f 
- -1 0 0 0 0 0 0 3 -1 -1 0 -1 0 0 0 0 0 0 0 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 0 1 -1 -1 0 -1 0 0 0 0 0 0 0 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f t f t f f f f f f f f f f f t f t f f f t f t f f f f f f f f f f f f 
- -1 0 0 0 0 0 0 0 3 -1 0 -1 0 0 0 0 0 0 0 0 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 0 0 1 -1 0 -1 0 0 0 0 0 0 0 0 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f t f t f f f f f f f f f f f t f t f f f t f t f f f f f f f f f f f f 
- -1 0 0 0 0 0 0 0 0 3 0 -1 0 0 0 0 0 0 0 0 0 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 0 0 0 1 0 -1 0 0 0 0 0 0 0 0 0 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f t f t f f f f f f f f f f f t f t f f f t f t f f f f f f f f f f f f 
- 0 0 0 0 0 0 0 0 0 3 0 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f f t t f f f f f f f f f f f t f t f f f f t t f f f f f f f f f f f f 
- -1 2 3 -1 -1 -1 -1 -1 -1 -1 0 -1 1 1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 1 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f f f f f f f f f f f f f f f t f t f f f f f f f f f f f f f f f f f f 
- -1 1 1 3 -1 -1 -1 -1 -1 -1 0 -1 1 0 0 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 1 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f f t f f f f f f f f f f f f f f f f t f f t f f f f f f f f f f f f f f f f f 
- -1 1 0 0 3 -1 -1 -1 -1 -1 0 -1 1 0 0 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 1 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 f f f f f f f f f f f f f f f f f f f f t f f t f f f f f f f f f f f f f f f f t 
+ -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 t f f t f f t f t f t f t f t f t f t f t f f t f f t f t f t f t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 0 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 1 f f f f f f f t t f t f t f t f t f t f f f f f f f f t t f t f t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 -1 -1 -1 -1 -1 -1 0 -1 0 0 0 -1 -1 -1 -1 -1 -1 1 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 1 -1 0 0 2 -1 -1 -1 -1 -1 -1 1 f f f f f f f f f f t f t f t f t f t f f f f f f f f f f f t f t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 -1 -1 -1 -1 -1 0 -1 0 0 0 1 -1 -1 -1 -1 -1 1 -1 0 0 0 1 -1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 1 -1 0 0 0 2 -1 -1 -1 -1 -1 1 f f f f f f f f f f t f t f t f t f t f f f f f f f f f f f t f t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 1 0 -1 -1 -1 -1 0 -1 0 0 0 0 1 -1 -1 -1 -1 1 -1 0 0 0 1 1 -1 -1 -1 -1 0 -1 0 0 0 1 1 -1 -1 -1 -1 1 -1 0 0 0 0 2 -1 -1 -1 -1 1 f f f f f f f f f f t f t f t f t f t f f f f f f f f f f f t f t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 -1 -1 -1 0 -1 0 0 0 1 0 1 -1 -1 -1 1 -1 0 0 0 0 1 1 -1 -1 -1 0 -1 0 0 0 0 2 0 -1 -1 -1 1 -1 0 0 0 1 0 2 -1 -1 -1 1 f f f f f f f f f f t f t f t f t f t f f f f f f f f f f f t f t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 1 0 1 0 -1 -1 0 -1 0 0 0 0 1 0 1 -1 -1 1 -1 0 0 0 0 2 0 0 -1 -1 0 -1 0 0 0 0 1 1 1 -1 -1 1 -1 0 0 0 0 1 0 2 -1 -1 1 f f f f f f f f f f t f t f t f t f t f f f f f f f f f f f t f t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 1 0 -1 0 -1 0 0 0 0 2 0 0 0 -1 1 -1 0 0 0 0 1 0 1 1 -1 0 -1 0 0 0 0 1 0 2 0 -1 1 -1 0 0 0 0 1 1 1 1 -1 1 f f f f f f f f f f t f t f t f t f t f f f f f f f f f f f t f t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 1 1 1 1 0 -1 0 0 0 0 1 0 1 0 1 1 -1 0 0 0 0 1 0 2 0 0 0 -1 0 0 0 0 1 0 1 1 1 1 -1 0 0 0 0 1 0 1 0 2 1 f f f f f f f f f f t f t f t f t f t f f f f f f f f f f f t f t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 1 0 2 0 0 0 1 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 1 0 1 0 2 0 1 0 0 0 0 1 0 1 1 1 1 1 f f f f f f f f f f f t t f t f t f t f f f f f f f f f f f f t t f t f t f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 0 0 0 1 0 1 0 2 0 0 0 0 0 0 1 0 1 0 1 1 1 1 -1 2 2 -1 -1 -1 -1 -1 -1 -1 1 f f f f f f f f f f f f f f t f t f f t f f f f f f f f f f f f f f t f t f f t f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 -1 -1 -1 -1 -1 -1 0 -1 2 2 0 -1 -1 -1 -1 -1 -1 1 -1 2 2 -1 -1 -1 -1 -1 -1 -1 0 f f f f f f f f f f f f f f f t t f f f f f f f f f f f f f f f f f f t t f f f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 -1 -1 -1 -1 -1 1 -1 2 2 -1 -1 -1 -1 -1 -1 -1 0 f f f f f f f f f f f f f f f f f f t f f f f f f f f f f f f f f f f f f f t f f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 1 -1 -1 -1 -1 0 f f f f f f f f f f f f f f f f f f f t f f f f f f f f f f f f f f f f f f f t f 
+ -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 1 -1 -1 -1 -1 1 f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f t t 
 
-#This algo is silent after 66 moves, 13 steps, 14 rounds.
+#This algo is silent after 72 moves, 15 steps, 16 rounds.
 
 q
 #quit
diff --git a/test/dfs/4.12.0/test1.rif.exp b/test/dfs/4.12.0/test1.rif.exp
index d3f6792f..3620601f 100644
--- a/test/dfs/4.12.0/test1.rif.exp
+++ b/test/dfs/4.12.0/test1.rif.exp
@@ -4,42 +4,46 @@
 #step 1
 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 t f t f f f t f t f t f t f t f t f t f f #outs f f f f f f f f f f f f t f f f t f t f
 #step 2
--1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 t f t f f f t f t f t f f t t f f f f t f #outs t f t f f f t f t f t f f f t f f f f f
+-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 t f t f f f t f t f t f f t t f t f t f f #outs t f t f f f t f t f t f f f t f t f f f
 #step 3
--1 3 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 t f t f f f t f t f f t t f f f t f t f f #outs t f t f f f f f f f f t t f f f t f t f
+-1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 t f f t f f t f t f f t t f t f t f t f f #outs t f f t f f f f f f f t t f t f t f t f
 #step 4
--1 0 3 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 1 t f f t f f t f t f f f f f t f t f f t f #outs f f f t f f t f f f f f f f f f t f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 -1 -1 -1 -1 -1 -1 1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 1 -1 0 0 2 -1 -1 -1 -1 -1 -1 1 f f f f f f t f t f t f t f t f t f t f f #outs f f f f f f t f f f f f f f f f t f f f
 #step 5
--1 0 3 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 1 t f f f f f f t t f f f f f t f f t f t f #outs t f f f f f f f t f f f f f f f f t f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 0 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 -1 -1 -1 -1 -1 -1 1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 2 0 -1 -1 -1 -1 -1 1 -1 0 0 2 -1 -1 -1 -1 -1 -1 1 f f f f f f f t t f t f t f t f f t f t f #outs f f f f f f f f t f t f t f f f f t f f
 #step 6
--1 0 0 3 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 0 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 1 f f t f f f t f f t f f f f t f f f f t f #outs f f t f f f f f f f f f f f t f f f f t
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 0 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 -1 -1 -1 -1 -1 1 -1 0 0 1 -1 -1 -1 -1 -1 -1 1 -1 0 1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 2 0 -1 -1 -1 -1 -1 0 -1 0 0 2 -1 -1 -1 -1 -1 -1 1 f f f f f f f t f f t f t f t f f f t f f #outs f f f f f f f f f f f f f f t f f f f f
 #step 7
--1 0 0 3 -1 -1 -1 -1 -1 -1 0 -1 0 0 0 0 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 0 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f f f f f t f t f f f t f f f f f f f f #outs f f f f f f t f f f f f t f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 0 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 -1 -1 -1 -1 -1 1 -1 0 0 1 -1 -1 -1 -1 -1 -1 1 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 2 0 -1 -1 -1 -1 -1 0 -1 0 0 2 -1 -1 -1 -1 -1 -1 1 f f f f f f f t f f t f t f f t t f t f f #outs f f f f f f f t f f f f t f f t f f t f
 #step 8
--1 0 0 3 -1 -1 -1 -1 -1 -1 0 -1 0 0 0 0 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 1 -1 -1 -1 -1 0 -1 0 0 0 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 1 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f f f f f f t t f f f f t f f f f f f f #outs t f f f f f f f t f f f f t f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 -1 -1 -1 -1 1 -1 0 0 1 1 -1 -1 -1 -1 -1 1 -1 0 0 2 0 -1 -1 -1 -1 -1 0 -1 0 0 0 0 2 -1 -1 -1 -1 1 f f f f f f f f f f t f f f t f t f f t f #outs f f f f f f f f f f t f f f f f f f f f
 #step 9
--1 0 0 0 0 3 -1 -1 -1 -1 0 -1 0 0 0 0 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 1 -1 -1 -1 -1 0 -1 0 0 0 0 0 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 f f t f f f t f f t f f f f f f f f f f f #outs f f f f f f t f f t f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 -1 -1 -1 1 -1 0 0 0 0 1 -1 -1 -1 -1 1 -1 0 0 1 1 -1 -1 -1 -1 -1 1 -1 0 0 2 0 -1 -1 -1 -1 -1 0 -1 0 0 0 0 2 -1 -1 -1 -1 1 f f f f f f f f f f f f t f t f t f t f f #outs f f f f f f f f f f f f f f t f f f f f
 #step 10
--1 0 0 0 0 3 -1 -1 -1 -1 0 -1 0 0 0 0 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 1 -1 -1 -1 0 -1 0 0 0 0 0 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 f f t f f f f f f f f f f f f f f f f f f #outs f f t f f f f f f f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 -1 -1 -1 1 -1 0 0 0 0 1 -1 -1 -1 -1 1 -1 0 0 0 0 1 1 -1 -1 -1 1 -1 0 0 2 0 -1 -1 -1 -1 -1 0 -1 0 0 0 0 2 -1 -1 -1 -1 1 f f f f f f f f f f f f t f f f t f t f f #outs f f f f f f f f f f f f t f f f f f t f
 #step 11
--1 0 0 0 0 3 -1 -1 -1 -1 0 -1 0 0 0 0 0 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 1 -1 -1 -1 0 -1 0 0 0 0 0 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f f f f f t f t f f f f f f f f f f f f #outs t f f f f f t f t f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 -1 -1 -1 1 -1 0 0 0 0 1 0 1 -1 -1 1 -1 0 0 0 0 1 1 -1 -1 -1 1 -1 0 0 2 0 -1 -1 -1 -1 -1 0 -1 0 0 0 0 1 0 2 -1 -1 1 f f f f f f f f f f t f f f t f t f f t f #outs f f f f f f f f f f t f f f t f t f f f
 #step 12
--1 0 0 0 0 0 0 3 -1 -1 0 -1 0 0 0 0 0 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 0 1 -1 -1 0 -1 0 0 0 0 0 0 0 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 f f t f f f t f f f f f f f f f f f f f f #outs f f f f f f t f f f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 1 0 -1 1 -1 0 0 0 0 1 0 1 -1 -1 1 -1 0 0 0 0 1 0 1 1 -1 1 -1 0 0 0 0 1 0 2 0 -1 0 -1 0 0 0 0 1 0 2 -1 -1 1 f f f f f f f f f f f f t f f f t f t f f #outs f f f f f f f f f f f f f f f f t f f f
 #step 13
--1 0 0 0 0 0 0 3 -1 -1 0 -1 0 0 0 0 0 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 0 0 1 -1 0 -1 0 0 0 0 0 0 0 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 f f t f f f f f f f f f f f f f f f f f f #outs f f t f f f f f f f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 1 0 -1 1 -1 0 0 0 0 1 0 1 -1 -1 1 -1 0 0 0 0 1 0 1 1 -1 1 -1 0 0 0 0 1 0 1 1 1 0 -1 0 0 0 0 1 0 2 -1 -1 1 f f f f f f f f f f f f t f f f f t t f f #outs f f f f f f f f f f f f f f f f f f t f
 #step 14
--1 0 0 0 0 0 0 3 -1 -1 0 -1 0 0 0 0 0 0 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 0 0 1 -1 0 -1 0 0 0 0 0 0 0 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f f f f f t f t f f f f f f f f f f f f #outs t f f f f f t f t f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 1 0 -1 1 -1 0 0 0 0 1 0 1 -1 -1 1 -1 0 0 0 0 1 0 1 1 -1 1 -1 0 0 0 0 1 0 1 1 1 0 -1 0 0 0 0 1 0 1 0 2 1 f f f f f f f f f f f f t f f f f t f t f #outs f f f f f f f f f f f f f f f f f t f t
 #step 15
--1 0 0 0 0 0 0 0 0 3 0 -1 0 0 0 0 0 0 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 0 0 0 1 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 f f t f f f f t f f f f f f f f f f f f f #outs f f t f f f f t f f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 1 0 -1 1 -1 0 0 0 0 1 0 1 -1 -1 1 -1 0 0 0 0 1 0 1 1 -1 1 -1 0 0 0 0 1 0 1 1 1 1 -1 0 0 0 0 1 0 1 0 2 0 f f f f f f f f f f f f t f f f f f f f f #outs f f f f f f f f f f f f t f f f f f f f
 #step 16
--1 0 0 0 0 0 0 0 0 3 0 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 0 0 0 0 0 0 0 1 1 -1 0 0 0 0 0 0 0 0 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f f t f f t f t f f f f f f f f f f f f #outs t f f f f f t f f f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 1 0 -1 1 -1 0 0 0 0 1 0 1 0 1 1 -1 0 0 0 0 1 0 1 1 -1 1 -1 0 0 0 0 1 0 1 1 1 1 -1 0 0 0 0 1 0 1 0 2 0 f f f f f f f f f f t f f f t f f f f f f #outs f f f f f f f f f f t f f f t f f f f f
 #step 17
--1 2 3 -1 -1 -1 -1 -1 -1 -1 0 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 0 0 0 0 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 f f t f f f f t t f f f f f f f f f f f f #outs f f t f f f f f t f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 0 0 0 1 0 1 0 1 1 0 0 0 0 1 0 1 0 1 1 1 -1 0 0 0 0 1 0 1 1 1 1 -1 0 0 0 0 1 0 1 0 2 0 f f f f f f f f f f f t t f f t t f t f f #outs f f f f f f f f f f f t t f f t t f f f
 #step 18
--1 2 3 -1 -1 -1 -1 -1 -1 -1 0 -1 1 1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f t f f f f t f t f f f f f f f f f f f #outs t f f f f f f t f t f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 0 0 0 0 1 0 1 0 1 1 -1 0 0 0 0 1 0 1 0 2 0 1 -1 0 0 0 0 1 0 1 0 2 0 f f f f f f f f f f f f f f t f f t t f f #outs f f f f f f f f f f f f f f t f f t t f
 #step 19
--1 1 1 3 -1 -1 -1 -1 -1 -1 0 -1 1 1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 1 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 f f t f f f f f f f f f f f f f f f f f f #outs f f t f f f f f f f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 1 0 2 0 -1 -1 2 2 -1 -1 -1 -1 -1 -1 -1 0 f f f f f f f f f f f f f f f t t f f f f #outs f f f f f f f f f f f f f f f t t f f f
 #step 20
--1 1 1 3 -1 -1 -1 -1 -1 -1 0 -1 1 0 0 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 1 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 t f f f f f f f f f f f f f f f f f f f f #outs t f f f f f f f f f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 -1 -1 -1 -1 -1 -1 -1 2 2 -1 -1 -1 -1 -1 -1 -1 0 f f f f f f f f f f f f f f f f f t t f f #outs f f f f f f f f f f f f f f f f f f t f
 #step 21
--1 1 0 0 3 -1 -1 -1 -1 -1 0 -1 1 0 0 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 1 0 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 0 0 1 1 1 -1 -1 -1 -1 0 -1 0 0 1 1 -1 -1 -1 -1 -1 0 -1 0 0 1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 f f f f f f f f f f f f f f f f f f f f t #outs f f f f f f f f f f f f f f f f f f f f
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 -1 -1 -1 -1 -1 -1 -1 2 1 1 1 1 -1 -1 -1 -1 0 f f f f f f f f f f f f f f f f f t f t f #outs f f f f f f f f f f f f f f f f f f f t
+#step 22
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 -1 -1 -1 -1 -1 -1 -1 2 1 1 1 1 -1 -1 -1 -1 1 f f f f f f f f f f f f f f f f f t f f f #outs f f f f f f f f f f f f f f f f f t f f
+#step 23
+-1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -10 -1 0 2 -1 -1 -1 -1 -1 -1 -1 1 -1 0 2 2 -1 -1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 2 1 -1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 -1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 -1 -1 -1 -1 -1 1 -1 2 1 1 1 1 -1 -1 -1 -1 1 f f f f f f f f f f f f f f f f f f f f t #outs f f f f f f f f f f f f f f f f f f f f
diff --git a/test/dfs/Makefile b/test/dfs/Makefile
index f52e99e0..e8175f92 100644
--- a/test/dfs/Makefile
+++ b/test/dfs/Makefile
@@ -1,4 +1,4 @@
-# Time-stamp: <modified the 23/07/2021 (at 11:15) by Erwan Jahier>
+# Time-stamp: <modified the 27/08/2021 (at 17:14) by Erwan Jahier>
 
 
 test: test0 test1 rdbg_test
@@ -50,8 +50,10 @@ test1: test1.rif
 utest: utest0 utest1
 
 rdbg: g.lut g.ml
-	rdbg --sasa -o lurette.rif  \
-      -env "$(sasa) g.dot  -rif"
+	rdbg --sasa -o lurette.rif -env "$(sasa) g.dot  -rif"
+
+rdbgui: g.lut g.ml
+	rdbgui4sasa -o lurette.rif -env "$(sasa) g.dot  -rif"
 
 rdbg2: g.lut g.ml
 	rdbg --sasa -o lurette.rif  \
diff --git a/test/dijkstra-ring/ring.rif.exp b/test/dijkstra-ring/ring.rif.exp
index 896d3317..1ad69eee 100644
--- a/test/dijkstra-ring/ring.rif.exp
+++ b/test/dijkstra-ring/ring.rif.exp
@@ -1,5 +1,5 @@
-# Automatically generated by /home/jahier/.opam/4.12.0/bin/sasa version "v4.5.2" ("6122a58")
-# on crevetete the 31/7/2021 at 9:17:22
+# Automatically generated by /home/jahier/.opam/4.12.0/bin/sasa version "v4.5.5" ("9e912de")
+# on crevetete the 27/8/2021 at 16:38:05
 #sasa ring.dot -seed 42
 
 #seed 42
@@ -8,29 +8,38 @@
 
 
 #step 0
-#outs 1 3 3 2 2 1 1 0 f f t f t f t t f f f f f f t f f 41.
+#outs 1 3 3 2 2 1 1 0 f t f t f t f t f f f f f t f f f 38.
 
 #step 1
-#outs 1 3 3 2 2 1 0 0 f f t f t t f t f f f f t t f t f 40.
+#outs 1 3 3 2 2 2 1 0 f t f t f f t t f f f t f f t t f 37.
 
 #step 2
-#outs 1 3 3 2 1 0 0 1 f f t t t f t f f f f f f f t f f 37.
+#outs 1 3 3 3 2 2 2 1 t t f f t f f t f f f f f f f t f 34.
 
 #step 3
-#outs 1 3 3 2 1 0 1 1 f f t t t t f f f f t t t f f f f 36.
+#outs 1 3 3 3 2 2 2 2 f t f f t f f f f t f f f f f f f 9.
 
 #step 4
-#outs 1 3 2 1 0 0 1 1 f t t t f t f f f f f f f t f f f 33.
+#outs 1 1 3 3 2 2 2 2 f f t f t f f f f f f f t f f f f 8.
 
 #step 5
-#outs 1 3 2 1 0 1 1 1 f t t t t f f f f t t f f f f f f 32.
+#outs 1 1 3 3 3 2 2 2 f f t f f t f f f f f f f t f f f 7.
 
 #step 6
-#outs 1 2 1 1 0 1 1 1 f t f t t f f f f f f f t f f f f 22.
+#outs 1 1 3 3 3 3 2 2 f f t f f f t f f f t f f f f f f 6.
 
 #step 7
-#outs 1 2 1 1 1 1 1 1 f t f f f f f f f f f f t f f f t 0.
+#outs 1 1 1 3 3 3 2 2 f f f t f f t f f f f t f f f f f 5.
 
-#This algo reached a legitimate configuration after 12 moves, 7 steps, 1 round.
+#step 8
+#outs 1 1 1 1 3 3 2 2 f f f f t f t f f f f f f f t f f 4.
+
+#step 9
+#outs 1 1 1 1 3 3 3 2 f f f f t f f t f f f f f f f t f 3.
+
+#step 10
+#outs 1 1 1 1 3 3 3 3 f f f f t f f f f f f f f f f t t 2.
+
+#This algo reached a legitimate configuration after 12 moves, 10 steps, 4 rounds.
 
 #quit
diff --git a/tools/gg-deco/ggDeco.ml b/tools/gg-deco/ggDeco.ml
index c1fbcf5a..4684dd6c 100644
--- a/tools/gg-deco/ggDeco.ml
+++ b/tools/gg-deco/ggDeco.ml
@@ -47,7 +47,9 @@ let deco : (Topology.t -> files_spec_t list -> Topology.t) =
 let to_dot_string  : (t -> string -> string) =
   fun g name ->
   let attr =
-    let attrs = List.map (fun (an,av) -> Printf.sprintf "%s=%s" an av) g.Topology.attributes in 
+    let attrs =
+      List.map (fun (an,av) -> Printf.sprintf "%s=%s" an av) g.Topology.attributes
+    in 
     Printf.sprintf "graph [%s]" (String.concat "\n\t" attrs)
   in
   let node_to_node_string n =
@@ -55,7 +57,7 @@ let to_dot_string  : (t -> string -> string) =
   in
   let nodes = String.concat "" (List.map node_to_node_string g.Topology.nodes) in
   let node_to_link_string n =
-    let succ = g.succ n.id in
+    let pred = g.pred n.id in
     let link_kind = if g.directed then "->" else "--" in
     let links =
       List.map
@@ -63,14 +65,14 @@ let to_dot_string  : (t -> string -> string) =
           (match w with
            | 1 ->
               if n.id < neighbour || g.directed then
-                Printf.sprintf ("  %s %s %s") n.id link_kind neighbour
-              else
                 Printf.sprintf ("  %s %s %s") neighbour link_kind n.id
+              else
+                Printf.sprintf ("  %s %s %s") n.id link_kind neighbour
            | x ->
-              Printf.sprintf ("  %s %s %s [weight=%d]") n.id link_kind neighbour x
+              Printf.sprintf ("  %s %s %s [weight=%d]") neighbour link_kind n.id x
           )
         )
-        succ
+        pred
     in
     links
   in
diff --git a/tools/gg/classicGraph.ml b/tools/gg/classicGraph.ml
index 303c1fa6..6b6d40c0 100644
--- a/tools/gg/classicGraph.ml
+++ b/tools/gg/classicGraph.ml
@@ -3,29 +3,29 @@ open Topology
 open Ggcore
 open List
 
-type node_succ_t = (string, int * string) Hashtbl.t
-type node_pred_t = (string, string) Hashtbl.t
+type node_succ_t = (string, string) Hashtbl.t
+type node_pred_t = (string, int * string) Hashtbl.t
 
 (* Add symmetric edges when not directed *)
 let update_tbl directed succ pred =
   if not directed then (
     Hashtbl.iter
-      (fun n1 (_, n2) ->
-         if not (List.mem (1,n1) (Hashtbl.find_all succ n2)) then
-           Hashtbl.add succ n2 (1,n1))
+      (fun n1 n2 ->
+         if not (List.mem n1 (Hashtbl.find_all succ n2)) then
+           Hashtbl.add succ n2 n1)
       (Hashtbl.copy succ);
     Hashtbl.iter
-      (fun n1 n2 ->
-         if not (List.mem n1 (Hashtbl.find_all pred n2)) then
-         Hashtbl.add pred n2 n1)
+      (fun n1 (_, n2) ->
+         if not (List.mem (1,n1) (Hashtbl.find_all pred n2)) then
+         Hashtbl.add pred n2 (1,n1))
       (Hashtbl.copy pred);
   )
 
-let nid_list_remove : (node_id list -> node_id -> (int*node_id) list) =
+let nid_list_remove : (node_id list -> node_id -> node_id list) =
   fun l e ->
   (* remove e from l, and add the weight 1 to elements of l *)
   rev (fold_left (fun acc elem ->
-      if(elem <> e) then (1,elem)::acc else acc ) [] l)
+      if(elem <> e) then elem::acc else acc ) [] l)
 
 let (gen_clique: bool -> int -> Topology.t) =
   fun directed nb ->
@@ -37,9 +37,9 @@ let (gen_clique: bool -> int -> Topology.t) =
     (fun node_id ->
        List.iter
          (fun x ->
-            if  (snd x) < node_id then (
+            if x < node_id then (
               Hashtbl.add node_succ node_id x;
-              Hashtbl.add node_pred (snd x) node_id
+              Hashtbl.add node_pred x (1,node_id)
             )
          )
          (nid_list_remove nodes node_id))
@@ -61,8 +61,8 @@ let (gen_star: bool -> int -> Topology.t) =
   let (node_pred:node_pred_t) = Hashtbl.create nb in
   let nodes = create_nodes "p" (1,nb) in
 
-  List.iter    (fun n -> Hashtbl.add node_succ "root" (1,n)) nodes;
-  List.iter (fun n -> Hashtbl.add node_pred n "root") nodes;
+  List.iter    (fun n -> Hashtbl.add node_succ "root" n) nodes;
+  List.iter (fun n -> Hashtbl.add node_pred n (1,"root")) nodes;
   update_tbl directed node_succ node_pred; 
   let nl = id_to_empty_nodes ("root"::nodes) in
   {
@@ -83,8 +83,8 @@ let neighbours_ring dir nodes =
     | _ ->  assert false
   in
     List.iter2 (fun n1 n2 ->
-        Hashtbl.add node_succ n1 (1,n2);
-        Hashtbl.add node_pred n2 n1 
+        Hashtbl.add node_succ n1 n2;
+        Hashtbl.add node_pred n2 (1,n1)
     )
       nodes nodes2 ;
     update_tbl dir node_succ node_pred;
@@ -127,8 +127,8 @@ let (gen_grid: bool -> int -> int -> Topology.t) =
           let n_id2 = List.nth nodes ((j+jp)*length + i+ip) in
           if not ((ip=0 && jp=0) || (ip=jp) || (ip = -jp)) && (n_id<n_id2)
           then (
-            Hashtbl.add succ_t n_id (1, n_id2);
-            Hashtbl.add pred_t n_id2 n_id
+            Hashtbl.add succ_t n_id n_id2;
+            Hashtbl.add pred_t n_id2 (1, n_id)
           )
         done;
       done;
@@ -158,12 +158,12 @@ let rec link_hypercube_nodes :
     link_hypercube_nodes n2 n_s n_p;
     Array.iter2 (fun node1 node2 ->
         if node1 < node2 then (
-          Hashtbl.add n_s node1 (1, node2)
+          Hashtbl.add n_s node1 node2
         )
       ) n1 n2
 
 let (neighbours_hyper_cube : bool -> node_id list ->
-     (node_id -> (int * node_id) list) * (node_id -> node_id list)) = 
+     (node_id -> node_id list) * (node_id -> (int * node_id) list)) = 
   fun dir nl -> 
     let na = Array.of_list nl in 
     let (node_succ:node_succ_t) = Hashtbl.create (Array.length na) in
diff --git a/tools/gg/graphGen.ml b/tools/gg/graphGen.ml
index c2fabb58..4e60e9e5 100644
--- a/tools/gg/graphGen.ml
+++ b/tools/gg/graphGen.ml
@@ -160,7 +160,7 @@ let to_dot_string  : (Topology.t -> string -> (string * string) list -> string)
   let nodes = String.concat "" (List.map node_to_node_string g.nodes) in
 
   let node_to_link_string n =
-    let succ = g.succ n.Topology.id in
+    let pred = g.pred n.Topology.id in
     let link_kind = if g.directed then "->" else "--" in
     let links =
       List.map
@@ -169,17 +169,17 @@ let to_dot_string  : (Topology.t -> string -> (string * string) list -> string)
             | 1 ->
               assert (n.Topology.id <> neighbour);
               if n.Topology.id < neighbour || g.directed then
-                Printf.sprintf ("  %s %s %s") n.Topology.id link_kind neighbour
-              else
                 Printf.sprintf ("  %s %s %s") neighbour link_kind n.Topology.id
+              else
+                Printf.sprintf ("  %s %s %s") n.Topology.id link_kind neighbour
             | x ->
               if n.Topology.id < neighbour || g.directed then
-                Printf.sprintf ("  %s %s %s [weight=%d]") n.Topology.id link_kind neighbour x
+                Printf.sprintf ("  %s %s %s [weight=%d]") neighbour link_kind n.Topology.id x
               else
-                Printf.sprintf ("  %s %s %s [weight=%d]") neighbour link_kind n.Topology.id  x
+                Printf.sprintf ("  %s %s %s [weight=%d]") n.Topology.id link_kind neighbour x
            )
         )
-        succ
+        pred
     in
     links
   in
diff --git a/tools/gg/randomGraph.ml b/tools/gg/randomGraph.ml
index 38403a65..6abfefa0 100644
--- a/tools/gg/randomGraph.ml
+++ b/tools/gg/randomGraph.ml
@@ -3,22 +3,22 @@ open Topology
 open Ggcore
 open List
 
-type node_succ_t = (node_id, int * node_id) Hashtbl.t
-type node_pred_t = (node_id, node_id) Hashtbl.t
+type node_succ_t = (node_id, node_id) Hashtbl.t
+type node_pred_t = (node_id, int * node_id) Hashtbl.t
 type probability = float (*between 0 and 1*)
 
 (* Add symmetric edges when not directed *)
 let update_tbl directed succ pred =
   if not directed then (
     Hashtbl.iter
-      (fun n1 (_, n2) ->
-         if not (List.mem (1,n1) (Hashtbl.find_all succ n2)) then
-           Hashtbl.add succ n2 (1,n1))
+      (fun n1 n2 ->
+         if not (List.mem n1 (Hashtbl.find_all succ n2)) then
+           Hashtbl.add succ n2 n1)
       (Hashtbl.copy succ);
     Hashtbl.iter
-      (fun n1 n2 ->
-         if not (List.mem n1 (Hashtbl.find_all pred n2)) then
-         Hashtbl.add pred n2 n1)
+      (fun n1 (_,n2) ->
+         if not (List.mem (1,n1) (Hashtbl.find_all pred n2)) then
+         Hashtbl.add pred n2 (1,n1))
       (Hashtbl.copy pred);
   )
 
@@ -31,8 +31,8 @@ let gen_ER : (bool -> int -> probability -> Topology.t) =
   let succ n = Hashtbl.find_all node_succ n in
   let pred n = Hashtbl.find_all node_pred n in
   let add_succ n m =
-    Hashtbl.add node_succ n (1,m);
-    Hashtbl.add node_pred m n
+    Hashtbl.add node_succ n m;
+    Hashtbl.add node_pred m (1,n)
   in
   iteri (fun i n ->
       iteri (fun j m ->
@@ -69,7 +69,7 @@ let get_m_nodes m nodes =
   f m [] nodes
 
 let (neighbours_BA : node_id list -> int -> node_succ_t -> node_pred_t ->
-     ((node_id -> (int * node_id) list) * (node_id -> node_id list))) =
+     ((node_id -> node_id list) * (node_id -> (int * node_id) list))) =
   fun nodes m node_succ node_pred ->
   let d_tot = 2 * m in
   let m_nodes, nodes = get_m_nodes m nodes in
@@ -82,10 +82,10 @@ let (neighbours_BA : node_id list -> int -> node_succ_t -> node_pred_t ->
   | [] -> assert false
   | head::nodes ->
     List.iter (fun n ->
-        Hashtbl.add node_succ n (1,head);
-        Hashtbl.add node_succ head (1,n);
-        Hashtbl.add node_pred head n ;
-        Hashtbl.add node_pred n head
+        Hashtbl.add node_succ n head;
+        Hashtbl.add node_succ head n;
+        Hashtbl.add node_pred head (1,n);
+        Hashtbl.add node_pred n (1,head)
       )
       m_nodes;
     (*init terminée. On a un graph connexe pour les m premiers points,
@@ -120,11 +120,12 @@ let (neighbours_BA : node_id list -> int -> node_succ_t -> node_pred_t ->
                  ran);
            done;
            assert (length !succ = m);
-           List.iter (fun s ->
+           List.iter (fun (w,s) ->
                Hashtbl.add node_succ node s;
-               Hashtbl.add node_succ (snd s) (1,node);
-               Hashtbl.add node_pred (snd s) node ;
-               Hashtbl.add node_pred node (snd s)
+               Hashtbl.add node_succ s node;
+               
+               Hashtbl.add node_pred s (w,node);
+               Hashtbl.add node_pred node (w,s)
              )
              !succ;
            (deg_tot + (2 * m))
@@ -163,7 +164,7 @@ let gen_BA : (bool -> int -> int -> Topology.t) =
 
 let (pre_rand_tree : bool -> GraphGen_arg.tree_edge -> node_succ_t ->
      node_pred_t -> node_id list ->
-     ((node_id -> (int * node_id) list) * (node_id -> node_id list))) =
+     ((node_id -> node_id list) * (node_id -> (int * node_id) list))) =
   fun dir tree_edge node_succ node_pred ->
   function
   | [] -> failwith "Tree Error : You need at least one nodes in your tree"
@@ -178,15 +179,15 @@ let (pre_rand_tree : bool -> GraphGen_arg.tree_edge -> node_succ_t ->
         *)
         if tree_edge <> GraphGen_arg.OutTree then (
           (* add elem as a successor of node *)
-          Hashtbl.add node_succ no (1,elem);
+          Hashtbl.add node_succ no elem;
           (* add node as a predecessor of elem *)
-          Hashtbl.add node_pred elem no
+          Hashtbl.add node_pred elem (1,no)
         );
         if tree_edge <> GraphGen_arg.InTree then (
           (* add node as a successor of elem *)
-          Hashtbl.add node_succ elem (1,no);
+          Hashtbl.add node_succ elem no;
           (* add elem as a predecessor of node *)
-          Hashtbl.add node_pred no elem
+          Hashtbl.add node_pred no (1,elem)
         );
         (elem::acc)
     ) [h] (t));
@@ -239,8 +240,8 @@ let gen_qudg : (bool -> int -> float -> float -> float -> float -> float ->
              (* e.g. if the node is : (within the radius r0)
                 or : (within the radius r1, with a probability of p) *)
           then (
-            Hashtbl.add node_succ node (1,n);
-            Hashtbl.add node_pred n node;
+            Hashtbl.add node_succ node n;
+            Hashtbl.add node_pred n (1,node);
           )
         ) pl
     ) pl;
diff --git a/tools/gg/udgUtils.ml b/tools/gg/udgUtils.ml
index cb8be27e..fa97fad3 100644
--- a/tools/gg/udgUtils.ml
+++ b/tools/gg/udgUtils.ml
@@ -51,21 +51,21 @@ let rec make_nodes_dot_udg : (node_udg list -> float -> float -> string) =
 (* XXX duplicates GraphGen.to_dot_string *)
 let make_links_dot g =
   let node_to_link_string n =
-    let succ = g.succ n.id in
+    let pred = g.pred n.id in
     let links =
       List.map
         (fun (w,neighbour) ->
           (match w with
            | 1 ->
               if n.id < neighbour then
-                Printf.sprintf ("  %s -- %s") n.id neighbour
-              else
                 Printf.sprintf ("  %s -- %s") neighbour n.id
+              else
+                Printf.sprintf ("  %s -- %s") n.id neighbour
            | x ->
-              Printf.sprintf ("  %s -- %s [weight=%d]") n.id neighbour x
+              Printf.sprintf ("  %s -- %s [weight=%d]") neighbour n.id x
           )
         )
-        succ
+        pred
     in
     links
   in
diff --git a/tools/rdbg4sasa/dot4sasa.ml b/tools/rdbg4sasa/dot4sasa.ml
index 5d827d18..d7fcc3db 100644
--- a/tools/rdbg4sasa/dot4sasa.ml
+++ b/tools/rdbg4sasa/dot4sasa.ml
@@ -159,7 +159,7 @@ let to_pdf engine par_var only_parent rn g f e =
       (List.map
          (fun n ->
             let l = g.succ n.id in
-            List.mapi (fun i (_,t) ->
+            List.mapi (fun i t ->
                 if is_parent "par" n.id i e then
                   Printf.sprintf "%s -> %s" n.id t 
                 else if n.id < t then
diff --git a/tools/rdbg4sasa/gtkgui.ml b/tools/rdbg4sasa/gtkgui.ml
index 56a47f65..3ecd327f 100644
--- a/tools/rdbg4sasa/gtkgui.ml
+++ b/tools/rdbg4sasa/gtkgui.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 28/06/2021 (at 10:24) by Erwan Jahier> *)
+(* Time-stamp: <modified the 27/08/2021 (at 16:36) by Erwan Jahier> *)
 
 #thread
 #require "lablgtk3"
@@ -510,8 +510,8 @@ let custom_daemon p gtext vbox step_button back_step_button round_button
      )
      | LocCentral -> (
        let get_neigbors x =
-         let succ = snd (List.split (topology.succ x)) in
-         let pred = topology.pred x in
+         let pred = snd (List.split (topology.pred x)) in
+         let succ = topology.succ x in
          let res = List.fold_left
                      (fun acc x -> if List.mem x acc then acc else x::acc) succ pred
          in
-- 
GitLab