// zebra.cmd
// Evolver command to alternately color string edges black and white

color1 := white
color2 := black
zebra := {
   ecount := 0; // for safety
   // get starting edge, since can't assume edge[1] exists
   foreach edge do { e_id := id; break; };
   first_e := e_id;
   v_id := edge[e_id].vertex[1].id;
   zcolor := color1;
   // follow connected edges
   do { set edge[e_id] color zcolor;
	newe_id := first_e; // safety default
	foreach edge[e_id].vertex vv do 
	  { if ( vv.id != v_id ) then
	    { newv_id := vv.id;
	      foreach vv.edge ee do 
		if ee.id != e_id then newe_id := ee.id
            }
          };
        e_id := newe_id; v_id := newv_id;
        zcolor := (zcolor == color1) ? color2 : color1;
	ecount := ecount + 1;
      } while ( (e_id != first_e) and (ecount <= edge_count) )
  }
