Chip betting sequence programming

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. $1,000
  2. $5,000
  3. $10,000
  4. $50,000
  5. $100,000
  6. $500,000
  7. $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?

I would use some simple math steps repeatedly.

say your amount of money is 27750

first say something like:

x = math.floor(money/10000)

this will give you a value of 2 for x (since money/10000 = 2.775 and math.floor will round down to 2)

remainder = money - (x*10000)

this will give a value of 7750 for remainder.

Then do the same step for the next size chip, for instance 5000 as chip size

x = math.floor(remainder/5000)

this will give a value of 1 for x (since remainder/5000 = 1.51 and math.floor rounds down to 1)

Go on like this and X will give you the amount of chips in this size, for each size.

You could actually do this based on a table containing the chip sizes by making a table:

local chipsizes = {10000, 5000, 1000, 500, 250, 100, 50}

and iterating over the chip sizes in this table, to keep things clean and flexible!

I would use some simple math steps repeatedly.

say your amount of money is 27750

first say something like:

x = math.floor(money/10000)

this will give you a value of 2 for x (since money/10000 = 2.775 and math.floor will round down to 2)

remainder = money - (x*10000)

this will give a value of 7750 for remainder.

Then do the same step for the next size chip, for instance 5000 as chip size

x = math.floor(remainder/5000)

this will give a value of 1 for x (since remainder/5000 = 1.51 and math.floor rounds down to 1)

Go on like this and X will give you the amount of chips in this size, for each size.

You could actually do this based on a table containing the chip sizes by making a table:

local chipsizes = {10000, 5000, 1000, 500, 250, 100, 50}

and iterating over the chip sizes in this table, to keep things clean and flexible!