Click here to Skip to main content
15,880,967 members
Home / Discussions / C#
   

C#

 
QuestionDataGridViewComBoBoxColumn Binding Problem Pin
Abdul Rahman Hamidy21-Nov-09 22:44
Abdul Rahman Hamidy21-Nov-09 22:44 
Questiondatagridview checkbox Pin
Yulianto.21-Nov-09 21:32
Yulianto.21-Nov-09 21:32 
AnswerMessage Closed Pin
21-Nov-09 22:41
stancrm21-Nov-09 22:41 
GeneralRe: datagridview checkbox Pin
Yulianto.21-Nov-09 23:04
Yulianto.21-Nov-09 23:04 
GeneralRe: datagridview checkbox Pin
dojohansen23-Nov-09 1:36
dojohansen23-Nov-09 1:36 
Questionschedule generator not working properly Pin
rooster215421-Nov-09 8:37
rooster215421-Nov-09 8:37 
QuestionRe: schedule generator not working properly Pin
harold aptroot21-Nov-09 8:52
harold aptroot21-Nov-09 8:52 
AnswerRe: schedule generator not working properly Pin
dojohansen23-Nov-09 1:53
dojohansen23-Nov-09 1:53 
Well it's no wonder is it?

For each team in the league, you loop through the 16 weeks.
For each week, you draw an opponent at random.
If there are no games (team vs opponent) in the league
AND no games where the team is either the home team or the away team
=> create (team vs opponent) game

if (!games.Any(g => g.Home == team && g.Away == opponent) && !games.Any(g => g.Home == team || g.Away == team))
..
else if (!games.Any(g => g.Home == team || g.Away == team))


First, you clearly didn't mean what your code says - that a game should only be created if there are no games where the current team plays either at home or away. Second, you've forgotten that if your draw results in a game that already exists you can't just move on to the next week without creating a game!

I'm not sure I've understood exactly what you *want* to happen, but if you want to generate a normal leage where all teams play all the other teams once at home and once away, why not just create them systematically using a nested loop and randomize the schedule afterwards?

Or, if it's not a normal league but more of a sort of cup, why not do like in a real draw and remove the teams that have been drawn so you can't draw the same combination again?
QuestionLoad a txt file in a richTextBox? Pin
ahlm21-Nov-09 8:34
ahlm21-Nov-09 8:34 
AnswerRe: Load a txt file in a richTextBox? Pin
Luc Pattyn21-Nov-09 8:37
sitebuilderLuc Pattyn21-Nov-09 8:37 
GeneralRe: Load a txt file in a richTextBox? Pin
ahlm21-Nov-09 8:40
ahlm21-Nov-09 8:40 
GeneralRe: Load a txt file in a richTextBox? Pin
Luc Pattyn21-Nov-09 9:02
sitebuilderLuc Pattyn21-Nov-09 9:02 
GeneralRe: Load a txt file in a richTextBox? Pin
ahlm21-Nov-09 11:53
ahlm21-Nov-09 11:53 
GeneralRe: Load a txt file in a richTextBox? Pin
Luc Pattyn21-Nov-09 12:23
sitebuilderLuc Pattyn21-Nov-09 12:23 
GeneralRe: Load a txt file in a richTextBox? Pin
ahlm22-Nov-09 7:38
ahlm22-Nov-09 7:38 
GeneralRe: Load a txt file in a richTextBox? Pin
dojohansen23-Nov-09 9:32
dojohansen23-Nov-09 9:32 
QuestionHow to print (and preview) any document - but not with CrystalReport Pin
E_Gold21-Nov-09 7:02
E_Gold21-Nov-09 7:02 
AnswerRe: How to print (and preview) any document - but not with CrystalReport Pin
Luc Pattyn21-Nov-09 7:11
sitebuilderLuc Pattyn21-Nov-09 7:11 
GeneralRe: How to print (and preview) any document - but not with CrystalReport Pin
E_Gold21-Nov-09 8:41
E_Gold21-Nov-09 8:41 
GeneralRe: How to print (and preview) any document - but not with CrystalReport Pin
Luc Pattyn21-Nov-09 9:04
sitebuilderLuc Pattyn21-Nov-09 9:04 
AnswerRe: How to print (and preview) any document - but not with CrystalReport Pin
dojohansen23-Nov-09 9:35
dojohansen23-Nov-09 9:35 
Questionquick combobox question Pin
Ronni Marker21-Nov-09 5:36
Ronni Marker21-Nov-09 5:36 
AnswerMessage Closed Pin
21-Nov-09 5:45
stancrm21-Nov-09 5:45 
GeneralRe: quick combobox question Pin
Ronni Marker21-Nov-09 6:04
Ronni Marker21-Nov-09 6:04 
GeneralRe: quick combobox question Pin
PunkIsNotDead21-Nov-09 18:21
PunkIsNotDead21-Nov-09 18:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.