This page presents some little funny projects to code, for the bored ones. They constitute some sort of brainteasers for geeks. Who said procrastination ??

Locally detailed projects

There is not that much projects here for now, but I plan to enrich my collection with the time. If you have questions or propositions, please contact me.

Source of inspiration to code a game

Since several years, the students taking my first year course in C language are requested to code a little game of their choice. That's a rather unusual assignment ("now I demand you to do what you want!"), and this page is here to (1) explain my motivation for doing so (2) give some inspiration about some great games that you may want to implement in this context (3) give some technical hints about how to build a game (4) hints about how to have acceptable graphics in your game (although it's not the goal of my assignment), and some other information.

There is several ideas behind this assignment. First of all, coding a game is always more fun than coding, say a matrix inversion program or a Fourier transformation (at least for me). And since that's the first real program that my students have to code, the little motivation boost due to the gaming side is welcomed to overcome their fears. Also, that's part of a DIY approach were I want to show that coding a game is no black magic, and that even if you are a beginner in programming, you already know enough to do it. But the main issue they have is to find a "good" game to code. I advise you to reimplement some existing game to keep the focus on the programming side without getting lost in game design issues, but some of you seem to lack some basic gamez culture... Incredible but true. This section thus aim at providing some useful links in this process (people not taking my class are also welcomed to use these links and DIY your own game of course ;)

Of course, the main source of inspiration is the flash gamer scene, with all the creativity they deploy for /casual gaming/ ie, the little game you play after lunch and before going back to work. They invented several game types, such as tower defense for example. There is a plenty of sites offering these games, such as or My prefered is certainly which presents many indie games. They are probably a good source of inspiration for you. You may also want to have a look at, which is a bit specific. That's a collection of very old games reimplemented in flash. I like this site very much becaues it proves me that I'm now a dinosaur: I actually played these games when I was kid (and I even had fun doing so)!.. That being said, I don't think that these games are actually worth being reimplemented because of the absolute simplicity of their game mecanic.

If you are looking for a real game to implement (not a casual game), you should look for an old one. Modern creations such as WoW or StarCraft are of course ways beyond what's doable without big teams. There is several abandonware sites that list games which were discontinued by their creators, such as The Wikipedia page is also interesting and contains some further links on this.

Game programming contests are a great place to find a little gamming ideas. For example, is a furious competition where you have to come up with a game implemented in Java, with the crazy restriction that the final jar file must be smaller than 4096 bytes. That's a really amazing competition because this restriction induce specific tricks to compress the jar file, forbids the use of more than one object in the code, etc. But the results are very interesting. I for example love Miners4k game, and the Bridge4k is a classical concept rendered brightly. As usual, the Wikipedia page is very interesting and explain both some tricks to manage to do a 4K game, why the contest is interesting and some preeminent projects. is another game programming contests, with slightly different rules: there is no technical limitation, but each contest consists in a sprint: you have a limited amount of time (like a week-end), and an imposed theme, which is given when the contest begins. It leads to interesting results, too, but because of the time limitation, the amount of finished games amongst the opponents is much lower that for Java4K, for example. The TINS contest is similar, but with an additional limitation that you should use the allegro library.

In particular, here are some little games I like. Feel free to submit links if you have good ones.

Another great source of inspiration comes from the board games, of course. Beware however that adapting a great board game to the computer is not always trivial, as the gameplay on computer is very different to what it is on board. A good compendium of board games is while some abstract games can be found at (both links in french only, sorry). There is even a research group in Berkeley dedicated to the analysis of board games:

The FANG library may also reveal interesting. That's a Java library aiming at easing the design of simple games, in the intend of teaching programming through games. The proposed games are a bit simple maybe, but the approach is definitely worth noting here.

Then, once you have the idea of the game you want to code, you need to understand the basics of game loops. A colleague of mine has a great source of information on that topic. That's mainly in French, but he also provides some english links too. You also need to read on that topic.

As Thomas says, a game is not only about technology (far from that). You also have to find good graphics to support your game. Note that I don't expect my student to have great graphics and that in my case, that's a /programming/ assignment. But having decent graphics cannot hurt either.

