League matchup

Question Description

Need help with my Programming question - I’m studying for my class.

I want to make a script that will generate all possible matches from 1 to 16.

More info: I have 16 players in a tournament. I am developing league system and I need a script that will generate all the possible matches by rounds.

All possible matches - I mean that Player1 vs player2, player 3 vs player 4, players 1 vs player 3, player 16 vs 15, player 15 vs 5 etc...........

My table:

Playe1 | Player2| Round

In round = 1 it should be all league matches for all players 1-16,

in round = 2 the same, just a match that already was in round = 1 can't be in round = 2 

In round = 3 the same, just match that already was in round =1, round = 2 can't be in round = 3

.. etc untill all possible combinations are done

I am trying to figure it out for a while and couldnt find a solution. Any help will be appreciated!

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

do you mean like this rough picture?table.JPG

trimbiel (20)
Purdue University

Top quality work from this tutor! I’ll be back!

Just what I needed… fantastic!

Use Studypool every time I am stuck with an assignment I need guidance.


Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors