File indexing completed on 2025-10-12 04:59:54

0001 // bjgb_dealercount.h                                                 -*-C++-*-
0002 #ifndef INCLUDED_BJGB_DEALERCOUNT
0003 #define INCLUDED_BJGB_DEALERCOUNT
0004 
0005 //@PURPOSE: Enumerate the possible final counts of a dealer blackjack hand.
0006 //
0007 //@CLASSES:
0008 //  bjgb::DealerCount: enumeration of the possible final dealer counts
0009 //
0010 //@SEE_ALSO: TBD
0011 //
0012 //@DESCRIPTION: This component defines an enumeration, 'bjgb::DealerCount', TBD
0013 //
0014 /// Usage
0015 ///-----
0016 // This section illustrates intended use of this component.
0017 //
0018 // TBD
0019 
0020 #include <cassert>
0021 
0022 namespace bjgb {
0023 
0024 // ==================
0025 // struct DealerCount
0026 // ==================
0027 
0028 struct DealerCount {
0029     // TBD class-level doc
0030 
0031     // TYPES
0032     enum Enum { e_C17, e_C18, e_C19, e_C20, e_C21, e_CBJ, e_COV };
0033 
0034     enum { k_NUM_FINAL_COUNTS = e_COV + 1 };
0035 
0036     // CLASS METHODS
0037     static constexpr int fini(int count);
0038     // Return the value of the enumerator in the range '[e_C17 .. e_C21]'
0039     // corresponding to the specified final dealer hand 'count'.  The
0040     // behavior is undefined unless '17 <= count' and 'count <= 21'.  Note
0041     // that this method maps integral values in the range '[17 .. 21]' to
0042     // values in the range '[e_C17 .. e_C21]'.
0043 };
0044 
0045 // ============================================================================
0046 //                              INLINE DEFINITIONS
0047 // ============================================================================
0048 
0049 // ------------------
0050 // struct DealerCount
0051 // ------------------
0052 
0053 // CLASS METHODS
0054 inline constexpr int DealerCount::fini(int count)
0055 {
0056     assert(17 <= count);
0057     assert(count <= 21);
0058 
0059     return count - 17 + e_C17;
0060 }
0061 
0062 } // namespace bjgb
0063 
0064 #endif