One solution is to gimp/photoshop it yourself, but the result is likely to be not as attractive as you'd like to (if you're as bad as me at it), or illegal (if you reuse the graphics of the original game that are probably copyrighted). Or, alternatively, you may spend so much time on it that you run out of time for the actual programming of your game logic. A much better solution is to find some really free (as in free speech) graphics on the net. "Creative" is the keyword that you want to add to your query since such work are very often released under the Creative Commons license. Alternatively, you can turn to existing repositories of such material, such as or I particularly like the Reiner's Tilsets, linked from the previous page.

But, copying a game is maybe not fun enough for you. If you want to invent your own game, you need to think about the game mechanic that base your creation. For that, is an incredible resource. That's the blog of a brilliant game designer since years, and it's full of interesting hints, game ideas and even free game graphics. This is a must read.

Finally, instead of reinventing your own game, you may want to get involved in one of the existing free games out there. That may be a bit harder than creating your own game, but it's definitly more rewarding. One major difficulty may be to find a welcoming community of game programmers. Give a try to widelands (RTS game), Flare (dungon crawler), Frogatto (platformer) and its anura engine, Solarus (written by an ex-student of Telecom Nancy), or even the little Xbubble. Contact me if you want, I could somehow sherpard you in these projects. There are many other great free games that you can consider (eg Wesnoth, 0AD or FreeMiner), but I know don't know their backing communities.

External Sources of Procrastination

  • Light Bot and Light Bot 2 are two flash games for programmers. I like it a lot, even if the first one is a bit short and the second one is a bit hard.
  • Robozzle is similar to Light Bot yet different. If you liked one, you'll like the other one. It's kinda playable in javascript although I've been told that the SilverLight version is much more usable.
  • There is also some funny and challenging exercises in the PLM. In particular, check the maze and lightbot lessons.
  • Online exercisers: these sites list a whole load of algorithmic problems. Pick a problem, solve it, submit your solution, and the robot will evaluate the correction of your program instantly. Unfortunately, the problem lists are long and uneven. I must be prefectionits, but I'd prefer some more editorial work from their maintainers.
  • Programming Contests: There is several sites that organize some sort of programming contests. In general, they are intended to select the best programmer from the participant, and are thus quite difficult to achieve. Another result of this premise is that no or little help is given to improve your solution if you fail. I must confess that I didn't really tryied them out, but you may like them.
    • GoogleJam is an annual coding contest.
    • TopCoder is another similar system, but more restrictive on the languages you may use (only Java, C++ or C#).
    • ICFP contest is certainly the king of all programming contests. It is also rather difficult, definitely far from the "gentle coding brainteasers" category listed below ;)
  • If you liked these links, you probably should stop by interstices, too. I'm not quite sure, this one may be in French only (I get it in French, but that's a fancy website, it may well be translated and adapt to its visitors).

TODO: Translate in english

Le radoteur (machine à inventer des mots)

[Le "radoteur" a été imaginé par Claude Shannon puis exploré et baptisé (en 1975) par Roland Moreno (lire Théorie du bordel ambiant, chapitre 6, Belfond, 1990)].

Le radoteur fabrique des mots nouveaux à partir d'une liste de mots. Il découpe des groupes de lettres dans les mots de la liste et les colle bout-à-bout. Il assemble par exemple le début d'un mot avec la fin d'un autre. Il n'y a aucune "invention". Le résultat a toujours un air de famille avec les mots de départ... tout en étant différent. Par exemple, lorsqu'on lui donne une liste de pays, il en fabrique de nouveaux : palombie syldavie bordurie kafiristan lizbékistan...


  1. Choisir une lettre au hasard dans la liste de mot et l'écrire dans le mot en construction.

  2. Chercher la prochaine occurence de cette lettre dans la liste de mot.

  3. Considérons la lettre juste après celle cherchée. On l'ajoute au mot en construction, et cela devient le nouveau motif à chercher en retournant à l'étape 2. On s'arrête quand on a trouvé un espace.

Voilà, c'est tout. Donc, pour le coder, il faut savoir allouer un tableau de chaînes, puis chacune des chaînes. Ensuite, il faut ouvrir le fichier passé en argument et lire chaque ligne avec getline(3), par exemple. A partir de là, le reste est enfantin.

