Random Pairing

Jared knowlj at hotmail.com
Tue Jul 6 19:56:26 CEST 2004

For a tournament I'm making a random pairing generator.  I haven't
quite figured out how to randomly pair yet though.  Here's what I have
so far:

from random import *
import string
import random

prompt1 = "Who is Player 1?\n"
p1 = raw_input(prompt1)
prompt2 = "Who is Player 2?\n"
p2 = raw_input(prompt2)

prompt3 = "Who is Player 3?\n"
p3 = raw_input(prompt3)
prompt4 = "Who is Player 4?\n"
p4 = raw_input(prompt4)
print (p1,p2,p3,p4)

#Randomly pair players
index = MOD(Random(<Seed>)%3
for i < 4
volume = Player[index]
print p1, "vs.", p2
print p3, "vs.", p4

while 1:
    prompt5 = "Who won the in the first pairing?\n"
    winner1 = raw_input(prompt5)
    prompt6 = "Who won the in the second pairing?\n"
    winner2 = raw_input(prompt6)
    print winner1, "vs.", winner2
#/    if winner1 = v and winner2 = y
#/    print x, "vs.", z
#/    if winner1 = v and winner2 = z
#/    print x, "vs.", y
#/    if winner1 = v and winner2 = x
#/    print y, "vs.", z
 #Pair the winner vs. the winner and the loser vs. the loser   
    y = raw_input(prompt5)#input didn't work
    if str(y) == 'Exit' or str(y) == 'exit':

More information about the Python-list mailing list