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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.51.141 with SMTP id k135mr15663394itk.19.1517149037493; Sun, 28 Jan 2018 06:17:17 -0800 (PST) X-Received: by 10.157.112.213 with SMTP id w21mr532135otj.2.1517149037264; Sun, 28 Jan 2018 06:17:17 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!paganini.bofh.team!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!w142no473519ita.0!news-out.google.com!b73ni2291ita.0!nntp.google.com!g80no469741itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 28 Jan 2018 06:17:16 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=87.116.179.50; posting-account=z-xFXQkAAABpEOAnT3LViyFXc8dmoW_p NNTP-Posting-Host: 87.116.179.50 References: <87y3ki743m.fsf@jacob-sparre.dk> <40142b86-fdcf-49d3-bee7-2fdbb04c6db0@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <851eb220-c80e-45ee-8332-a18f9801502e@googlegroups.com> Subject: Re: Card game deck but with trumps suit for tarot "divination" Is there a better way than enumerating all cards? From: bozovic.bojan@gmail.com Injection-Date: Sun, 28 Jan 2018 14:17:17 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:50194 Date: 2018-01-28T06:17:16-08:00 List-Id: On Sunday, January 28, 2018 at 10:46:57 AM UTC+1, Jeffrey R. Carter wrote: > On 01/28/2018 10:23 AM, bozovic.bojan@gmail.com wrote: > >> > >> type Card (Trump : Boolean) is > >> record > >> case Trump is > >> when True =3D> > >> Trump_Value : Major_Arcana; > >> when False =3D> > >> Suit : Suits; > >> Value : Values; > >> end record; >=20 > With the addition of the missing "end case;" and a default for the discri= minant=20 > so you can have an array of this type, this is the way I'd approach it. >=20 > > Thanks for the input, I'll look into your suggestion, but the main prob= lem is each card has its "divinatoy meaning". I've used Tarot_Card_Position= because it makes more sense to shuffle deck indexed in integer than in enu= meration type and draw then a number of cars from it. But I know I wrote so= me awful code, as I really have little experience and no formal education. >=20 > Yes, a deck is a sequence of cards; representing it as an array means the= index=20 > values are meaningless. While the deck starts out with 78 cards, after de= aling=20 > some cards it is shorter, so something like >=20 > Max_Cards : constant :=3D 78; >=20 > subtype Deck_Length is integer range 0 .. Max_Cards; > subtype Deck_Index is Deck_Length range 1 .. Max_Cards; >=20 > type Deck_List is array (Deck_Index range <>) of Card_Info; >=20 > type Deck_Info (Length : Deck_Length :=3D 0) is record > Deck : Deck_List (1 .. Length); > end record; >=20 > would make sense. >=20 > You might want to look at PragmARC.Deck_Handler which has already dealt w= ith=20 > these issues. >=20 > https://github.com/jrcarter/PragmARC >=20 > --=20 > Jeff Carter > "We use a large, vibrating egg." > Annie Hall > 44 Oh, I've avoided that just by drawing first n cards from the deck after shu= ffling, but that obviously isn't complete solution like the one you suggest= , and wouldn't allow simulation of a card game. Thanks for the GitHub code,= as I saw it's under permissive GMGPL license. I'll look into using it in m= y program whom I thought is fitting problem for a novice.