| | |
Moola Gold Rush Solver
![]() |
•
•
Join Date: Jun 2007
Posts: 5
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Jun 2007
Posts: 5
Reputation:
Solved Threads: 0
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...
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...
•
•
Join Date: Jul 2006
Posts: 608
Reputation:
Solved Threads: 150
No, it makes sense.
Try this:
Jeff
Try this:
Python Syntax (Toggle Plain Text)
def perms(s): if len(s) == 0: return [] elif len(s) == 1: return [s] retval = [] for x in s: base = s[:] base.remove(x) for tmp in perms(base): tmp = [x] + tmp retval.append(tmp) return retval print perms([]) print perms([1]) print perms(range(1,3)) print perms(range(1,4))
Jeff
Last edited by jrcagle; Sep 10th, 2007 at 11:00 pm.
•
•
Join Date: Jul 2006
Posts: 608
Reputation:
Solved Threads: 150

Well, the basic algorithm is this:
Python Syntax (Toggle Plain Text)
Run through the set, taking each element in turn. For each element x, take the *rest* of the set and compute the perms of that subset. Add element x to each of the sets in the perms. 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
![]() |
Similar Threads
- Tell us about yourself! (Community Introductions)
- Can't get rid of dumphook.exe and Antivirus Gold (Viruses, Spyware and other Nasties)
- fill a text in gold (Graphics and Multimedia)
Other Threads in the Python Forum
- Previous Thread: Accessing system resources
- Next Thread: Metadata in XML with Python
| Thread Tools | Search this Thread |
alarm ansi assignment avogadro backend beginner binary bluetooth character cmd code customdialog cx-freeze data decimals dictionary directory dynamic error examples exe file float format function generator gnu graphics gui halp heads homework http ideas import input itunes java leftmouse line linux list lists loop maze module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule screensaverloopinactive script scrolledtext slicenotation sqlite ssh statistics string strings sudokusolver sum terminal text thread threading time tlapse tricks tuple tutorial ubuntu unicode urllib urllib2 variable ventrilo vigenere web webservice wikipedia write wxpython xlib





