This is where the logic seems to be falling away from me.

Anyone here spot why the duplicate matches?
        <cfloop from="1" to="#variable.totalrounds#" index="roundvar">
            <cfloop from="1" to="#matchesPerRound#" index="match">
                <cfset home = (roundvar + match) mod (teams -1)>
                <cfset away = (teams - 1 - match + roundvar) mod (teams -
1)>
                <cfif match eq 0>
                        <cfset away = (teams - 1)>
                </cfif>
                <cfset variable.rounds[roundvar][match] = team_name(home+1,
names) & " v " & team_name(away+1, names)><br>
    <cfdump var="#variable#">
            </cfloop>
        </cfloop>

Original PHP was:

for ($round = 0; $round < $totalRounds; $round++) {
        for ($match = 0; $match < $matchesPerRound; $match++) {
            $home = ($round + $match) % ($teams - 1);
            $away = ($teams - 1 - $match + $round) % ($teams - 1);
            // Last team stays in the same place while the others
            // rotate around it.
            if ($match == 0) {
                $away = $teams - 1;
            }
            $rounds[$round][$match] = team_name($home + 1, $names) 
                . " v " . team_name($away + 1, $names);
        }
    }
----------------------------------
William Seiter
ColdFusion Web Developer / Consultant
http://william.seiter.com

 
Have you ever read a book that changed your life?
Go to: <a href="www.winninginthemargins.com">www.winninginthemargins.com</a>
Use PassKey: GoldenGrove
You'll be glad you did.
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3569
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to