Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!bionet!hayes.ims.alaska.edu!hayes!ejo From: ejo@ims.alaska.edu (Eric Olson) Newsgroups: vmsnet.sources.games,alt.sources Subject: bomb - repost for vms Message-ID: <1991May26.205243.14136@ims.alaska.edu> Date: 26 May 91 21:52:38 GMT Sender: usenet@ims.alaska.edu (J Random USENET) Organization: Citizens for Boysenberry Jam Fans Lines: 325 Nntp-Posting-Host: hayes.ims.alaska.edu Whoops! There was an error in the com file to build bomb on vms systems. If you use a good compile program, you wouldn't need to worry about it, but I'll post a correction anyway. Because a) it's a fairly small share file and b) the last posting was of a unix share file, I'm just going to repost the whole thing in a vms_shar share file. *** $! ------------------ CUT HERE ----------------------- $ v='f$verify(f$trnlnm("SHARE_VERIFY"))' $! $! This archive created by VMS_SHARE Version 7.2-007 22-FEB-1990 $! On 26-MAY-1991 12:49:51.89 By user EJO $! $! This VMS_SHARE Written by: $! Andy Harper, Kings College London UK $! $! Acknowledgements to: $! James Gray - Original VMS_SHARE $! Michael Bednarek - Original Concept and implementation $! $! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER $! AND EXECUTE AS A COMMAND PROCEDURE ( @name ) $! $! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING: $! 1. BOMB.C;1 $! 2. BUILD_VMS.COM;2 $! 3. MAKEFILE.;1 $! 4. README.BOMB;1 $! $set="set" $set symbol/scope=(nolocal,noglobal) $f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID")) $e="write sys$error ""%UNPACK"", " $w="write sys$output ""%UNPACK"", " $ if f$trnlnm("SHARE_LOG") then $ w = "!" $ ve=f$getsyi("version") $ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START $ e "-E-OLDVER, Must run at least VMS 4.4" $ v=f$verify(v) $ exit 44 $UNPACK: SUBROUTINE ! P1=filename, P2=checksum $ if f$search(P1) .eqs. "" then $ goto file_absent $ e "-W-EXISTS, File ''P1' exists. Skipped." $ delete 'f'* $ exit $file_absent: $ if f$parse(P1) .nes. "" then $ goto dirok $ dn=f$parse(P1,,,"DIRECTORY") $ w "-I-CREDIR, Creating directory ''dn'." $ create/dir 'dn' $ if $status then $ goto dirok $ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped." $ delete 'f'* $ exit $dirok: $ w "-I-PROCESS, Processing file ''P1'." $ if .not. f$verify() then $ define/user sys$output nl: $ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1' PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET( SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:= CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b)); LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION( BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1); IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE; MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1; ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")= 1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF"; POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r); ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1; COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE, "output_file"));ENDPROCEDURE;Unpacker;QUIT; $ delete/nolog 'f'* $ CHECKSUM 'P1' $ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT $ e "-E-CHKSMFAIL, Checksum of ''P1' failed." $ ENDSUBROUTINE $START: $ create 'f' X/* bomb.c, by Eric Olson. */ X/* version 1.0 */ X/* This program is copyright 1991 by Eric Olson. You are welcome to X distribute it, but this notice should remain intact and you should X include all the files that were distributed with it. This program is X not to be sold, although a fee may be charged to cover distribution X expenses (if there are any). If you wish to modify the code and X distribute it, please feel free to do so, but label the code as X modified here and change the version accordingly. */ X X#include X#include X X#ifdef VMS Xunsigned char _getch() /* kent d ramier 20 feb 88 */ /* eo ruined spacing */ X `7B struct `7B unsigned short length; unsigned char dtype; unsigned char X class; char *pointer; `7D device = `7B 9, 14, 1, "SYS$INPUT"`7D; static X unsigned short a_channel = 0; unsigned char the_key; if (!(a_channel)) X SYS$ASSIGN(&device,&a_channel,0,0); SYS$QIOW X (0,a_channel,625,0,0,0,&the_key,1,1,0,0,0); return(the_key); `7D X# define GETCH (_getch()) X#else X /* if you're not on VAX/VMS, you may need to refit this. */ X /* it does occasionally leave numbers on my screen. */ X# define GETCH (getch()) X#endif VMS X X#define MAX 16 /* boardsize */ X X/* this is a terrible random generator. Make a better one. */ X#include X#include X#define RANDOM ((int)((float)rand()/((float)((unsigned)(-1)))*2.0*(float)(MA VX))) X#define RANDOM_SEED srand(time((time_t *)0)) X Xshort think`5BMAX`5D`5BMAX`5D,grid`5BMAX`5D`5BMAX`5D,boom; Xint xx=0,yy=0; X X#define NOTYET 9 X#define BOMB 10 X#define OKAY 11 Xstatic char icon`5B`5D=" 12345678.*o"; X Xdrawscr() X`7B Xint i,j; X Xfor (i=0;i'); */ X`7D X Xshort invalid(i,j) Xint i,j; X`7B X if ((i==j) && ((i==0) `7C`7C (i==MAX-1))) return (1); X if ((i<2) && (j<2)) return (1); X if ((i==MAX) `7C`7C (j==MAX)) return (1); X if (grid`5Bi`5D`5Bj`5D) return (1); X return (0); X`7D X Xanalyze(x,y) Xint x,y; X`7B Xint i,j,t=0; X Xfor (i= -1;i<2;i++) X for (j= -1;j<2;j++) X if ((i+x>=0) && (j+y>=0) && (i+x=0) && (j+y>=0) && (i+x=0) && (i+x=0)) X if (think`5Bi+x`5D`5Bj+y`5D1) X `7B X sscanf(argv`5B1`5D,"%d",&nb); X if ((nb<1) `7C`7C (nb>(MAX*(MAX-2)))) X `7B X printf ("Invalid number of bombs."); exit(0); X `7D X `7D X Xinitscr(); XRANDOM_SEED; X Xfor (i=0;i",27); X Xfor (i=j=boom=0;!boom;) X `7B X drawscr(); X move(j,i*2+1); refresh(); X c=GETCH; X switch (c) X `7B X case '1': i--; X case '2': j++; break; X case '7': j--; X case '4': i--; break; X case '9': i++; X case '8': j--; break; X case '3': j++; X case '6': i++; break; X case ' ': toggle(i,j); break; X case 12: clear(); refresh(); break; X /* case '\n': */ case 13: case 10: moveto(i,j); X default: break; X `7D X if (i<0) i=0; if (i>=MAX) i=MAX-1; if (j<0) j=0; if (j>=MAX) j=MAX-1; X `7D X Xendwin(); Xif (boom==1) printf ("Good job!\n"); Xelse printf ("***BOOM***\n"); Xfor (j=0;j