comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Newbie question
Date: Thu, 12 Mar 2009 11:29:53 -0700 (PDT)
Date: 2009-03-12T11:29:53-07:00	[thread overview]
Message-ID: <601b0fd2-86cb-4c25-ae02-f0ce93fd20c4@o2g2000prl.googlegroups.com> (raw)
In-Reply-To: Pine.LNX.4.64.0903121812070.24666@medsec1.medien.uni-weimar.de

On Mar 12, 10:14 am, stefan-lu...@see-the.signature wrote:
> > > type Piece_T(Color: Color_T) is
> > >   record
> > >     case Color is
> > >       when White =>
> > >         White_Piece: Piece_Type_T;
> > >       when Black =>
> > >         Black_Piece: Piece_Type_T;
> > >       when None =>
> > >         null;
> > >     end case;
> > >   end record;
>
> > The problem with this is that you'd then need two code paths for
> > Black_Piece and White_Piece, every time.
>
> Right. Actually, I anticipated that you would *want* two code paths for
> the black and for the white pieces.

I don't see why... I'd anticipate writing a subprogram like

   function Compute_Best_Move_For (Color: Color_T) return Move_T;

[more accurately, instead of Color_T, we'd use a subtype that is a
subrange of Color_T that allows only Black and White].  Now having two
different paths would be an utter nuisance.  Aside from the small
detail that the pawns move in different directions, the algorithm
would be exactly the same for both colors.

In fact, I'd think most of the algorithms you would want to write that
pertain to one particular player would work exactly the same for Black
and White, except for pawn direction, and that can be dealt with by
setting up some variable with value +1 for White and -1 for Black (or
vice versa).

                                -- Adam



  reply	other threads:[~2009-03-12 18:29 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 13:29 Newbie question Olivier Scalbert
2009-03-12 13:48 ` Ludovic Brenta
2009-03-12 14:16   ` Olivier Scalbert
2009-03-12 14:31     ` Ludovic Brenta
2009-03-12 14:32     ` stefan-lucks
2009-03-12 14:36       ` Ludovic Brenta
2009-03-12 17:14         ` stefan-lucks
2009-03-12 18:29           ` Adam Beneschan [this message]
2009-03-12 15:03       ` Jacob Sparre Andersen
2009-03-12 15:07   ` Robert A Duff
2009-03-12 17:16 ` Georg Bauhaus
2009-03-13  1:59 ` tmoran
2009-03-15 13:46 ` Olivier Scalbert
2009-03-21 18:08 ` Olivier Scalbert
2009-03-21 18:22   ` (see below)
2009-03-21 18:29     ` Olivier Scalbert
2009-03-21 18:36       ` Georg Bauhaus
2009-03-21 18:39         ` Olivier Scalbert
2009-03-22 12:40           ` (see below)
2009-03-22 13:19             ` Olivier Scalbert
2009-03-21 18:39       ` Jeffrey R. Carter
2009-03-23  8:24       ` Jean-Pierre Rosen
  -- strict thread matches above, loose matches on Subject: below --
2007-11-23 13:22 Sir Chewbury Gubbins
2007-11-23 14:01 ` Sir Chewbury Gubbins
2007-11-24 16:49 ` Stephen Leake
2007-11-24 17:08   ` Peter C. Chapin
2007-11-25 19:25     ` Stephen Leake
2007-11-29  0:46   ` Robert A Duff
2005-07-18 11:26 Francisco J. Montoya
2005-07-18 13:14 ` Martin Dowie
2005-07-18 13:51   ` Alex R. Mosteo
2005-07-18 20:27     ` Martin Dowie
2005-07-18 15:28 ` Jeffrey Carter
2005-07-18 17:40 ` Martin Krischik
2005-07-03 17:58 newbie question e.coli
2005-07-03 18:32 ` Dmitry A. Kazakov
2004-08-04  6:42 Newbie Question leke
2004-08-04  8:55 ` Frank
2004-08-04  9:51 ` Martin Dowie
2001-12-24 13:52 Newbie question Jasbinder S  Uppal
2001-12-24 20:06 ` Michal Nowak
2001-12-24 21:13   ` martin.m.dowie
2001-12-25 12:36     ` Michal Nowak
2001-12-27 14:25       ` Alfred Hilscher
2001-12-29 21:54         ` Michal Nowak
2001-12-31 17:51           ` Jasbinder S Uppal
2002-01-01 21:26             ` Michal Nowak
2000-05-25  0:00 olsonm76
2000-05-26  0:00 ` Robert Dewar
1999-03-18  0:00 newbie question Kenneth Lee
1999-03-18  0:00 ` Tom Moran
1999-03-18  0:00   ` Kenneth Lee
1999-03-18  0:00     ` Nick Roberts
1999-03-18  0:00 ` Andreas Winckler
1999-03-19  0:00   ` Kenneth Lee
1999-03-19  0:00     ` Michael F Brenner
1999-03-19  0:00       ` ELMO
1999-03-21  0:00       ` Matthew Heaney
1999-03-19  0:00 ` robert_dewar
1999-03-19  0:00 ` Michael F Brenner
1999-03-19  0:00   ` Nick Roberts
1999-03-20  0:00     ` Nick Roberts
replies disabled

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