Listes de mots

Voici quelques exemples. Si vous avez d'autres listes ou si vous avez des exemples de listes manquantes, envoyez les moi s'il vous plaît.

Liste de pays ; animaux ; fleurs ; plantes ; médicaments ; injures ; prénoms... On peut bien évidement mélanger différentes listes (fleurs et injures ?).


La première est assez simple et la seconde ajoute vraiment ajoute du piquant, alors n'hésitez pas.

Faire varier la similitude

Au lieu d'utiliser un motif de taille 1 (ie, chercher une lettre seule), on peut chercher plusieurs lettres à la fois. Ce nombre de lettres est le paramètre Avant. De même, au lieu de prendre une seule lettre après, on peut en prendre plusieurs (paramètre Après). Quand ces paramètres augmentent, la similitude des mots crées avec ceux de la liste donnée augmente. Expérimentalement, Avant=Après=2 donne de bons résultats.

Note: il y a des algorithmes très bien pour la recherche de motif. Si vous ne savez pas faire, utilisez strstr(3).

Créer des phrases entières et d'autres choses

On peut jouer sur des proverbes (Après la pluie, rien d'impossible ; L'union vient en mangeant ; veni, vedi, j'y reste) ou des petites annonces (Etudiant ch. dame sensible avec remorque). Moreno propose même de créer de la musique de la sorte en mélangeant du Bach et du Brel. Une autre idée est de travailler avec l'alphabet phonétique au lieu d'utiliser les lettres habituelles. Si quelqu'un me propose une implémentation, je suis naturellement preneur...

Nombres auto-digitaux

(idée honteusement volée dans "le virus informatique", mais en même temps, il serait dommage de laisser cette idée tomber dans les limbes de l'oubli sous prétexte que ce bon journal n'existe plus).

On dira d'un nombre qu'il est autodigital parfait s'il peut être calculé en utilisant tous les chiffres qui le compose dans leur ordre d'apparition (de gauche à droite). Si l'ordre d'apparition n'est pas respecté, on le dira imparfait. Un exemple valant mieux qu'un long discours :

  • 36 = 3! * 6
  • 127 = -1 + 27
  • 660 = 6! - 60

Ces trois nombres sont des autodigitaux parfaits. Le dernier nombre met en évidence qu'on accepte aussi, arbitrairement, d'utiliser des groupes de chiffres. Attention, on n'accepte pas d'utiliser le groupe formé de tous les chiffres, i.e. le nombre recherché lui-même, car cela manquerait un peu d'intérêt de constater que, par exemple, 660 = 660, non ? Le deuxième exemple montre que l'opérateur de soustraction peut-être utilisé comme opérateur unaire (s'appliquant à une seule opérande), ce qui revient à dire qu'on accepte les nombres négatifs. Dans le cadre de ce problème, on se limitera aux opérateurs suivant (que l'on pourra combiner autant que nécessaire) :

  • les quatres opérations de base : +, -, /, * (on accepte le "-" comme opérateur et comme signe)
  • l'élévation à la puissance : ^
  • la factorielle : ! [qui se définit par 0! = 1 ; 1! = 1 ; n! = 1 * 2 * ... * n (pour n > 1)
  • la racine carrée
  • les parenthèses : ( )

La question est bien évidement de trouver tous les nombres autodigitaux parfaits ou non entre 0 et ... ben, jusqu'où vous pouvez. Personellement, j'ai aussi fait quelques recherches...

tranche # parfaits # imparfaits
0-999 39 29
1000-199936 127

Si vous vous ennuyez, vous pouvez ajouter d'autres opérations, telles que la sommielle (pendant de la factorielle pour l'addition), ou le changement de base.

Indice: Pour faire ce projet en C, manipuler des pointeurs sur fonction peut aider. D'autres langages (comme CAML) me semblent plus simple, mais ça peut être personnel.

Ce problème a été assez intensivement étudié par un mathématicien américan nommé Erich Friedman. À la lecture de sa page web, j'aime bien cette personne et je vous conseille d'aller lui rendre visite. Sa collection de puzzles est très intéressante pour qui veut faire de petits défis de programmation.