Hi I am currently learning to do a baccarat casino game for learning programming.
I’ve got all the codes down and what’s left is only the chip-betting-on-table part. Basically here is what I want to do:
I have a few types of chips with the following chip values:
- $1,000
- $5,000
- $10,000
- $50,000
- $100,000
- $500,000
- $1,000,000
These chips are located at the bottom of the screens. When user tap the chip, it will be highlighted. Then user needs to tap either on PLAYER or BANKER or TIE to place the chips on the table.
When user tap chip of $1000, and tap on the PLAYER, a $1000 chip will be displayed inside the PLAYER betting area. Tap twice, two $1000 chip stack on each other will be displayed, and so on. When the user tap 5 times, it will automatically change to a single $5000 chip on the table.
If select the $5000 chip and tap twice on the PLAYER, a $10,000 chip will be displayed, and so on. You get the idea.
The order of the stack of the chips, must be such a way that the highest valued chip at the most bottom. For example if user select $1,000 chip and tap once, then select a $5,000 chip and tap once, the $5,000 chip will be placed at the bottom of the $1,000 chip.
When the user credit is less than $10,000 for example, then the $10,000, $50,000, $100,000, $500,000, $1mil chip shall be disabled (user cannot select those chips to bet because user’s credit is less than those chip values)
I went as far as to make an IF,ELSEIF statement to cater for all possible bet amounts, but it doesn’t make sense as I have to make an IF, ELSEIF statement with one thousand possible bet amounts. (from $1,000 to $1,000,000)
Therefore is there any shorter methods of programming this conditions? Making a table with 1000 entries of each bet amount & their stack orders are also seems like a bad programming practice. Although it will works. But what if later on I decided to have more chip values such as the $100, $250, $500 added in?