Moola Gold Rush Solver

Reply

Join Date: Jun 2007
Posts: 5
Reputation: justmonkey23 is an unknown quantity at this point 
Solved Threads: 0
justmonkey23 justmonkey23 is offline Offline
Newbie Poster

Moola Gold Rush Solver

 
0
  #1
Sep 9th, 2007
I am trying to write a program that will help me with Gold Rush...This is a game on moola.com. Gold Rush is the most popular game available for players to wager their winnings on. It involves a series of six blind bids on gold nuggets with various point values. The player with the most points at the end wins the game, and all of the cash wagered. I have created a program that evaluates a game and gives out a winner...but the game needs to be input with the form of 5,3,1,2,4,6,5,6,2,1,3,4,1,6,5,3,2,4 the first six are the gold I play, the middle six are the gold in the being wagered for and the last six are the gold that the other player chooses...so basically my question is what line(s) of code would give me every possible game...like
1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6
1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,6,5 etc

there are 373 million possible games I believe

Any ideas would be great
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 5
Reputation: justmonkey23 is an unknown quantity at this point 
Solved Threads: 0
justmonkey23 justmonkey23 is offline Offline
Newbie Poster

Moola Gold Rush Solver

 
0
  #2
Sep 9th, 2007
Or does anyone know how to create a list of all variations of a six digit number that has a single digit range from 1...6 and uses one digit per field...I bet this is very unclear


This is the form
1,2,3,4,5,6
6,5,4,3,2,1
1,3,5,2,4,6
2,4,6,1,3,5


6! would lead me to believe there are 320 variations...
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 608
Reputation: jrcagle is on a distinguished road 
Solved Threads: 150
jrcagle jrcagle is offline Offline
Practically a Master Poster

Re: Moola Gold Rush Solver

 
0
  #3
Sep 10th, 2007
No, it makes sense.

Try this:

  1. def perms(s):
  2. if len(s) == 0:
  3. return []
  4. elif len(s) == 1:
  5. return [s]
  6. retval = []
  7. for x in s:
  8. base = s[:]
  9. base.remove(x)
  10. for tmp in perms(base):
  11. tmp = [x] + tmp
  12. retval.append(tmp)
  13. return retval
  14.  
  15. print perms([])
  16. print perms([1])
  17. print perms(range(1,3))
  18. print perms(range(1,4))

Jeff
Last edited by jrcagle; Sep 10th, 2007 at 11:00 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 5
Reputation: justmonkey23 is an unknown quantity at this point 
Solved Threads: 0
justmonkey23 justmonkey23 is offline Offline
Newbie Poster

Re: Moola Gold Rush Solver

 
0
  #4
Sep 10th, 2007
Wow thanks that was what I needed...Could you do me another favor, please explain what each line means?
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 608
Reputation: jrcagle is on a distinguished road 
Solved Threads: 150
jrcagle jrcagle is offline Offline
Practically a Master Poster

Re: Moola Gold Rush Solver

 
0
  #5
Sep 11th, 2007


Well, the basic algorithm is this:

  1. Run through the set, taking each element in turn.
  2. For each element x, take the *rest* of the set and compute the perms of that subset.
  3. Add element x to each of the sets in the perms.
  4. Return the union of those results.

So for s = [1,2,3], we would have

1 --> compute perms of [2,3]; add to each: [1,2,3], [1,3,2]
2 --> compute perms of [1,3]; add to each: [2,1,3], [2,3,1]
3 --> compute perms of [1,2]; add to each: [3,1,2], [3,2,1]

Then we "add" (really, take the union) of each set of results above.

The first four lines compute the base cases. The rest of the lines perform the recursive algorithm above.

Hope it helps,
Jeff
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 2
Reputation: jem777 is an unknown quantity at this point 
Solved Threads: 0
jem777 jem777 is offline Offline
Newbie Poster

Re: Moola Gold Rush Solver

 
0
  #6
Jul 7th, 2009
Great script. The format is indeed useful.

SNIP
Last edited by happygeek; Jul 7th, 2009 at 7:55 am. Reason: fake sig snipped - no advertising
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC