Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 11th, 2004, 01:46 PM
digitalbanana11 digitalbanana11 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 11 digitalbanana11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
League table loops

Hey,

I am trying to create a program to determine the match timetable for my local footie club.

I cannot seem to find the right loop method of doing it.

There are a total of 12 teams in the league, and each team plays the other teams in the league (11other teams) twice, one home and one away, each season , and each team only plays one match per week.

Edit: Forgot to menthion, that i have the teams stored in an array list, 0-11.

Any sugestions?

Last edited by digitalbanana11 : June 11th, 2004 at 01:50 PM. Reason: forgot some aspects of Question

Reply With Quote
  #2  
Old June 12th, 2004, 07:59 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Sorry i may be the only one but i have no idea whats going on here. Maybe a little more info? This might simply be because i have no idea how sports tables work but

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old June 12th, 2004, 09:36 AM
digitalbanana11 digitalbanana11 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 11 digitalbanana11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sorry, I'll explain more,

I am try to print to a file a table like the following, i can do the file print part, but i need a loop or nested loops in order to produce the table in the first place...but i cannot work out how to work out the weeks correctly.

table e.g. with 8 teams:

Week Home Away
wk1 team 1 team 2
wk2 team 1 team 3
wk3 team 1 team 4
wk4 team 1 team 5
wk5 team 1 team 6
wk6 team 1 team 7
wk7 team 1 team 8
wk8 team 2 team 1
wk3 team 2 team 3
wk4 team 2 team 4
wk5 team 2 team 5
wk6 team 2 team 6
wk7 team 2 team 7
wk2 team 2 team 8
.....etc.....

the above is an example of how i think ive worked it out.
basically each team has to play each other team in the league twice, one home game, and one away. but each team only plays one game per week.

The season is 14 weeks long, and there are 4 games per week, (each team plays 1 game per week so each team plays a match ).

by my calculation, that comes to 56 games in total, so there should be 56 lines in the table...and only 4 games per week, amking 14 weeks.

I hope that helps,
that is how i understand it.

Reply With Quote
  #4  
Old June 12th, 2004, 11:33 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Mmmm, i think i know what your getting at but the example output you gave doesn't fit with what you said. Could you give an example for the first three weeks and i'll see what i can do. I just dont get how the weeks work, the home and away bit is easy but... curse my chess playing self, i should have been following sports .

Edit: heres the home and away bit,

Code:
for x in xrange(1, 9):
    for y in xrange(1, 9):
        if x != y: print 'team %d Vs team %d' % (x, y)


Mark.

Last edited by netytan : June 12th, 2004 at 11:43 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > League table loops


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT