Interesting C program and Linux kernel source safe after all.

Posted: September 2, 2011. At: 11:57 PM. This was 6 years ago. Post ID: 1909
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

This is a little program I wrote in C that picks a random monster to attack the player. I think I already have this posted somewhere, but I thought I would post this once again as someone might be interested in this again. Programming in C instead of more modern programming languages like C++ is heaps of fun, the Linux kernel is written in C and it works just fine, the server hosting this fine website is running on a Linux box in a swamp guarded by an Alligator named Snappy. And he does the job of good hosting management just fine.

/* Emacs style mode select: -*- linux-c-mode -*-
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int cool(void) {
  int i;
  int k;
  i = 15;
  k = 0;
  k = rand() % i;
  return k;
const char* x[] = {
  "Baron of Hell", "Demon", "Hellknight",
  "Cyberdemon", "Mancubus", "Revenant",
  "Heretic Imp", "Zombieman", "Sergeant",
  "Beholder", "Moloch", "Satyr",
  "Afrit", "Ettin", "Maulator",
int main() {
  char *player;
  player = getenv("LOGNAME");
  printf("%s was slaughtered by a %s.\n",player , x[cool()]);
  return 0;

Recently I got a 1680×1050 flat panel display to replace my 17″ CRT and it is connected via the HDMI output instead of the older VGA output. I temporarily had it connected as well as the CRT and experimented with dual monitors with Gnome 2. The monitors setup in the Gnome settings menu allowed me to select it as a second monitor and drag windows from one desktop to another, this was very easy to setup; easier than what I have heard from users trying to set this sort of thing up on Ubuntu 11.04, they had a lot of problems, this is very bad when on Debian Stable you can just use a couple of mouse clicks and the dual monitors are working perfectly right away. This makes me wonder if Ubuntu is really moving forward or taking us backwards. I only have the flat screen right now, it was easy to adapt to this after using a CRT for so long. Once you have used a CRT for a long time and then switch to a LCD panel, it looks concave, but this goes away quickly. After the servers were cracked into there has been some scaremongering about the source being tainted, but there are many reasons why this would be quite difficult. more information here:

No comments have been made. Use this form to start the conversation :)

Leave a Reply