Pekk’s Plue Game Program! Pekk is a HUNGRY Plue!

August 9th, 2007 Pekk

While drawing wasn’t the only thing I did today during Qt4’s incredibly long compile session, I also created this funny little program. It’s called the Plue Game.

I found it in the back of my Rave Master manga. The basic rules are the game are as follows:

  1. Write your full name on a piece of paper.
  2. Convert the letters of your name into numbers, A=1, b=2, and so on.
  3. Add up all the numbers in your full name and take the right-most (ones’ place) digit. This is your “Plue Magic Number” as I call it, this number is used to look up in a table what type of Plue you are (since it’s quite a bit of text I won’t post all of the results up here, you are free to download and compile the program if you wish, or even just read the code to find out what each number means).

For whatever reason, I thought it would be faster to just write a program to do this for me so I didn’t have to do the addition myself. In any case I was horribly wrong, especially since I decided to write the program in C.

I’ll post the file at the bottom of this post, but for now I just want to share some important notes (things I discovered, things I’d forgotten about) pertaining to C.

  1. Never ever use gets() or some asshole will call you out on it. (Actually I was already well aware of this, I just wanted to point out how some people have nothing better to do than try to prove they are better than everyone else. Don’t be this guy! Play nice! I don’t want to read your drama when I’m trying to find a function name!!).
  2. For strings with spaces (the google search that brought me to the above forum posting) use fgets(). Check the manpages for more details; use stdin as a substitute for the file stream, it will work just fine, but it will append the trailing endline characters!!! (I actually just left them in there and worked around it like that, since this is just small program anyway).
  3. To get a character input you can use getchar(). Also it seems as though this is the only way to do the “Press any key to continue” (without the “any key” part) type of pause on all platforms. (Windows users you can use a system(”pause”) call, but this obviously won’t work for unixes). If you’re just waiting for the enter key stroke so you can clear the screen, it’s not necessary to assign the return value of getchar() to a variable.
  4. C is fun!! I should use this more often! ;D

That’s about it so here’s the source code, released under the GPL (I’m not sure this is entirely necessary for such a small program, but that’s okay.)

REMEMBER: I DID NOT MAKE THIS GAME, I ONLY CREATED THE PROGRAM. I TAKE CREDIT FOR NOTHING OTHER THAN DIGITIZING A GAME THAT ALREADY EXISTS.

Happy Plue gaming!

Download The Plue Game!

Posted in Anime/Manga, C Programming, Programming | No Comments »