comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Depth First Search of a Char_Matrix?
Date: Sat, 27 Apr 2013 12:05:30 -0700 (PDT)
Date: 2013-04-27T12:05:30-07:00	[thread overview]
Message-ID: <b9ad77b9-3f23-4e80-88e1-92ddeefdb74a@googlegroups.com> (raw)
In-Reply-To: <4c3eca49-8ee6-4518-9968-879c08b828f6@googlegroups.com>

On Saturday, April 27, 2013 10:51:44 AM UTC-6, Alex wrote:
> 
> Thanks! So I am given the function signature, not really a function body that looks like this
> 
>    function Count_Alive(Board : Char_Matrix) return Integer is
>  	M : Char_Matrix := Board;  
> 	begin
>       return -999;
>    end Count_Alive;
> 
> 
> So I understand much of your logic, but I am given a matrix of characters defined as such:
> 
> type Char_Matrix is array(Positive range <>, Positive range <>) of Character;
> 
> So could you give me like an algorithm in words on what I need to do instead of giving me the answer in code?

The algorithm is much the same, just substitute a "Piece'(Color=>Black)" for 'B', "Piece'(Color=>White)" for 'W', and the space/'.'/whatever for the null. (Your handling of null and such will have to change, but it's the same idea as in the code already given: there's a board-position that might have a piece, if it does that piece is either black or white and either alive or dead.)



  parent reply	other threads:[~2013-04-27 19:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27 14:09 Depth First Search of a Char_Matrix? Alex
2013-04-27 15:35 ` Shark8
2013-04-27 17:25   ` Jeffrey Carter
2013-04-27 18:16     ` Shark8
2013-04-27 18:48       ` Dmitry A. Kazakov
2013-04-27 18:58         ` Shark8
2013-04-27 20:16           ` Dmitry A. Kazakov
2013-04-27 19:31       ` Simon Wright
2013-04-27 20:04         ` Shark8
2013-04-28  3:26       ` Jeffrey Carter
2013-04-27 16:27 ` Alex
2013-04-27 16:34   ` Shark8
2013-04-27 16:51     ` Alex
2013-04-27 16:55       ` Alex
2013-04-27 19:05       ` Shark8 [this message]
2013-04-27 22:54         ` Alex
2013-04-27 22:56         ` Alex
2013-04-27 23:34           ` Shark8
2013-04-27 23:38             ` Alex
2013-04-29 20:55             ` Alex
2013-04-29 23:40               ` Jeffrey Carter
2013-04-30 10:49               ` AdaMagica
2013-04-28 10:50 ` AdaMagica
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox