From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a9916530bf157e77 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.88.200 with SMTP id b8mr35378865qam.8.1367105691970; Sat, 27 Apr 2013 16:34:51 -0700 (PDT) X-Received: by 10.50.126.70 with SMTP id mw6mr837147igb.10.1367105691931; Sat, 27 Apr 2013 16:34:51 -0700 (PDT) Path: ef9ni27140qab.0!nntp.google.com!s14no283773qam.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 27 Apr 2013 16:34:51 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 References: <87c89205-7fee-4d88-b4ab-08d26c03219b@googlegroups.com> <99d9a17c-ed8d-4c28-90d0-6543b511cb87@googlegroups.com> <4c3eca49-8ee6-4518-9968-879c08b828f6@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <61f44636-ad71-447f-a20e-473e613f63ff@googlegroups.com> Subject: Re: Depth First Search of a Char_Matrix? From: Shark8 Injection-Date: Sat, 27 Apr 2013 23:34:51 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2013-04-27T16:34:51-07:00 List-Id: When you print the array out you have a representation of nodes (and implic= itly edges), just displayed in a tabular ASCII format. Is a very real sense (1,1), (1,2),...,(5,5) are merely addresses/locations = of a node, wherein 'B', 'W' and '.'/' ' denote that node's state the edges,= then, ar nothing more than the relationship of what is adjacent in the hor= izontal/vertical. ------------------------------------------- [Non-DFS method] You could count the dead pieces as follows: if there are no empty locations all are dead, otherwise (1) make two lists of nodes A & B, (2) add all the empty nodes to A, (3) for each node of A, add its neighbors to B if they are occupied, (4) clear A (5) for each of those nodes in B, add only its neighbors containing a piece= of the same color to A (6) merge A into B (7) repeat #4/#5/#6 until the sizes B is the same as it was in #4. At this point the system is stable and you have all the live pieces in your= list, anything not in your list is then dead. -- This would be a horrible = way to do things on any large sized board because of the reiterations... bu= t it's already given you the secret of how to do it with DFS.