# get dice roll -pull items from asst bag-then update bag

#### wolf6656

##### New Member
This is obviously a game.
I have 7 types of chips(red, green, gold, white, blue, brown, black), with different values, distributed amongst 3 bags.

The good bag contains only the first 3 types. (three types in constant distribution)
The bad bag contains only the last 4 types. (4 types in constant distribution)
The mixed bag contains an assortment from the first two bags. (seven types of chips in different quantities, the odds are always changing.)

The game starts with more bad than good in the mixed bag, but eventually the good will start to increase and change the odds. (The chips are called KARMA CHIPS)
When I simulate a roll of three dice, you take the red dice qty out of the bottomless first bag.
You take the black dice quantity out of the bottomless second bag.
You take the white dice quantity out of the mixed bag.

You then play your turn with the chips. (move etc.)
At the end of the turn, you pull a certain variable number of chips from either or both of the first two bags, and put them in the mixed bag, thus changing the odds for the next player, then update the new total.

The question is, how do you stop the dice from rolling while everything else is going on? Every time you do something, the dice roll again.
Also, how do you replace the old mixed bag contents with the new mixed bag contents at the end of the turn, so they will be different for the next player?

I have all the formulas for the odds of picking things out of the mixed bag, but I can't figure out how to stop the dice, or how to update the contents at the end of the turn.(replace previous contents with new contents)

This may sound weird, but I've read weirder in here.

Thanks,
wolf

### Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You can do this a whole lot of ways!

How have you coded?
Did you do it with Sheet Formulas or did you use VBA.
Did you build UserForms or do you use Controls on your Sheet and if you did which type of controls Form controls, XML or Control toolbox controls.

You description of the game helps, but without code samples no one will be able to help you other than offer general ideas!

I was just trying to do it using Excel formulas etc., but it appears with the calculation control limitations, I'm going to have to embark into the Ocean of VBA.
I've never used VBA in Excel before, and I haven't coded at all, in close to 10 years, back in the college with C++.

I have poked around in the forum, and seen what some of you guys are doing. Amazing really. And here I thought I knew how to use Excel! Really it's like I've been golfing with a driver and a putter. I had to install the VBA help from my Office CD, and am now learning how to meld VBA and Excel together. It's time to start using the rest of the clubs in the golf bag.

Here's what I came up with for a roll of 3 dice.

Sub ROLL()
Dim gooddie As Range
Dim neutraldie As Range
Dim dicetotal As Range

Set gooddie = Worksheets("DICE").Range("A2")
Set neutraldie = Worksheets("DICE").Range("b2")
Set dicetotal = Worksheets("DICE").Range("D2")
Randomize
gooddie.Formula = Int((6 - 1 + 1) * Rnd + 1)
Randomize
neutraldie.Formula = Int((6 - 1 + 1) * Rnd + 1)
Randomize
baddie.Formula = Int((6 - 1 + 1) * Rnd + 1)
dicetotal.Formula = gooddie + neutraldie + baddie

End Sub

Probably not very optimal, but it works. Now I have to code the chip selection, because that works on random numbers as well based on the population distribution in each bag of chips.

wolf

Looks like you are off to a very good start!

Describe what it is you need help on. What you have and where you have it. And, what you want to end up with and where.

Nothing wrong with a VBA solution but you can probably do this without VBA. Use iterative calculations. For examples see Stephen Bullen's http://www.oaltd.co.uk/Excel/SBXLPage.asp#WksFuncs All but one of the examples demonstrate the power of iterative calculations.
wolf6656 said:
I was just trying to do it using Excel formulas etc., but it appears with the calculation control limitations, I'm going to have to embark into the Ocean of VBA.{snip}

Replies
0
Views
750
Replies
3
Views
354
Replies
6
Views
689
Replies
6
Views
1K
Replies
2
Views
1K

1,211,435
Messages
6,101,846
Members
447,758
Latest member

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back