home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 115 / af115sub.adf / yahzee.lzx / yahzee / rules.h < prev    next >
C/C++ Source or Header  |  1998-06-03  |  2KB  |  93 lines

  1. #ifndef RULES_H
  2. #define RULES_H
  3. /*
  4.  * rules.h
  5.  * =======
  6.  * Definition of game rules.
  7.  *
  8.  * Copyright (C) 1994-1998 Håkan L. Younes (lorens@hem.passagen.se)
  9.  */
  10.  
  11. #include <exec/types.h>
  12.  
  13.  
  14. #define MAX_NUM_DICE   6
  15.  
  16. /* labels */
  17. #define ACES              0
  18. #define TWOS              1
  19. #define TREES             2
  20. #define FOURS             3
  21. #define FIVES             4
  22. #define SIXES             5
  23. #define UPPER_TOTAL       6
  24. #define BONUS             7
  25. #define ONE_PAIR          8
  26. #define TWO_PAIRS         9
  27. #define THREE_PAIRS       10
  28. #define THREE_OF_A_KIND   11
  29. #define FOUR_OF_A_KIND    12
  30. #define FIVE_OF_A_KIND    13
  31. #define SM_STRAIGHT       14
  32. #define LG_STRAIGHT       15
  33. #define FULL_STRAIGHT     16
  34. #define FULL_HOUSE        17
  35. #define HOUSE             18
  36. #define TOWER             19
  37. #define CHANCE            20
  38. #define YAHZEE            21
  39. #define TOTAL             22
  40. #define SAVED_ROLLS       23
  41. #define MAX_LABELS   (SAVED_ROLLS + 1)
  42.  
  43. /* scoring methods */
  44. #define SCMTD_TRADITIONAL   0
  45. #define SCMTD_AMERICAN      1
  46. #define MAX_SCORINGMETHODS   (SCMTD_AMERICAN + 1)
  47.  
  48. /* game types */
  49. #define GAMETYPE_ORIGINAL   0
  50. #define GAMETYPE_MAXI       1
  51. #define MAX_GAMETYPES   (GAMETYPE_MAXI + 1)
  52.  
  53.  
  54. /* procedure for calculating score */
  55. typedef void (*scoreproc) (UBYTE dice[], UBYTE score[]);
  56.  
  57. struct rules {
  58.    BOOL        labels[MAX_LABELS];
  59.    UBYTE       num_dice;
  60.    scoreproc   calc_score;
  61.    UBYTE       bonus_limit, bonus;
  62.    ULONG       yahzee_label;
  63. };
  64. typedef struct rules game[MAX_SCORINGMETHODS];
  65.  
  66.  
  67. extern UBYTE   label_msg[];
  68. /* definition of the different games */
  69. extern game   game_definition[MAX_GAMETYPES];
  70.  
  71.  
  72. UBYTE
  73. game_number (
  74.    struct rules  *rules);
  75.  
  76. UBYTE
  77. num_upper_labels (
  78.    struct rules  *rules);
  79.  
  80. UBYTE
  81. num_lower_labels (
  82.    struct rules  *rules);
  83.  
  84. UBYTE
  85. upper_label_len (
  86.    struct rules  *rules);
  87.  
  88. UBYTE
  89. lower_label_len (
  90.    struct rules  *rules);
  91.  
  92. #endif
  93.