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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e4042699db4db63b X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!news.skynet.be!195.238.0.222.MISMATCH!newsspl501.isp.belgacom.be!tjb!not-for-mail Date: Thu, 12 Mar 2009 15:16:26 +0100 From: Olivier Scalbert User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Newbie question References: <49b90e2d$0$2847$ba620e4c@news.skynet.be> <0ff2f139-06cf-4fa5-8c0d-f97c43a33186@s20g2000yqh.googlegroups.com> In-Reply-To: <0ff2f139-06cf-4fa5-8c0d-f97c43a33186@s20g2000yqh.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <49b9193a$0$2854$ba620e4c@news.skynet.be> Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: adb99434.news.skynet.be X-Trace: 1236867386 news.skynet.be 2854 87.65.225.22:36842 X-Complaints-To: usenet-abuse@skynet.be Xref: g2news2.google.com comp.lang.ada:5044 Date: 2009-03-12T15:16:26+01:00 List-Id: Ludovic Brenta wrote: > Solution 1: a variant record: > > type Square_T (Empty : Boolean) is record > case Empty is > when True => null; > when False => Piece : Piece_T; > end case; > end record; > > type Board_T is array (1 .. 8, 1 .. 8) of Square_T; > > Solution 2: merge the Boolean directly into Piece_T: > > type Piece_T (Present : Boolean) is record > case Present is > when True => > Color : Color_T; > Piece_Type : Piece_Type_T; > when False => > null; > end case; > end record; > > Solution 3: introduce a new value for Piece_Type_T: > > type Piece_Type_T is (None, Pawn, Knight, Bishop, Rook, Queen, King); > > I don't know which is the best solution; perhaps you'd like to try > them all and see how well they integrate with the algorithms. I think > Solution 3 is the most error-prone, though. > > -- > Ludovic Brenta; 3 solutions ! Thanks Ludovic. I like the first two solutions. With solution 3, you can have an empty square (None) with a color. Olivier