Smart gameAugust 9th, 2010
Yesterday, while waiting in a traffic jam, I implemented a small game. I read about this game in a book and to not get too annoyed about the waiting time I opened the lid of my laptop and wrote this game. This morning I completed it with some usual stuff to increase the usability..
It’s written in C++ and you can play against the CPU. There is a strategy that makes you win in almost every case! This game is a classic in game theory, but if I provide you with it’s original name it’ll too easy for you to solve the problem with help from Wikipedia or something like that. So just try it on you own ;)
The aim of the game is to clear all the stacks that are filled with
o ‘s. The stacks may look like this:
Now it is your turn to choose one of these stacks and remove some or all
o’s of it. Notice that you have to remove at least one of them and you can only remove
o’s from one single stack!
After your turn, the artificial intelligence will do the same. Afterwards it’s again your turn, until all stacks are cleared. Winner is the one who cleared the last stack, so try to get the last
Here is the download.
You can choose the number of stacks and the maximum number of
o’s a stack can carry:
If anybody knows the strategy, feel free to tell me!
MTP and some workaroundsJuly 27th, 2010
Actually I revived my Creative Zen and had some trouble with that crazy media stuff..
Ok, every body who knows me knows that I hate that media fuss, to many functions that nobody needs, and to many failures on important stuff. How to mount an MTP-fs I explained in a previous posting, here it is in a nutshell:
With mtpfs version 0.9 and libmtp8 from sid I just experienced segfaults reported by dmesg, but the versions from squeeze just work fine. Of course it is interesting that I’m not able to overwrite existing files:
Curious, but the workaround should be clear ;)
Last but not least I can show you how to play a YouTube video on this device. The easiest way is to install the Firefox extension downloadhelper, so you can download the song as a
.flv file. The usual player don’t know what to do with
.flv , and of course mine doesn’t, so convert it with mencoder. Here is an example:
The audio file doesn’t have meta data yet, so my Zen can’t find a name for it (don’t know why they didn’t implement a fallback to name it by it’s filename). To edit the meta tags you can use common tools like amarok or XMMS, I used easytag.
So you see, with a little work everything will be fine!
Google-alarmJuly 27th, 2010
Just found it on F.A.T., a Firefox plugin called google-alarm! Look at this tool and recognize how much information you expose by simple surfing.
To make it work on my Iceweasel 3.5.11 I had to change the
em:minVersion in the
install.rdf of the
.xpi archive. It’s just for noticing, I don’t provide this changed version because you should not download such things from sites like mine ;)
You should also take a look at F.A.T., they often have smart projects!
Welcome to twitterJuly 20th, 2010
When I signed in this morning Micha greets me with his status of eliminating the first pot of coffee. Very interesting… So we decided to start twittering ;)
I already registered an account about ten months ago, just to see how it works, but now I’ll try to show some activity and tweet a lot of boring things..
First of all I developed a little script that tweets my messaged via curl:
Just call it with your message, it will ask for a passphrase to your account.. Just download it and use it like
./tweet.sh yeah it works .
And of course I’ve written a script that dumps all news to my console. To parse the XML I’m using Perl:
A little bit more code, but easy to use! Just download and run it with
./twitstat.pl [MAX_NUMBER_OF_TWEETS] . (You may need some additional Perl libs)
So let’s see how long I keep going on.. You can follow me at http://twitter.com/binfalse
Mensa planJuly 15th, 2010
I often check what our canteen offer for lunch before we leave our building. The website that presents this portfolio is one of the worst I’ve ever seen and meanwhile I noticed that my private walking Mensa planer has still some bugs, so I had to think about an alternative solution and developed a little Perl script…
My initial idea was to read the website, parse the XML code and print the meals. Not a bit of it! The code of this site is nothing like valid! They invent new tags I’ve never heard about, they close nowhere opened paragraphs or table cells, I do not find the html-closing tag (the document ends with closing it’s body) and so on… It’s to much to mention all it’s unique features, but let me blame the producer: Peinhardt IT Systeme. Seems to be professionals… (A notice has left my mailbox, looking forward to their answer)
How ever, XML parsing fails, solving the bugs also fails, to much of it… So I’m now just grabbing the HTML-code, to extract the interesting content, with a more or less ugly regex, and print them to console… Here is the code:
So if somebody is also joining the Mensa Weinberg, you can copy this code or download it.
The other canteens are also available, just change the value of the variable
$mensa to your preferred one. The numbers can be found in the source code of this stupid website. Ok, to save you from trouble here are the numbers:
- Cafeteria Brandbergweg
- Cafeteria Burg
- Mensa Bernburg
- Mensa Dessau
- Mensa Franckesche Stiftungen
- Mensa Harz
- Mensa Köthen
- Mensa Neuwerk
- Mensa Tulpe
- Mensa Weinberg
Well, that’s it! Now you can decide within seconds whether it’s worthy to go to lunch or better stay hungry ;)