#include #include #include #include #include #define A_BOLD "\x1b[1m" #define A_NORM "\x1b[0m" #define little_pause fflush(stdout); sleep(1); #define NUM_Q 40 #define MAX_Q 67 struct q { char *question; int yes, no, maybe; }; char answered[MAX_Q]; char *ratio_names[11] = { "lower form of life", /* 00 - 09 % */ "idiot", /* 10 - 19 % */ "plain stupid person", /* 20 - 29 % */ "loser", /* 30 - 39 % */ "newbie", /* 40 - 49 % */ "wannabee", /* 50 - 59 % */ "promising wannabe", /* 60 - 69 % */ "hacker", /* 70 - 79 % */ "true hacker", /* 80 - 89 % */ "wizard", /* 90 - 99 % */ "potential demigod", /* 100 % */ }; struct q question[MAX_Q] = { /* programming */ { "Can you program", 3, -5, -3 }, { "Can you program quickly", 4, -3, 0 }, { "Do you like using (any kind of) Basic or Pascal", -5, 3, -3 }, { "Do you know C, C++, Java, Smalltalk or Lisp", 2, -2, 0 }, { "Do you like C, C++, Java, Smalltalk or Lisp", 3, -3, 0 }, { "Do you know any two of C, Java or Lisp", 5, 0, 1 }, { "Do you know more than three programming languages", 5, 0, 2 }, { "Do you think pseudo-code and/or flowcharts are usable", -5, 3, -3 }, { "Do you like programming", 2, -2, -1 }, { "Are you obsessed with programming", 4, -1, 1 }, { "Have you ever programmed more than 12 hours in one day", 5, 0, 2 }, { "Have you ever made a program that was widely used", 4, 0, 2 }, { "Have you ever made a program that does/displays something funny/nice\nbut is othervise completely useless", 5, 0, 1 }, /* OS-es */ { "Do you like MS-DOS(tm)(r)(c) and/or MS Windows(tm)(r)(c)", -5, 1, -3 }, { "Do you like Unix", 4, -3, 1 }, { "Have you ever written command on command prompt that was more than one\nline long", 4, -2, 2 }, { "Do you think command prompt is over-cryptic and unusable", -4, 1, -2 }, { "Do you like point-and-click-only user interfaces", -4, 1, -1 }, { "Have you ever written device driver or something similar", 5, 0, 0 }, { "Have you ever worked on VMS or ITS and liked it", 2, 0, 0 }, { "Have you ever worked on VMS, ITS or several flavors of Unix", 3, -5, 0 }, { "Have you written your own OS", 3, 0, -2 }, { "Does your home box(en) have a _real_ OS (i.e. not Windoze)", 3, -3, -2 }, { "Are you expert at some program/operating system", 5, 0, 2 }, { "Do you enjoy exploring programmable systems and streching their\ncapabilities", 5, -3, 1 }, /* information wants to be free! */ { "Do you believe in information-sharing", 3, -3, 0 }, { "Do you believe it's your duty to share your information, knowledge,\nexpertise and/or computing resources to everyone", 4, -1, 2 }, /* humor */ { "Would you laugh if you saw Volkswagen Beetle with vanity license plate\nwhich reads `FEATURE'", 3, 0, 1 }, { "Would you laugh if you saw red index card with `GREEN'\nwritten on it", 3, 0, 1 }, { "Are you fascinated with paradoxes and form vs. content jokes", 3, 0, 1 }, { "Do you like parodies of various intellectual constructs", 3, 0, 1 }, { "Have you ever made intellectual parody of some sort", 4, 0, 2 }, { "Do you like wordplays", 3, 0, 1 }, { "Do you like jokes that involve logical reasoning from\nludicrous premises", 3, 0, 1 }, { "Do you like Zen or Tao", 3, 0, 1 }, { "Do you like Zen koans", 3, 0, 1 }, /* cracker tripwire */ { "Are you a cracker", -5, 0, -2 }, { "Do you like cracking root", -15, 0, -5 }, { "Have you ever crashed a system on purpose", -15, 0, -5 }, { "If you crack a system, would you inform the owner about it", 5, -5, 0 }, { "Do you often use other people's exploits", -10, 0, -5 }, /* misc */ { "Has any computer-literate person called you a hacker", 3, 0, 2 }, { "Do you like wearing business suits", -5, 5, 0 }, { "Do you like to read (something that's not technical manual)", 4, 0, 2 }, { "Do you like S.F. or fantasy", 4, 0, 2 }, { "Do you like logic puzzles", 3, 0, 1 }, { "Are you interested in midievalisam", 1, 0, 1 }, { "Do you like sport", -2, 0, 0 }, { "Do you like watching sport on TV", -2, 2, 0 }, { "Do you like team sports", -2, 0, 0 }, { "Do you like Smurfs, Ewoks, teddy-bears, ...", -2, 0, -1 }, { "Do you like bureaucracies", -5, 5, 0 }, { "Do you watch TV a lot", -5, 0, -2 }, { "Do you like stupid people (huh...what a question)", 0, 0, 0 }, { "Are you a very religious person", -3, 0, -1 }, { "Do you use drugs", -5, 0, -3 }, { "Do you use caffeine (cofee, cola) often", 4, 0, 2 }, { "Do you use computers (and enjoy it) more than 4 hours per day, 7 days\nper week, 4 weeks per month", 4, 0, 2 }, { "Is all-night hacking common to you", 5, 0, 3 }, { "Do you have very high speaching skills", -1, 3, 0 }, { "Do you have good/nice/beautiful handwriting", -1, 3, 0 }, { "Are you curious", 5, 0, 2 }, { "Do you think it is perfectly acceptable to lie", -10, 0, -3 }, { "Do you communicate well with other people", -1, 1, 0 }, { "Do you have trouble identifying emotionally with other people", 2, 0, 1 }, { "Could you read 300 page book in one day and actually remember\nmost of it", 5, 0, 2 }, { "Do you thinkg there are too many stupid people on this world", 2, 0, 1 }, }; long score = 0UL, max_score = 0UL; void intro(void) { char tmp[256]; printf("So...you wanna know if you're a " A_BOLD "hacker" A_NORM ", huh?\n"); little_pause; printf("Well, if you have to ask, you'll never know...but I'm here to give you a\nhint. "); printf("If we lived in a simple universe and if hacking was easy to explain,\n"); printf("this test would give you the definitive answer. In Real World, however,\n"); printf("things aren't so simple, so this test gives you only probability of you\n"); printf("being one.\n"); printf("This test is based on the entries about hackers in The Jargon File, and\n"); printf("was compiled by Senko Rasic .\n\n"); little_pause; printf("You will be asked %d questions. Answer them with y (== yes), n (== no)\n", NUM_Q); printf("xor m (== maybe, sometimes). Please answer honestly, else you'll just fool\n"); printf("yourself. Press enter to start...\n"); fgets(tmp, 255, stdin); } void ask_question(void) { int rdnq; char tmp[20], answer; do rdnq = rand() % MAX_Q; while (answered[rdnq]); answered[rdnq] = 1; printf(A_NORM "%s (y/n/m)? " A_BOLD, question[rdnq].question); fgets(tmp, 19, stdin); tmp[19] = 0; answer = tolower(tmp[0]); max_score += (question[rdnq].yes > question[rdnq].no) ? question[rdnq].yes : question[rdnq].no; switch (answer) { case 'y': score += question[rdnq].yes; break; case 'n': score += question[rdnq].no; break; default: printf("Answer `maybe' assumed.\n"); case 'm': score += question[rdnq].maybe; break; } } unsigned int get_ratio(void) { if (max_score < 1) { score += 1 - max_score; max_score = 1; } if (score < 0) { max_score -= score; score = 0; } return (unsigned int) (score * 1000) / max_score; } int main(void) { unsigned int i; intro(); srand(time(NULL)); for (i = 0; i < MAX_Q; i++) answered[i] = 0; for (i = 0; i < NUM_Q; i++) ask_question(); i = get_ratio(); printf(A_NORM "\nYour ratio is " A_BOLD "%02d,%01d%%" A_NORM ". ", i / 10, i % 10); printf("This qualifies you as a " A_BOLD "%s" A_NORM ".\n", ratio_names[i / 100]); printf("Remember that this test results are not absolute, maybe even not close\n"); printf("to the truth. They are by no means something to brag about.\n"); return 0; }