[Oberon] tree programming

Dieter d.gloetzel at web.de
Wed Sep 5 15:57:16 CEST 2018


Imagin a matrix consisting of "0"  and "1". Now I want to separate the 
islands of "1" and get a handle on
the indices of each island.
i.e. : I want to transform this:
  0 0 0 0 0 1 0 1 1 0 1 0 0
  0 0 0 0 0 1 0 1 0 0 1 0 1
  0 0 0 0 0 1 0 1 0 1 0 0 1
  0 0 0 0 1 1 0 0 0 1 0 1 0
  0 0 0 1 1 0 0 0 0 0 0 1 0
  0 0 0 1 1 1 1 0 0 0 0 0 0
into something like this:
  0 0 0 0 0 1 0 2 2 0 3 0 0
  0 0 0 0 0 1 0 2 0 0 3 0 6
  0 0 0 0 0 1 0 2 0 4 0 0 6
  0 0 0 0 1 1 0 0 0 4 0 5 0
  0 0 0 1 1 0 0 0 0 0 0 5 0
  0 0 0 1 1 1 1 0 0 0 0 0 0


I only half-understand, what Wirth writes on trees in his green Oberonbook.
But it looks to me like a tree problem.

Thanks and regards,
Dieter




-- 
____________________________________
Dr. Dieter Glötzel
Im Rosengarten 27
64367 Mühltal



More information about the Oberon mailing list