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

wolf6656

New Member
Joined
Nov 27, 2005
Messages
2
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
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
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!
 

wolf6656

New Member
Joined
Nov 27, 2005
Messages
2
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 baddie As Range
Dim dicetotal As Range

Set gooddie = Worksheets("DICE").Range("A2")
Set neutraldie = Worksheets("DICE").Range("b2")
Set baddie = Worksheets("DICE").Range("c2")
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.

Thanks for the reply.
wolf
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
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.
 

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,028
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}
 

Watch MrExcel Video

Forum statistics

Threads
1,118,033
Messages
5,569,777
Members
412,291
Latest member
marypolitan
Top