I need to know if its better for me to make Decision Table or if-else statement. if decision table is better for the rules below please tell me what are the basic codes I need to make it. I have tried making it using if-else statement but the output is not what i want. This question is for baccarat game, and here are the rules:
- First, if either player has a hand of 8 or 9, called a “natural”, the game ends and no third cards are ever drawn
Second, if there was no natural, the player receives a third card (“draws” or “hits”), or not (“stands pat”), according to the following rule: -The player must draw a card with a hand value of 5 or less, and stand pat with 6 or more. -Third, if there was no natural, the dealer draws or stands pat according to the following rules -If the player did not draw a card, then the dealer follows the same rule as the player: The dealer must draw a card with a hand of 5 or less, and stand pat with 6 or more.
-If the player did draw a third card, the decision is based on the value of that card alone (call it C3), and the value of the dealer’s hand. The dealer must draw a card with a hand value less than or equal to some limit L, where L is calculated as follows:
If C3 is 8 or more, let Y = C3-10, else let Y = C3. So Y will be from -2 to 7.
o To get L, divide Y by 2, truncate the result, and add 3. L will be from 2 to 6. o The dealer must draw with a hand value of L or
less.