Current location: Hot Scripts Forums » General Community » Script Requests » Match schedule script


Match schedule script

Reply
  #1 (permalink)  
Old 12-10-03, 02:21 AM
Marko Marko is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Sweden
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Match schedule script

Hib !
I´m looking for a match schedule script.
If i have like 3 divitions and 10 teams in every divition, then in some way generate so that all teams have a match aginst all in the same divition. And would be great to just make it so that the teams only have one match aginst each other. And doble matches.
Sorry for my bad spelling, but i hope that u understand waht im looking for.

reggards

//Marko
Reply With Quote
  #2 (permalink)  
Old 12-10-03, 03:54 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
I'll move this to the script requests forum
Reply With Quote
  #3 (permalink)  
Old 12-10-03, 06:23 AM
Marko Marko is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Sweden
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Never mind i have solved it now
And here is the script if any one elsa want it.



<?php

$teams = array("Team A","Team B","Team C","Team D","Team E", "Team F", "Team G", "Team H");
$n = count($teams); // Number of teams
if ($n %2 != 0) { $n++; $ghost = $n;}
$rounds = $n-1; // Number of rounds, single is $n-1 double is ($n-1)*2

echo "<pre>";
for ($r = 1; $r <= $rounds ; $r++) {
$matches = "";
for ($i = 1; $i <= $n / 2; $i++)
{
$hometeam = ($i==1)? 1 : (($r+$i-2) % ($n-1) +2);
$awayteam = ($n - 1 + $r - $i) % ($n -1) +2 ;
if ($r %2) {
$swap = $hometeam;
$hometeam=$awayteam;
$awayteam = $swap;
}
if (($hometeam!=$ghost) && ($awayteam!=$ghost)) {
$matches .= sprintf ("%s - %s<br>", $teams[($hometeam-1)], $teams[($awayteam-1)]);
}
}
printf("<b>%Round %3d :</b><br><br>$matches<br><br>\n", $r);
}
echo "</pre>\n";
?>

Enoy

//Marko
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for a good review management script griz_fan Script Requests 10 07-29-07 05:08 AM
live chat script, form script, autoresponder, babalu Script Requests 0 12-04-03 01:55 PM
Developer needed to database pre-written script twastudios Script Requests 0 11-19-03 01:16 PM
How to integrate a search engine to my script ? Simonoff Script Requests 2 10-31-03 03:43 PM
Need help with a script boardpix PHP 7 06-08-03 11:37 PM


All times are GMT -5. The time now is 09:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.