I want to know what you want to do and what you can do. 

解决方案 »

  1.   

    Try to solve this problem:This question isn’t a specific Javaprogramming question, instead it’s a more general programming problem/challenge. I’m trying to create a football league generator in java. It should be possible to generate leagues with 4 to 24 teams (only even leagues, 4, 6, 8, 10… teams). Every team should meet each other twice (homeTeam vs. awayTeam and awayTeam vs. homeTaem).An example:A league with 4 teams, A, B, C and D.Round 1.1 Round 1.2 Round 1.3
    A vs. B B vs. C A vs. C
    C vs. D D vs. A D vs. BRound 2.1 Round 2.2 Round 2.3
    B vs. A C vs. B C vs. A
    D vs. C A vs. D B vs. DBecause there are 4 teams it is easy to calculate the following: 
    1: It is necessary to have 2 matches per round. 
    2: Total of 12 matches for the whole league
    3: It is necessary to have 6 rounds (12/2) in the league.It is also easy to generate all the matches that are going to be played in the league:
    A vs. B B vs. C C vs. D D vs. A
    A vs. C B vs. D C vs. A D vs. B
    A vs. D B vs. A C vs. B D vs. CThe difficult part is to put the matches in rounds so that every team plays once and only once per round. This is the part that is challenging! Any suggestions how this could be solved?