using System.Collections.Generic;
static coloredCup GreenCup, PurpleCup, YellowCup, OrangeCup, RedCup, BlueCup;
static List<coloredCup> coloredCupTower = new List<coloredCup>();
Girl.solveColoredCupsTower();
public class Universe : Program
public static void createCups()
GreenCup = new coloredCup(1, Color.Green);
PurpleCup = new coloredCup(2, Color.Purple);
YellowCup = new coloredCup(3, Color.Yellow);
OrangeCup = new coloredCup(4, Color.Orange);
RedCup = new coloredCup(5, Color.Red);
BlueCup = new coloredCup(6, Color.Blue);
public class Girl : Program
public static void solveColoredCupsTower()
coloredCupTower.Add(BlueCup);
coloredCupTower.Add(RedCup);
coloredCupTower.Add(GreenCup);
coloredCupTower.Remove(GreenCup);
compareAndPossiblyInsert(ref PurpleCup);
compareAndPossiblyInsert(ref GreenCup);
coloredCupTower.Remove(GreenCup);
compareAndPossiblyInsert(ref YellowCup);
coloredCupTower.Remove(PurpleCup);
compareAndPossiblyInsert(ref YellowCup);
compareAndPossiblyInsert(ref PurpleCup);
compareAndPossiblyInsert(ref GreenCup);
removeTwo(ref GreenCup, ref PurpleCup);
compareAndPossiblyInsert(ref OrangeCup);
removeTwo(ref YellowCup, ref RedCup);
compareAndPossiblyInsert(ref OrangeCup);
compareAndPossiblyInsert(ref RedCup);
compareAndPossiblyInsert(ref YellowCup);
compareAndPossiblyInsert(ref RedCup);
removeTwo(ref YellowCup, ref OrangeCup);
compareAndPossiblyInsert(ref RedCup);
compareAndPossiblyInsert(ref OrangeCup);
coloredCupTower.Add(YellowCup);
compareAndPossiblyInsert(ref PurpleCup);
coloredCupTower.Add(GreenCup);
public static void control()
for (int i = 1; i < coloredCupTower.Count; i++)
if (coloredCupTower[i].size >= coloredCupTower[i - 1].size)
Console.WriteLine("Error. Can't access parallel Universe.");
Console.WriteLine("Yaaaaeeehhiiiiyyy ... yeh .. yaay. Yeah you did it!");
static void compareAndPossiblyInsert(ref coloredCup c)
if (c.size < coloredCupTower[coloredCupTower.Count - 1].size)
static void removeTwo(ref coloredCup c1, ref coloredCup c2)
coloredCupTower.Remove(c1);
coloredCupTower.Remove(c2);
public coloredCup(int s, Color c)