Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deck creation program,: problem with random numbers. weight, etc.

Status
Not open for further replies.

rewclaus

Programmer
Mar 7, 2005
16
US
Hi,

I am trying to make a program that will randomly generate a deck of sixty cards for a ccg (customizable card game). In this deck I would like there to be a certain number of cards of different rarities (Rare, Uncommon, Common and Fixed). I have no idea how to even begin this project so I was hoping that someone here could lend me a hand in at least starting it up.

One of the major problems I run into is this:

I wish to have 60 cards in a single deck: 1 Fixed, 3 Rare, 20 Uncommon, and 36 Common. Here is one twist: say I have 108 Rares, 108 Uncommons, and 108 Commons to choose from. For each rarity the same card may be chosen up to two times (but no more than that). The other twist I have a problem grasping is this: there are some cards that are tribe specific and depending on the tribe I am making a deck for should be weighted more (have a higher percentage to get in the deck). Of the 108 cards for each rarity, 36 are tribe specific for rares, 30 for uncommon, and 30 for common. Breaking it down further, there are 6 tribes (6 Rare cards per tribe, 5 uncommon, and 5 common).

So when choosing 3 rares from the 108 possible rares there should be a greater chance to get one of the 5 tribe specific rares than any of the others (not too big of a difference though).

Can anyone help me out?

Thanks,

rewclaus
 
Ok, I may offer some suggestions. It probably could give you a start ;)) [I think I could make something out of this ;))]
Ok.

1)use array for a deck. Use lots of arrays!
2) Then selecting say 3 Rare just select from array of rare cards 3 times
3) 108 card need an array of say flags|counters [initialized with 0]. Then you select card, you set counter to counter +1... If Counter is already 2 (and no more then that!) -- simplest way is to repeat random choise until you fall into valid one.
4) well, for tribe specific: I suggest a workaround. First get a random number to choose if you will choose from all cards or from specific only (if rnd>.05 ...). Then specific cards will get bigger chances (though I cannot say how much bigger, but that could be ajusted).

Hope that helps... a little ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top