Skip to content

Instantly share code, notes, and snippets.

@JohnRuddy
Created December 12, 2015 16:46
Show Gist options
  • Save JohnRuddy/ba308b43107cf2a9b8e4 to your computer and use it in GitHub Desktop.
Save JohnRuddy/ba308b43107cf2a9b8e4 to your computer and use it in GitHub Desktop.
Republic of Ireland - Euro 2016 Draw
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Euro2016RepublicOfIrelandGroups
{
// 4 teams in a group
class Group
{
public string t1 { get; set; }
public string t2 { get; set; }
public string t3 { get; set; }
public string t4 { get; set; }
}
class Program
{
static void Main(string[] args)
{
List<Group> Groups = new List<Group>();
List<string> Pot1 = new List<string> { "France", "Spain","Germany","England","Portugal","Belgium"};
List<string> Pot2 = new List<string> { "Italy", "Russia", "Switzerland", "Austria", "Croatia", "Ukraine" };
List<string> Pot3 = new List<string> { "Czech Republic", "Sweden", "Poland", "Romania", "Slovakia", "Hungary" };
List<string> Pot4 = new List<string> { "Turkey", "Republic of Ireland", "Iceland", "Wales", "Albania", "Northern Ireland" };
// Do the draw!
foreach (var t1 in Pot1)
{
foreach (var t2 in Pot2)
{
foreach (var t3 in Pot3)
{
foreach (var t4 in Pot4)
{
Group g = new Group { t1 = t1, t2 = t2, t3 = t3, t4 = t4 };
Groups.Add(g);
}
}
}
}
// select all the groups with Irish Involvement
var IrelandsGroups = from g in Groups
where g.t4.Equals("Republic of Ireland")
select g;
foreach (var group in IrelandsGroups)
{
Console.WriteLine(group.t1 + "," + group.t2 + "," + group.t3 + "," + group.t4);
}
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment