www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/30/23:40:50

Date: Sun, 30 Nov 1997 22:37:39 -0600 (CST)
From: Andrew Deren <aderen AT eecs DOT uic DOT edu>
To: djgpp <djgpp AT delorie DOT com>
Subject: Looking for connected of 3
Message-ID: <Pine.SUN.3.95.971130223322.22811B-100000@ernie.eecs.uic.edu>
MIME-Version: 1.0

Does anyone know of an algorithm to look through 2 dimensional array and
find 3 values next to each other. Let's say I have an array 10x10 and 
it's all zeros exept at some points where it's some value and I want to
check if there is a connection between the values and if 3 of them are
connected then i want to clear them to zero.
ex.
  0 0 0 0
  0 x x 0
  0 x 0 0
  0 0 0 0
this is one of the cases, and there could be more than 3 connected and all
of them have to be cleared. The connections can only be on the sides, not
diagonal.

Thanks.


                        ,,,
                       (0 0)
   +-------------oOO----(_)-------------------+
   |                Andrew Deren              |  
   |             aderen AT eecs DOT uic DOT edu          |
   | www.eecs.uic.edu/~aderen/ader/main.html  |
   +-------------------------oOO--------------+
                       || ||
                      ooO Ooo
 


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019