1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Golf Pairing Algorithm

Discussion in 'PHP' started by Forbidd3n, Oct 1, 2013.

  1. #1
    I am in need of a golf pairing algorithm. These are the specs... The user will supply the number of players and the number of rounds. There is always 4 players per round. If you can get it to work with perfect pairing numbers, then I can fill in no perfect pairing numbers with ghost players and remove them once the teams are generated.


    $players = array('A','B','C','D','E','F','G','H','I','J','K','L');

    $numPerTeam = 4;
    $numRounds = 3;
    $numTeams = (count($players)/$numPerTeam);


    What needs to happen is that each player has to play with each other player at least once before they can play with the same player again. For example, A can't play with B again until he has played with C-L. Each player can only play once per round. Once they have played with everyone at least once, then they can be repeated, but needs to be evening repeated as possible. Below if an example worked out in excel.


    Round 1 -
    Team 1 - ABCD
    Team 2 - EFGH
    Team 3 - IJKL

    Round 2 -
    Team 1 - AEIJ
    Team 2 - BFJL
    Team 3 - CGDK

    Round 3 -
    Team 1 - CJGH
    Team 2 - DLEA
    Team 3 - IBFK

    I have attached a spreadsheet with instructions.

    I am willing to offer $40 on PayPal for a working solution. It has to work even if I plug in letters A-O or any number of players divisible by 4 evenly. It must work to be paid! If you want to set up a test page allowing me to plug in variables to populate and make sure it work, please do.


    Attached Files:

    Forbidd3n, Oct 1, 2013 IP