DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: R T

⟦a3899b35e⟧ TextFile

    Length: 2892 (0xb4c)
    Types: TextFile
    Names: »README«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Snake2/README« 

TextFile

Copyright (C) 1981 by Don Libes.  This software may be freely copied
and distributed for noncommercial purposes provided that this notice
remains intact.  Commercial use of this software requires my prior
written permission.

These files implement the game of snake2.  snake2 is in no way based
on snake(6) from Berkeley except that there is a snake in the picture.

snake2 is actually based upon a game I saw for a couple minutes one
day at Xerox running on a Data General (c. 1980).  I wrote this
without access to that one, so it's no longer very similar and
certainly doesn't have any source in common.

The source for this game is actually useful as an example of how to
do a bunch of not-well-documented things (curses, reading the
keyboard without blocking, <1sec sleeps, updating a file while
avoiding the lost-update problem, keeping a setuid log file, etc)
while still being short.  Additionally, the task of keeping track
of the snake and boxes, is cute, and in fact, was used by one
professor as an assignment for a lower-level programming course.

This game is known to run under 4.2, Eunice and 4.1 (the latter with
the CMU IPC).  Undoubtedly, it will run under any version of UNIX that
can do the following:

1) Check if the user has hit a key without blocking.  All of 4.2,
4.1 and Eunice implement the FIONREAD ioctl which returns the number
of characters unread in the input buffer.  Additionally, some
systems which claim Berkeley enhancements (eg Unisoft) include this.
If that is the case, you don't have to do anything.  Otherwise, just
plug your solution into getkey.c and recompile.

2) Sleep for less than a second.  4.2 has select().  Eunice has VMS
do it.  The 4.1 I used had the CMU IPC which had something very
similar to select.  Some systems (eg Unisoft) implement select in a
way that is not useful here.  You must use something else if your
select does not work like the Berkeley select.  For other systems,
there are device drivers available that are designed simply for this
purpose.  Just plug your solution into quicksleep.c and recompile.

Notes, warnings, trust me...

The actual timeout used is one quarter of a second.  Since the game
does relatively little processing each move (every .25 seconds), it
places virtually no load on the system.

Included are a man page and (for VMS systems) a help file.  Ignore
whichever one is inappropriate for you.

The game should be installed setuid with the owner set to "snake" or
"daemon" or something similarly innocuous, to prevent tampering with
the score file.  Since Eunice does not implement setuid(), Eunice
sites must install it with sysprv.  Frightening, isn't it?

If you have to modify the game to run under your system, please send
me back the modifications.  Thanks.

Don Libes
National Bureau of Standards
Met. Bldg, Rm B229
Gaithersburg, MD  20899
(301) 921-2171
{seismo,umcp-cs}!nbs-amrf!libes