games@tekred.TEK.COM (09/22/88)
Submitted by: eddie.mit.edu!nathan@gatech.UUCP (Nathan Glasser) Comp.sources.games: Volume 5, Issue 65 Archive-name: suicide [[ From Nathan: Someone had sent a message to comp.sources.wanted last week asking for a copy of the "suicide.c" program that I had written and sent to Usenet in the newsgroup net.suicide (don't ask me why) in early 1983. I figured maybe other people might be interested in these somewhat amusing programs, so here they are. I wrote the first one (suicide.c); the others were posted to the net later by persons unknown.]] [Moderator's note: I compiled and tried all three of these programs. The quality of animation directly depends on the load average of the machine you're running them on. On our Vax (4.3bsd) it was about right. On my Sun 3/60, it happened so fast all I saw was the final result! -br] #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: suicide.c suicide1.c suicide2.c # Wrapped by billr@saab on Wed Sep 21 10:43:11 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'suicide.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'suicide.c'\" else echo shar: Extracting \"'suicide.c'\" \(2464 characters\) sed "s/^X//" >'suicide.c' <<'END_OF_FILE' X/* to compile, type X X cc suicide.c -lcurses -ltermcap -o suicide X X*/ X/*-------begin-suicide.c-------------------------------------------*/ X/* X#include <curses.h> X*/ X#include "curses.h" Xmain() X{ X int i, j; X static char *tree[] = { X " ((( ( ( )) ) ))", X " | ( (((()( ( )|", X "\\ | ) ))) ) |", X " \\ | |", X "\\ \\ | |", X " \\ \\ _____ ---------------.", X " \\ / \\ ___/", X " \\ | \\ ----------/", X " | | | |", X " | \\_____/ |", X " | |", X " | |", X " | |", X " | |", X " | |", X " | |", X " | |", X " | |", X " | |", X " / \\", X " | |", X " / \\", X " ------------------------------------------------"}; X X static char *man1[] = { X " __o__", X " I", X " / \\"}; X X static char *man2[] = { X " o", X " /\\", X " |_"}; X X static char *man3[] = { X " o", X " /\\", X "|", X " \\"}; X X static char *man4[] = { X " ", X "\\o/", X " I ", X "/ \\"}; X X static char *man5[] = { X " ", X " \\o/ ", X "\\_I_/"}; X X static char *man6[] = { X " o /", X " / ", X "\\ I", X "----\\"}; X X static struct { X int y; X int x; X } divecoord[] = { X 2,34, X 1,34, X 1,35, X 1,36, X 1,37, X 1,38, X 1,39, X 0,40, X 0,41, X 0,42}; X X X initscr(); X clear(); X printpic(tree,23,0,0); X for (i = 20; i < 31; i++) X printpic(man1,3,2,i); X for (i = 31; i < 33; i++) X printpic(man2,3,2,i); X move(2,33); clrtoeol(); X move(3,33); clrtoeol(); X move(4,33); clrtoeol(); X mvprintw(0,19,"Aaaaa"); X for (i = 0; i < 10; i++) X { X if (i == 5) X mvprintw(0,24,"uuuuuuuu"); X printpic(man3,4,divecoord[i].y,divecoord[i].x); X for (j = 0; j < 4; j++) X { X move(divecoord[i].y + j,divecoord[i].x); X clrtoeol(); X } X } X mvprintw(0,32,"gggggggggggggggg"); X printpic(man4 + 1,3,1,43); X for (i = 1; i < 11; i++) X printpic(man4,4,i,43); X move(0,48); printw("hhhhhhhhhhhhhhhhhhhhh"); X for (i = 11; i < 21; i++) X printpic(man5,3,i,42); X mvprintw(0,69,"!!!!!!!!!!"); X printpic(man6,4,19,41); X move(23,0); X refresh(); X endwin(); X} X Xprintpic(pic,len,y,x) Xchar **pic; Xint len, y, x; X{ X int i; X for (i = 0; i < len; i++) X mvprintw(i + y,x,pic[i]); X refresh(); X} X/*--------end-suicide.c--------------------------------------------*/ END_OF_FILE if test 2464 -ne `wc -c <'suicide.c'`; then echo shar: \"'suicide.c'\" unpacked with wrong size! fi # end of 'suicide.c' fi if test -f 'suicide1.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'suicide1.c'\" else echo shar: Extracting \"'suicide1.c'\" \(3125 characters\) sed "s/^X//" >'suicide1.c' <<'END_OF_FILE' X/*-------begin-suicide.c-------------------------------------------*/ X/* to compile "cc su.c -lcurses -ltermcap -o suicide" */ X#include <curses.h> Xmain() X{ X int i, j; X static char *tree[] = { X "-------------------", X "| --- |", X "| | | |", X "| --- |", X "| |", X "| --- |----------------", X "| | | |", X "| --- |", X "| --- |", X "| | | |", X "| --- |", X "| --- --- |", X "| | | | | |", X "| --- --- |", X "| |", X "| |", X "| --- |", X "| | | |", X "| --- |", X "| ----- |", X "| | | |", X "| | | |", X "----------------------------------------------------------------------"}; X X static char *man1[] = { X " __o__", X " I", X " / \\"}; X X static char *man2[] = { X " o", X " /\\", X " |_"}; X X static char *man3[] = { X " o", X " /\\", X "|", X " \\"}; X X static char *man4[] = { X " ", X "\\o/", X " I ", X "/ \\"}; X X static char *man5[] = { X " ", X " \\o/ ", X "\\_I_/"}; X X static char *man6[] = { X " ", X "\\ / ", X " ===o ", X " / \\ "}; X X static struct { X int y; X int x; X } divecoord[] = { X 2,34, X 1,34, X 1,35, X 1,36, X 1,37, X 1,38, X 1,39, X 0,40, X 0,41, X 0,42}; X X X initscr(); X clear(); X printpic(tree,23,0,0); X for (i = 20; i < 31; i++) X printpic(man1,3,2,i); X for (i = 31; i < 33; i++) X printpic(man2,3,2,i); X move(2,33); clrtoeol(); X move(3,33); clrtoeol(); X move(4,33); clrtoeol(); X mvprintw(0,19,"Aaaaa"); X for (i = 0; i < 10; i++) X { X if (i == 5) X mvprintw(0,24,"uuuuuuuu"); X printpic(man3,4,divecoord[i].y,divecoord[i].x); X for (j = 0; j < 4; j++) X { X move(divecoord[i].y + j,divecoord[i].x); X clrtoeol(); X } X } X mvprintw(0,32,"gggggggggggggggg"); X printpic(man4 + 1,3,1,43); X for (i = 1; i < 11; i++) X printpic(man4,4,i,43); X move(0,48); printw("hhhhhhhhhhhhhhhhhhhhh"); X for (i = 11; i < 21; i++) X printpic(man5,3,i,42); X mvprintw(0,69,"!!!!!!!!!!"); X printpic(man6,4,19,41); X move(23,0); X refresh(); X endwin(); X} X Xprintpic(pic,len,y,x) Xchar **pic; Xint len, y, x; X{ X int i; X for (i = 0; i < len; i++) X mvprintw(i + y,x,pic[i]); X refresh(); X} X/*--------end-suicide.c--------------------------------------------*/ END_OF_FILE if test 3125 -ne `wc -c <'suicide1.c'`; then echo shar: \"'suicide1.c'\" unpacked with wrong size! fi # end of 'suicide1.c' fi if test -f 'suicide2.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'suicide2.c'\" else echo shar: Extracting \"'suicide2.c'\" \(1593 characters\) sed "s/^X//" >'suicide2.c' <<'END_OF_FILE' X/* XTo compile: X X cc suicide2.c -lcurses -ltermcap -o suicide2 X XThose flags are necessary if the graphics are to work properly. X*/ X/************************** BEGIN SUICIDE PROGRAM *****************************/ X X/* X#include <curses.h> X*/ X#include "curses.h" Xmain() X{ X int i, j; X X static int cx[] = { X 20, 25, 30, 40, 44, 48, 57 }; X X X static char *road[] = { X "------------------------------------------------------------------------------", X " ", X " ", X " --- --- --- --- --- --- --- --- --- --- --- --- ---", X " ", X " ", X "-----------------------------------------------------------------------------" }; X X static char *car[] = { X " _/-\__", X " =o--o+"}; X X static char *guy[] = { X "o", X "X", X " "}; X X static char *boom[] = { X " . * . ", X " ^ : .o . ", X " = \'$-# . ", X " . /=./\ ", X " . v . "}; X X static char *cry[] = { X "Hey!", X "You!", X "Watch out", X "for", X "the", X "CAR !!!!"}; X X static char *bye[] = { X " ", X " ", X " ", X "Bye", X "sick", X " world !!"}; X X initscr(); X clear(); X printpic(road, 7, 8, 0); X for(i=0; i < 60; i++) { X printpic(car, 2, 12, i); X if(i%10 == 0) { X j = i/10; X printpic(guy, 3, 17-(j), 65); X mvprintw(3, cx[j], cry[j]); X mvprintw(20, cx[j]+18, bye[j]); X if(j == 5) X mvprintw(14, 64, "---"); X } X } X printpic(boom, 4, 11, 60); X refresh(); X endwin(); X getchar(); X X} X Xprintpic(pic, len, y, x) Xchar **pic; Xint len, x, y; X{ X int i; X for (i=0; i < len; i++) X mvprintw(i + y, x, pic[i]); X refresh(); X} X X/****************** END OF SUICIDE PROGRAM ************************************/ END_OF_FILE if test 1593 -ne `wc -c <'suicide2.c'`; then echo shar: \"'suicide2.c'\" unpacked with wrong size! fi # end of 'suicide2.c' fi echo shar: End of shell archive. exit 0