1-- PragmAda Reusable Component (PragmARC)
2-- Copyright (C) 2000 by PragmAda Software Engineering.  All rights reserved.
3-- **************************************************************************
4--
5-- Definition of standard cards used in USA
6--
7-- History:
8-- 2000 May 01     J. Carter          V1.0--Initial release
9--
10package PragmARC.US_Card is
11   pragma Pure;
12
13   type Suit_Id is (Diamond, Club, Heart, Spade);
14   type Rank_Id is (Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King);
15
16   type Card_Handle is private;
17
18   function Make (Suit : Suit_Id; Rank : Rank_Id) return Card_Handle;
19   -- Allows any card to be constructed
20
21   function Rank (Item : Card_Handle) return Rank_Id;
22   -- Returns the rank of Item
23
24   function Suit (Item : Card_Handle) return Suit_Id;
25   -- Returns the suit of Item
26
27   function Image (Item : Card_Handle) return String;
28   -- Returns a 2-character string [subtype String (1 .. 2)] containing the image of Item
29   -- Format is "RS"; R=Rank, S=Suit
30   -- For Two .. Nine, R is the corresponding digit; for Ace and Ten .. King, R is the 1st character (A, T, etc)
31   -- S is the 1st character (D, C, H, or S)
32   -- Thus, Image (Make (Club, Seven) ) = "7C"
33   --       Image (Make (Spade, Jack) ) = "JS"
34private -- PragmARC.US_Card
35   type Card_Handle is record
36      Suit : Suit_Id := Suit_Id'First;
37      Rank : Rank_Id := Rank_Id'First;
38   end record;
39end PragmARC.US_Card;
40--
41-- This is free software; you can redistribute it and/or modify it under
42-- terms of the GNU General Public License as published by the Free Software
43-- Foundation; either version 2, or (at your option) any later version.
44-- This software is distributed in the hope that it will be useful, but WITH
45-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
46-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
47-- for more details. Free Software Foundation, 59 Temple Place - Suite
48-- 330, Boston, MA 02111-1307, USA.
49--
50-- As a special exception, if other files instantiate generics from this
51-- unit, or you link this unit with other files to produce an executable,
52-- this unit does not by itself cause the resulting executable to be
53-- covered by the GNU General Public License. This exception does not
54-- however invalidate any other reasons why the executable file might be
55-- covered by the GNU Public License.