|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
||||
|
||||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > League table loops |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|