Can anyone help me with a c# program that can draw fixtures for a league table for a soccer game with about 4 teams.
Please I want the source codes as well or send it to my email:
Can anyone help me with a c# program that can draw fixtures for a league table for a soccer game with about 4 teams.
Please I want the source codes as well or send it to my email:
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
makando kabilaPosted Feb 15, 2009, 10:53 AM
I know more can be done to take the teams as teams names when the program runs and also the actual scheduling. I can add it later.
private void CreateFixtures()
{
List
string[] teams = { "A", "B", "C", "D" };
foreach (string x in teams)
foreach (string y in teams)
{
if (x != y)
{
string teampair = MakePair(x, y);
if (!FixtureExists(x, y, fixtures))
fixtures.Add(teampair);
}
}
PrintResults(fixtures);
}
private string MakePair(string teamx, string teamy)
{
return teamx + " - " + teamy;
}
private bool FixtureExists(string team1, string team2, List
{
bool isleftmatch = lstFixtures.Exists(delegate(string s) { return s == MakePair(team1, team2); });
if (!isleftmatch)
{
bool rightmatch = lstFixtures.Exists(delegate(string s) { return s == MakePair(team2, team1); });
isleftmatch = rightmatch;
}
return isleftmatch;
}
private void PrintResults(List
{
StringBuilder strb = new StringBuilder();
foreach(string s in fixturelist)
{
strb.Append(s + "\r\n");
}
textBox1.Text = strb.ToString();
}