English translation follows the German text.
Hallo.
Hinter Türchen 9 wollte ich etwas wirklich Wunderschönes verstecken. Ich wollte nämlich ein Computer-Programm schreiben, das die Auslosung für die erste KO-Runde der diesjährigen Champions League simuliert. Ich habe es aber gerade geschrieben und es hat einen ziemlich schlimmen Fehler, dessen Schilderung ich jetzt anstelle des eigentlichen Programms Ihnen zum 9. Adventstag (ja, ist verspätet) schenken kann.
Bei der Auslosung werden 16 Teams in 8 Begegnungen sortiert.
Die Einschränkungen sind:
1) kein Team darf gegen das andere Team aus derselben Vorrundengruppe spielen. Es gibt 8 Gruppen mit jeweils 2 Teams.
2) kein Team darf gegen ein anderes Team aus demselben Land spielen.
3) Gruppenerste müssen gegen Gruppenzweite spielen.
Das war's. Heim und Auswärts sind auch kein Problem, denn die Gruppenersten immer das Rückspiel zu Hause spielen dürfen. Es klingt nicht so kompliziert und eigentlich ist es auch nicht.
Mein Programm "funktioniert" folgendermaßen.
Der erste Gruppenzweite wird zufällig ausgesucht und sein Gegner wird aus den Gruppenersten auch zufällig ausgesucht. Es wird dann überprüft, ob der Gruppenerste unter Berücksichtigung der Einschränkungen gegen den ausgesuchten Gruppenzweiten spielen darf. Wenn nicht, wird ein neuer Gruppenerster ausgesucht und überprüft, bis eine akzeptable Paarung gefunden worden ist.
Für die zweite (und dritte, vierte usw.) Begegnung wird derselbe Prozess durchgeführt, nur mit der zusätlichen Funktion, dass schon ausgesuchte Teams abgelehnt werden. In diesem Fall wird ein neues Team gezogen bis eins gefunden wird, das noch nicht genommen wurde.
Klingt alles okay, und es hat ein paar Mal geklappt, dass ich 8 zulässige Begegnungen bekam. Jedoch: manchmal kommt es zu einer solchen Auslosung:
Lyon - Chelsea
Marseille - Barcelona
AS Roma - Real Madrid
FC Kopenhagen - Schalke 04
Inter Mailand - Schachtar Donezk
AC Mailand - Bayern München
Arsenal -
Da hängt das Programm. Denn:
Nach den Regeln sind das alle an sich ganz akzeptable Spielpaarungen. Leider bleiben in diesem Falle nur englische Gruppenerste übrig (Man Utd und Tottenham Hotspur), weshalb kein Gegner für den FC Arsenal gefunden werden kann.
Da müsste man etwas Besseres ins Programm einbauen, um dies zu vermeiden. Es ist in der Tat (wenn ich mich nicht irre) nicht so einfach, wie ich dachte - dass man nicht einfach für jeden Verein einen passenden Gegner finden muss, sondern man muss gleichzeitig auf die übriggebliebenen Vereine aufpassen, dass aus denen noch zulässige Paarungen zu machen sind.
Ich habe dieses Problem noch nicht gelöst - ich war mit dem Schreiben des Massive Blogs beschäftigt - aber wenn ich's bis heute Abend hingekriegt habe, kriegen Sie dann das optimierte (funktionierende) Programm als 10. Adventsgeschenk.
Für Vorschläge zur Lösung des Problems bin ich natürlich offen.
Bis bald.
Hello.
Behind door number 9 I was looking to hide something really wonderful. You see, I wanted to write a computer programme which would simulate the draw for the first knock-out phase of this year's Champions League. But I've just written it and it has got a pretty heinous error, the description of which I am now going to give you on this 9th day of Advent (yes it's late) instead of the actual programme.
At the draw 16 teams are sorted into 8 matches.
The restrictions are:
1) no team is allowed to play against the other team from the same group-phase group. There are 8 groups each with 2 teams.
2) no team is allowed to play against a team from the same country.
3) group winners have to play group runners-up.
That's it. Home and away takes care of itself too, because group winners always play the second leg at home. It doesn't sound that complicated and it actually isn't. My programme "works" as follows.
The first runner-up is chosen at random and its opponent is then chosen at random from the group winners. It is then checked whether the group winner, according to the restrictions, is allowed to play against the runner-up selected. If not, a new group winner is chosen and checked, until an acceptable pairing has been found.
For the second (and third, fouth etc.) match-up the same process is carried out, just with the additional function, that teams which have already been selected are rejected. In this case, a new team is drawn until one is found which hasn't yet been chosen.
It all sounds okay and it did work a few times - so that I got 8 admissable match-ups. However: sometimes you get a draw like this:
Lyon - Chelsea
Marseille - Barcelona
Roma - Real Madrid
FC Copenhagen - Schalke 04
Inter Milan - Schakhtar Donetsk
AC Milan - Bayern Munich
Arsenal -
Then the programme freezes. Because:
According to the rules those are all in their own right acceptable match-ups. Unfortunately, you are left in this case with only English group-winners (Man Utd and Tottenham), for which reason no opponent can be found for Arsenal.
So something better has to be built into the programme to avoid this scenario. It is in fact (if I'm not mistaken) not as easy as I thought - that you can just look for a suitable opponent for each club. Instead you have to, at the same time, take care of who the left over clubs are, and that you can still build admissable pairings from them
I have not yet solved this problem - I've been busy writing the Massive Blog - but if I've solved it by this evening, then you can get the optimised (working) programme as the 10th Advent present.
I'm obviously open to suggestions as to how to solve the problem.
See you soon.
Showing posts with label Tom Huddlestone. Show all posts
Showing posts with label Tom Huddlestone. Show all posts
Friday, 10 December 2010
Sunday, 14 February 2010
Super Sunday - The corkscrew
English translation follows the German text.
Hallo. Heute ist etwas passiert, was die Welt und vor allem mein Leben da drin wirklich schöner gemacht hat. Ich beschreibe es mal. Es war nur eine ganz kleine Sache, aber eine große Freude hat sie schon ausgelöst. Also: ich war bei einem Kumpel zum Mittagessen verabredet und ich musste mit einer Bus/U-Bahn-Kombination dahin kommen. Ich brachte auch eine Flasche Wein mit, da ich seit einer Weile ihm gesagt hatte, dass ich ihm mal eine Flasche Wein mitbringen würde. Dieses Ziel verwirklichte ich also. Also war schon alles ziemlich jut, als ich losfuhr. Auf dem Weg (im Bus) ist mir dann eingefallen, dass er vielleicht keinen Korkenzieher haben würde, was der ganzen Weinmitbringerei etwas schade sein würde - er ist ziemlich neu in seine Wohnung eingezogen und Pfannen, Töpfe und Kartoffelschäler hat er, aber ich dachte, vielleicht hat er doch noch keinen Korkenzieher, denn er ist kein riesiger Weintrinker. Najut, auf jeden Fall habe ich diesen Gedanken gehabt und als ich dann an der Bushaltestelle ausstieg, die zugleich eine U-Bahnstation war, sah ich einen Flohmarkt. Ich versuchte ihn dann anzurufen, um zu erkündigen, ob er einen Korkenzieher habe, aber ich konnte ihn nicht erreichen. Also musste ich eine Entscheidung treffen: kaufen oder nicht kaufen. Ich habe dann einen gekauft, einen ziemlich schäbig aussehenden, den ich für 80 Cent (von einem Euro runtergefeilscht) bekommen habe. Den nahm ich dann mit in die U-Bahn und weiter zu meinem Gastgeber. Nachdem wir dann das Essen gekocht hatten und es zum Weinöffnungszeit kam, sah ich, wie mein Kumpel etwas zögerte, sagte ich ihm, dass ich einen Korkenzieher mit bei hatte und alles war super. Der ist auch trotz des billigen Aussehens des Plastikgriffs nicht kaputtgegangen und die Mahlzeit war gerettet. Hervorragend. Es hätte dabei viel schief laufen können - vielleicht hätte er schon einen Korkenzieher gehabt, vielleicht hätte ich 5 Mark für einen ausgegeben, vielleicht hätten wir den Wein doch gar nicht trinken wollen, vielleicht wäre der nutzlos oder gar kaputtgegangen, aber nein - gar nix ist schief gelaufen. Solche Aktionen machen mir das Leben schön - viel zu oft laufen Dinge gar nicht so glatt, aber Beispiele erwähne ich hier nicht, weil ich ja diesen durchaus Super Sonntag doch nicht verderben möchte.
Bis Morgen.
PS: Tom Huddlestone hat heute einen Elfmeter verschossen, was einem einige Zweifel an der Weltanschauung verursacht, aber dank der Korkenziehergeschichte werde ich wohl doch positiv bleiben können.
Good day. Today something happened which really made the world and above all my life more beautiful. I'll describe it for you. It was just a very small thing, but it still unleashed a great joy. Right: I had arranged to go to a mate's house for lunch and I had to use a bus-underground-combination to get there. I also took a bottle of wine with me, because I'd been promising for a while that I would at some point bring a bottle of wine with me. So I realised this aim and everything was already pretty good as I set off. On the way (on the bus) I then thought that maybe he wouldn't have a corkscrew, which would be a great shame for the whole wine-bringery - he has only quite recently moved into his new flat and he's got pans, both frying and sauce, as well as potato peelers, but I thought that he might nevertheless not yet have picked up a corkscrew, seeing as he's not a massive wine drinker. Anyway, I had this thought and then as I was getting out at the bus stop, which doubles as an underground station, I saw a flea market. I tried to give him a ring to find out whether he had a corkscrew, but I couldn't reach him. So I had to make a decision: to buy or not to buy. I went ahead and bought one, a pretty grotty looking one, which I got for 80 cents (haggled down from a euro). I took this with me into the underground and then on to my host's. After we'd cooked dinner and it came to the wine-opening time, I saw that my mate was hesitating and I said to him that I had a corkscrew with me and everything was awesome. It didn't even break, in spite of its cheap looking plastic handle,nand the meal was saved. Brilliant. There was so much that could have gone wrong - he could have already had a corkscrew, I might have ended up dropping a fiver on one, we might not have been bothered drinking the wine, the corkscrew might have been useless or even broken, but no - nothing went wrong at all. Such events really make my life good - far too often things don't come off nearly as smoothly, but I won't mention any examples here, because I don't want to put a downer on what has been a thoroughly Super Sunday.
See you tomorrow.
PS: Tom Huddlestone missed a penalty today which does make one doubt one's world view a little bit, but thanks to the corkscrew story I should be able to stay positive.
Hallo. Heute ist etwas passiert, was die Welt und vor allem mein Leben da drin wirklich schöner gemacht hat. Ich beschreibe es mal. Es war nur eine ganz kleine Sache, aber eine große Freude hat sie schon ausgelöst. Also: ich war bei einem Kumpel zum Mittagessen verabredet und ich musste mit einer Bus/U-Bahn-Kombination dahin kommen. Ich brachte auch eine Flasche Wein mit, da ich seit einer Weile ihm gesagt hatte, dass ich ihm mal eine Flasche Wein mitbringen würde. Dieses Ziel verwirklichte ich also. Also war schon alles ziemlich jut, als ich losfuhr. Auf dem Weg (im Bus) ist mir dann eingefallen, dass er vielleicht keinen Korkenzieher haben würde, was der ganzen Weinmitbringerei etwas schade sein würde - er ist ziemlich neu in seine Wohnung eingezogen und Pfannen, Töpfe und Kartoffelschäler hat er, aber ich dachte, vielleicht hat er doch noch keinen Korkenzieher, denn er ist kein riesiger Weintrinker. Najut, auf jeden Fall habe ich diesen Gedanken gehabt und als ich dann an der Bushaltestelle ausstieg, die zugleich eine U-Bahnstation war, sah ich einen Flohmarkt. Ich versuchte ihn dann anzurufen, um zu erkündigen, ob er einen Korkenzieher habe, aber ich konnte ihn nicht erreichen. Also musste ich eine Entscheidung treffen: kaufen oder nicht kaufen. Ich habe dann einen gekauft, einen ziemlich schäbig aussehenden, den ich für 80 Cent (von einem Euro runtergefeilscht) bekommen habe. Den nahm ich dann mit in die U-Bahn und weiter zu meinem Gastgeber. Nachdem wir dann das Essen gekocht hatten und es zum Weinöffnungszeit kam, sah ich, wie mein Kumpel etwas zögerte, sagte ich ihm, dass ich einen Korkenzieher mit bei hatte und alles war super. Der ist auch trotz des billigen Aussehens des Plastikgriffs nicht kaputtgegangen und die Mahlzeit war gerettet. Hervorragend. Es hätte dabei viel schief laufen können - vielleicht hätte er schon einen Korkenzieher gehabt, vielleicht hätte ich 5 Mark für einen ausgegeben, vielleicht hätten wir den Wein doch gar nicht trinken wollen, vielleicht wäre der nutzlos oder gar kaputtgegangen, aber nein - gar nix ist schief gelaufen. Solche Aktionen machen mir das Leben schön - viel zu oft laufen Dinge gar nicht so glatt, aber Beispiele erwähne ich hier nicht, weil ich ja diesen durchaus Super Sonntag doch nicht verderben möchte.
Bis Morgen.
PS: Tom Huddlestone hat heute einen Elfmeter verschossen, was einem einige Zweifel an der Weltanschauung verursacht, aber dank der Korkenziehergeschichte werde ich wohl doch positiv bleiben können.
Good day. Today something happened which really made the world and above all my life more beautiful. I'll describe it for you. It was just a very small thing, but it still unleashed a great joy. Right: I had arranged to go to a mate's house for lunch and I had to use a bus-underground-combination to get there. I also took a bottle of wine with me, because I'd been promising for a while that I would at some point bring a bottle of wine with me. So I realised this aim and everything was already pretty good as I set off. On the way (on the bus) I then thought that maybe he wouldn't have a corkscrew, which would be a great shame for the whole wine-bringery - he has only quite recently moved into his new flat and he's got pans, both frying and sauce, as well as potato peelers, but I thought that he might nevertheless not yet have picked up a corkscrew, seeing as he's not a massive wine drinker. Anyway, I had this thought and then as I was getting out at the bus stop, which doubles as an underground station, I saw a flea market. I tried to give him a ring to find out whether he had a corkscrew, but I couldn't reach him. So I had to make a decision: to buy or not to buy. I went ahead and bought one, a pretty grotty looking one, which I got for 80 cents (haggled down from a euro). I took this with me into the underground and then on to my host's. After we'd cooked dinner and it came to the wine-opening time, I saw that my mate was hesitating and I said to him that I had a corkscrew with me and everything was awesome. It didn't even break, in spite of its cheap looking plastic handle,nand the meal was saved. Brilliant. There was so much that could have gone wrong - he could have already had a corkscrew, I might have ended up dropping a fiver on one, we might not have been bothered drinking the wine, the corkscrew might have been useless or even broken, but no - nothing went wrong at all. Such events really make my life good - far too often things don't come off nearly as smoothly, but I won't mention any examples here, because I don't want to put a downer on what has been a thoroughly Super Sunday.
See you tomorrow.
PS: Tom Huddlestone missed a penalty today which does make one doubt one's world view a little bit, but thanks to the corkscrew story I should be able to stay positive.
Monday, 1 February 2010
My Grammy Awards
English Translation follows the German text.
Hallo. Heute (oder gestern?) wurden die Grammy Awards verliehen. Ich habe nicht so viel Lust gehabt, genau nachzugucken, wer wat gewonnen hat, aber ich weiß, dass Beyonce ziemlich viele mit nach Hause nehmen durfte, und auch irgendne Frau, die ich nicht kenne. Also Gratulationen an die beiden Damen, und hier meine "Grammy" Awards, wie ich die getauft habe. Die beziehen sich nicht ausschließlich aufs letzte Jahr, sondern auf die letzte ungefähre Zeit, die mir gerade einfällt. So.
Best Pop: Nicht Katy Perry
Best Rock: Ähm...
Best Hip Hop: N-Dubz, Number One.
Worst Live Performance: N-Dubz, You should have put something on bei Jonathan Ross.
Best TV: Royle Family Christmas Special 2008
Best Film-Quote: Say Auf Wiedersehen to your Nazi Balls - Inglourious Basterds.
Best Film: Keine Ahnung, wann ich letztes Mal im Kino war..hab Brüno neulich im Netz geguckt, war aber nicht so toll - also sagen wir halt Avatar.
Best Band: die deutsche irische Band in Berlin, die ich mal im April sah - weiß nicht mehr wie die heißen - Palface oder sowas. Nee quatsch, Larkin heißen die.
Best Male: David Beckham
Best Female: Lady Gaga
Lifetime Achievement Award: Tom Huddlestone (dafür, dass er so athletisch gebaut ist)
Should be disappointed with his life Award: Tom Hanks
Song of the Year: Kiss me thru the phone, von Soulja Boy (glaube ich)
Sporting Performance of the Year: Der Ägypter, der Torschützenkönig beim Afrika-Cup war, ohne ein einziges Mal in der Startelf zu stehen. 5 Joker-Tore. Respekt.
So das war's. Wie immer könnte ihr in den Comments das bestreiten, was ihr nicht ganz 100% richtig findet. Ist aber wenig Kontroverses da.
Bis morgen. Also und "Telephone" NICHT "Videophone" von Lady Gaga und Beyonce ist auch voll gut.
Hello. Today (or yesterday?) the Grammy Awards were given out. I couldn't really be bothered looking exactly who won what, but I heard Beyonce took quite a lot of awards home with her, and some other woman that I've not heard of too. So Congratulations to both those ladies and here are my "Grammy" Awards, as I've called them. They don't relate exclusively to the last year, but more to the last vague space of time that I can think of. Here goes:
Best Pop: Not Katy Perry
Best Rock: Ähm...
Best Hip Hop: N-Dubz, Number One.
Worst Live Performance: N-Dubz, "You should have put something on" on Jonathan Ross.
Best TV: Royle Family Christmas Special 2008
Best Film-Quote: Say Auf Wiedersehen to your Nazi Balls - Inglourious Basterds.
Best Film: No idea, when the last time was I went to the cinema. Saw Brüno recently on the internet, wasn't that great though, so we'd better just say Avatar.
Best Band: The German Irish band from Berlin that I saw back in April - can't remember anymore what they're called - Palface or something. No nonsense, Larkin they're called.
Best Male: David Beckham
Best Female: Lady Gaga
Lifetime Achievement Award: Tom Huddlestone (for being a unit)
Should be disappointed with his life Award: Tom Hanks
Song of the Year: Kiss me thru the phone, von Soulja Boy (I think)
Sporting Performance of the Year: The Egyptian who got the golden boot at the African Cup of Nations without starting a single game. 5 goals coming of the bench. Awesome.
Right that's it. As always you can argue in the comments with whatever you're not 100% happy with. Isn't much controversial stuff there though.
See you tomorrow. Oh right and "Telephone" NOT "Videophone" by Lady Gaga and Beyonce is awesome as well.
Hallo. Heute (oder gestern?) wurden die Grammy Awards verliehen. Ich habe nicht so viel Lust gehabt, genau nachzugucken, wer wat gewonnen hat, aber ich weiß, dass Beyonce ziemlich viele mit nach Hause nehmen durfte, und auch irgendne Frau, die ich nicht kenne. Also Gratulationen an die beiden Damen, und hier meine "Grammy" Awards, wie ich die getauft habe. Die beziehen sich nicht ausschließlich aufs letzte Jahr, sondern auf die letzte ungefähre Zeit, die mir gerade einfällt. So.
Best Pop: Nicht Katy Perry
Best Rock: Ähm...
Best Hip Hop: N-Dubz, Number One.
Worst Live Performance: N-Dubz, You should have put something on bei Jonathan Ross.
Best TV: Royle Family Christmas Special 2008
Best Film-Quote: Say Auf Wiedersehen to your Nazi Balls - Inglourious Basterds.
Best Film: Keine Ahnung, wann ich letztes Mal im Kino war..hab Brüno neulich im Netz geguckt, war aber nicht so toll - also sagen wir halt Avatar.
Best Band: die deutsche irische Band in Berlin, die ich mal im April sah - weiß nicht mehr wie die heißen - Palface oder sowas. Nee quatsch, Larkin heißen die.
Best Male: David Beckham
Best Female: Lady Gaga
Lifetime Achievement Award: Tom Huddlestone (dafür, dass er so athletisch gebaut ist)
Should be disappointed with his life Award: Tom Hanks
Song of the Year: Kiss me thru the phone, von Soulja Boy (glaube ich)
Sporting Performance of the Year: Der Ägypter, der Torschützenkönig beim Afrika-Cup war, ohne ein einziges Mal in der Startelf zu stehen. 5 Joker-Tore. Respekt.
So das war's. Wie immer könnte ihr in den Comments das bestreiten, was ihr nicht ganz 100% richtig findet. Ist aber wenig Kontroverses da.
Bis morgen. Also und "Telephone" NICHT "Videophone" von Lady Gaga und Beyonce ist auch voll gut.
Hello. Today (or yesterday?) the Grammy Awards were given out. I couldn't really be bothered looking exactly who won what, but I heard Beyonce took quite a lot of awards home with her, and some other woman that I've not heard of too. So Congratulations to both those ladies and here are my "Grammy" Awards, as I've called them. They don't relate exclusively to the last year, but more to the last vague space of time that I can think of. Here goes:
Best Pop: Not Katy Perry
Best Rock: Ähm...
Best Hip Hop: N-Dubz, Number One.
Worst Live Performance: N-Dubz, "You should have put something on" on Jonathan Ross.
Best TV: Royle Family Christmas Special 2008
Best Film-Quote: Say Auf Wiedersehen to your Nazi Balls - Inglourious Basterds.
Best Film: No idea, when the last time was I went to the cinema. Saw Brüno recently on the internet, wasn't that great though, so we'd better just say Avatar.
Best Band: The German Irish band from Berlin that I saw back in April - can't remember anymore what they're called - Palface or something. No nonsense, Larkin they're called.
Best Male: David Beckham
Best Female: Lady Gaga
Lifetime Achievement Award: Tom Huddlestone (for being a unit)
Should be disappointed with his life Award: Tom Hanks
Song of the Year: Kiss me thru the phone, von Soulja Boy (I think)
Sporting Performance of the Year: The Egyptian who got the golden boot at the African Cup of Nations without starting a single game. 5 goals coming of the bench. Awesome.
Right that's it. As always you can argue in the comments with whatever you're not 100% happy with. Isn't much controversial stuff there though.
See you tomorrow. Oh right and "Telephone" NOT "Videophone" by Lady Gaga and Beyonce is awesome as well.
Labels:
African Cup of Nations,
Avatar,
Beyonce,
Brüno,
David Beckham,
Inglourious Basterds,
Jonathan Ross,
Katy Perry,
Lady Gaga,
Larkin,
N Dubz,
Soulja Boy,
The Royle Family,
Tom Huddlestone
Subscribe to:
Posts (Atom)