summaryrefslogtreecommitdiffstats
path: root/games/robots
diff options
context:
space:
mode:
Diffstat (limited to 'games/robots')
-rw-r--r--games/robots/Makefile19
-rw-r--r--games/robots/extern.c79
-rw-r--r--games/robots/flush_in.c55
-rw-r--r--games/robots/init_field.c122
-rw-r--r--games/robots/main.c196
-rw-r--r--games/robots/make_level.c93
-rw-r--r--games/robots/move.c305
-rw-r--r--games/robots/move_robs.c156
-rw-r--r--games/robots/pathnames.h36
-rw-r--r--games/robots/play_level.c119
-rw-r--r--games/robots/query.c65
-rw-r--r--games/robots/rnd_pos.c71
-rw-r--r--games/robots/robots.6142
-rw-r--r--games/robots/robots.h107
-rw-r--r--games/robots/score.c189
15 files changed, 0 insertions, 1754 deletions
diff --git a/games/robots/Makefile b/games/robots/Makefile
deleted file mode 100644
index 3e26d85..0000000
--- a/games/robots/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-# $FreeBSD$
-
-PROG= robots
-CFLAGS+=-DMAX_PER_UID=5
-SRCS= extern.c init_field.c main.c make_level.c move.c move_robs.c \
- play_level.c query.c rnd_pos.c score.c flush_in.c
-MAN= robots.6
-DPADD= ${LIBCURSES} ${LIBCOMPAT}
-LDADD= -lcurses -lcompat
-HIDEGAME=hidegame
-
-beforeinstall:
-.if !exists(${DESTDIR}/var/games/robots_roll)
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
- ${DESTDIR}/var/games/robots_roll
-.endif
-
-.include <bsd.prog.mk>
diff --git a/games/robots/extern.c b/games/robots/extern.c
deleted file mode 100644
index 07a8ce0..0000000
--- a/games/robots/extern.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-
-bool Dead; /* Player is now dead */
-bool Full_clear = TRUE; /* Lots of junk for init_field to clear */
-bool Jump = FALSE; /* Jump while running, counting, or waiting */
-bool Newscore; /* There was a new score added */
-#ifdef FANCY
-bool Pattern_roll = FALSE; /* Auto play for YHBJNLUK pattern */
-#endif
-bool Real_time = FALSE; /* Play in real time? */
-bool Running = FALSE; /* Currently in the middle of a run */
-#ifdef FANCY
-bool Stand_still = FALSE; /* Auto play for standing still pattern */
-#endif
-bool Teleport = FALSE; /* Teleport automatically when player must */
-bool Waiting; /* Player is waiting for end */
-bool Was_bonus = FALSE; /* Was a bonus last level */
-
-char Cnt_move; /* Command which has preceded the count */
-char Field[Y_FIELDSIZE][X_FIELDSIZE]; /* the playing field itslef */
-char *Next_move; /* Next move to be used in the pattern */
-char *Move_list = "YHBJNLUK";/* List of moves in the pattern */
-char Run_ch; /* Character for the direction we are running */
-
-int Count = 0; /* Command count */
-int Level; /* Current level */
-int Num_robots; /* Number of robots left */
-int Num_scores; /* Number of scores posted */
-int Score; /* Current score */
-int Start_level = 1; /* Level on which to start */
-int Wait_bonus; /* bonus for waiting */
-
-COORD Max; /* Max area robots take up */
-COORD Min; /* Min area robots take up */
-COORD My_pos; /* Player's current position */
-COORD Robots[MAXROBOTS]; /* Robots' current positions */
-
-jmp_buf End_move; /* Jump to on Real_time */
diff --git a/games/robots/flush_in.c b/games/robots/flush_in.c
deleted file mode 100644
index 18e2709..0000000
--- a/games/robots/flush_in.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)flush_in.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <curses.h>
-
-/*
- * flush_in:
- * Flush all pending input.
- */
-flush_in()
-{
-# ifdef TIOCFLUSH
- ioctl(fileno(stdin), TIOCFLUSH, NULL);
-# else /* TIOCFLUSH */
- crmode();
-# endif /* TIOCFLUSH */
-}
diff --git a/games/robots/init_field.c b/games/robots/init_field.c
deleted file mode 100644
index 5ba6466..0000000
--- a/games/robots/init_field.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)init_field.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-# include "robots.h"
-
-/*
- * init_field:
- * Lay down the initial pattern whih is constant across all levels,
- * and initialize all the global variables.
- */
-init_field()
-{
- int i;
- WINDOW *wp;
- int j;
- static bool first = TRUE;
- static char *desc[] = {
- "Directions:",
- "",
- "y k u",
- " \\|/",
- "h- -l",
- " /|\\",
- "b j n",
- "",
- "Commands:",
- "",
- "w: wait for end",
- "t: teleport",
- "q: quit",
- "^L: redraw screen",
- "",
- "Legend:",
- "",
- "+: robot",
- "*: junk heap",
- "@: you",
- "",
- "Score: 0",
- NULL
- };
-
- Dead = FALSE;
- Waiting = FALSE;
- /* flushok(stdscr, TRUE); */
- Score = 0;
-
- erase();
- move(0, 0);
- addch('+');
- for (i = 1; i < Y_FIELDSIZE; i++) {
- move(i, 0);
- addch('|');
- }
- move(Y_FIELDSIZE, 0);
- addch('+');
- for (i = 1; i < X_FIELDSIZE; i++)
- addch('-');
- addch('+');
- if (first)
- refresh();
- move(0, 1);
- for (i = 1; i < X_FIELDSIZE; i++)
- addch('-');
- addch('+');
- for (i = 1; i < Y_FIELDSIZE; i++) {
- move(i, X_FIELDSIZE);
- addch('|');
- }
- if (first)
- refresh();
- for (i = 0; desc[i] != NULL; i++) {
- move(i, X_FIELDSIZE + 2);
- addstr(desc[i]);
- }
- if (first)
- refresh();
- first = FALSE;
-#ifdef FANCY
- if (Pattern_roll)
- Next_move = &Move_list[-1];
-#endif
-}
diff --git a/games/robots/main.c b/games/robots/main.c
deleted file mode 100644
index 837d608..0000000
--- a/games/robots/main.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-# include <signal.h>
-# include <stdlib.h>
-# include <ctype.h>
-
-main(ac, av)
-int ac;
-char **av;
-{
- char *sp;
- bool bad_arg;
- bool show_only;
- extern char *Scorefile;
- extern int Max_per_uid;
- void quit();
-
- show_only = FALSE;
- if (ac > 1) {
- bad_arg = FALSE;
- for (++av; ac > 1 && *av[0]; av++, ac--)
- if (av[0][0] != '-')
- if (isdigit(av[0][0]))
- Max_per_uid = atoi(av[0]);
- else {
- Scorefile = av[0];
-# ifdef FANCY
- sp = rindex(Scorefile, '/');
- if (sp == NULL)
- sp = Scorefile;
- if (strcmp(sp, "pattern_roll") == 0)
- Pattern_roll = TRUE;
- else if (strcmp(sp, "stand_still") == 0)
- Stand_still = TRUE;
- if (Pattern_roll || Stand_still)
- Teleport = TRUE;
-# endif
- }
- else
- for (sp = &av[0][1]; *sp; sp++)
- switch (*sp) {
- case 's':
- show_only = TRUE;
- break;
- case 'r':
- Real_time = TRUE;
- break;
- case 'a':
- Start_level = 4;
- break;
- case 'j':
- Jump = TRUE;
- break;
- case 't':
- Teleport = TRUE;
- break;
- default:
- fprintf(stderr, "robots: uknown option: %c\n", *sp);
- bad_arg = TRUE;
- break;
- }
- if (bad_arg) {
- exit(1);
- /* NOTREACHED */
- }
- }
-
- if (show_only) {
- show_score();
- exit(0);
- /* NOTREACHED */
- }
-
- initscr();
- signal(SIGINT, quit);
- crmode();
- noecho();
- nonl();
- if (LINES != Y_SIZE || COLS != X_SIZE) {
- if (LINES < Y_SIZE || COLS < X_SIZE) {
- endwin();
- printf("Need at least a %dx%d screen\n",
- Y_SIZE, X_SIZE);
- exit(1);
- }
- delwin(stdscr);
- stdscr = newwin(Y_SIZE, X_SIZE, 0, 0);
- }
-
- srandomdev();
- if (Real_time)
- signal(SIGALRM, move_robots);
- do {
- init_field();
- for (Level = Start_level; !Dead; Level++) {
- make_level();
- play_level();
- }
- move(My_pos.y, My_pos.x);
- printw("AARRrrgghhhh....");
- refresh();
- score();
- } while (another());
- quit();
-}
-
-void
-__cputchar(ch)
- int ch;
-{
- (void)putchar(ch);
-}
-
-/*
- * quit:
- * Leave the program elegantly.
- */
-void
-quit()
-{
- endwin();
- exit(0);
- /* NOTREACHED */
-}
-
-/*
- * another:
- * See if another game is desired
- */
-another()
-{
- int y;
-
-#ifdef FANCY
- if ((Stand_still || Pattern_roll) && !Newscore)
- return TRUE;
-#endif
-
- if (query("Another game?")) {
- if (Full_clear) {
- for (y = 1; y <= Num_scores; y++) {
- move(y, 1);
- clrtoeol();
- }
- refresh();
- }
- return TRUE;
- }
- return FALSE;
-}
diff --git a/games/robots/make_level.c b/games/robots/make_level.c
deleted file mode 100644
index 4aca2f5..0000000
--- a/games/robots/make_level.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)make_level.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-
-/*
- * make_level:
- * Make the current level
- */
-make_level()
-{
- int i;
- COORD *cp;
- WINDOW *wp;
- int x, *endp;
-
- reset_count();
- for (i = 1; i < Y_FIELDSIZE; i++)
- for (x = 1; x < X_FIELDSIZE; x++)
- if (Field[i][x] != 0)
- mvaddch(i, x, ' ');
- if (My_pos.y > 0)
- mvaddch(My_pos.y, My_pos.x, ' ');
-
- Waiting = FALSE;
- Wait_bonus = 0;
- leaveok(stdscr, FALSE);
- for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++)
- cp->y = -1;
- My_pos.y = -1;
-
- bzero(Field, sizeof Field);
- Min.y = Y_FIELDSIZE;
- Min.x = X_FIELDSIZE;
- Max.y = 0;
- Max.x = 0;
- if ((i = Level * 10) > MAXROBOTS)
- i = MAXROBOTS;
- Num_robots = i;
- while (i-- > 0) {
- cp = rnd_pos();
- Robots[i] = *cp;
- Field[cp->y][cp->x]++;
- if (cp->y < Min.y)
- Min.y = cp->y;
- if (cp->x < Min.x)
- Min.x = cp->x;
- if (cp->y > Max.y)
- Max.y = cp->y;
- if (cp->x > Max.x)
- Max.x = cp->x;
- }
- My_pos = *rnd_pos();
- refresh();
-}
diff --git a/games/robots/move.c b/games/robots/move.c
deleted file mode 100644
index fe18ed6..0000000
--- a/games/robots/move.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/ttydefaults.h>
-#include <ctype.h>
-#include "robots.h"
-
-# define ESC '\033'
-
-/*
- * get_move:
- * Get and execute a move from the player
- */
-get_move()
-{
- int c;
- int y, x, lastmove;
- static COORD newpos;
-
- if (Waiting)
- return;
-
-#ifdef FANCY
- if (Pattern_roll) {
- if (Next_move >= Move_list)
- lastmove = *Next_move;
- else
- lastmove = -1; /* flag for "first time in" */
- } else
- lastmove = 0; /* Shut up gcc */
-#endif
- for (;;) {
- if (Teleport && must_telep())
- goto teleport;
- if (Running)
- c = Run_ch;
- else if (Count != 0)
- c = Cnt_move;
-#ifdef FANCY
- else if (Num_robots > 1 && Stand_still)
- c = '>';
- else if (Num_robots > 1 && Pattern_roll) {
- if (*++Next_move == '\0') {
- if (lastmove < 0)
- goto over;
- Next_move = Move_list;
- }
- c = *Next_move;
- mvaddch(0, 0, c);
- if (c == lastmove)
- goto over;
- }
-#endif
- else {
-over:
- c = getchar();
- if (isdigit(c)) {
- Count = (c - '0');
- while (isdigit(c = getchar()))
- Count = Count * 10 + (c - '0');
- if (c == ESC)
- goto over;
- Cnt_move = c;
- if (Count)
- leaveok(stdscr, TRUE);
- }
- }
-
- switch (c) {
- case ' ':
- case '.':
- if (do_move(0, 0))
- goto ret;
- break;
- case 'y':
- if (do_move(-1, -1))
- goto ret;
- break;
- case 'k':
- if (do_move(-1, 0))
- goto ret;
- break;
- case 'u':
- if (do_move(-1, 1))
- goto ret;
- break;
- case 'h':
- if (do_move(0, -1))
- goto ret;
- break;
- case 'l':
- if (do_move(0, 1))
- goto ret;
- break;
- case 'b':
- if (do_move(1, -1))
- goto ret;
- break;
- case 'j':
- if (do_move(1, 0))
- goto ret;
- break;
- case 'n':
- if (do_move(1, 1))
- goto ret;
- break;
- case 'Y': case 'U': case 'H': case 'J':
- case 'K': case 'L': case 'B': case 'N':
- case '>':
- Running = TRUE;
- if (c == '>')
- Run_ch = ' ';
- else
- Run_ch = tolower(c);
- leaveok(stdscr, TRUE);
- break;
- case 'q':
- case 'Q':
- if (query("Really quit?"))
- quit();
- refresh();
- break;
- case 'w':
- case 'W':
- Waiting = TRUE;
- leaveok(stdscr, TRUE);
- /* flushok(stdscr, FALSE); */
- goto ret;
- case 't':
- case 'T':
-teleport:
- Running = FALSE;
- mvaddch(My_pos.y, My_pos.x, ' ');
- My_pos = *rnd_pos();
- mvaddch(My_pos.y, My_pos.x, PLAYER);
- leaveok(stdscr, FALSE);
- refresh();
- flush_in();
- goto ret;
- case CTRL('L'):
- wrefresh(curscr);
- break;
- case EOF:
- break;
- default:
- putchar(CTRL('G'));
- reset_count();
- fflush(stdout);
- break;
- }
- }
-ret:
- if (Count > 0)
- if (--Count == 0)
- leaveok(stdscr, FALSE);
-}
-
-/*
- * must_telep:
- * Must I teleport; i.e., is there anywhere I can move without
- * being eaten?
- */
-must_telep()
-{
- int x, y;
- static COORD newpos;
-
-#ifdef FANCY
- if (Stand_still && Num_robots > 1 && eaten(&My_pos))
- return TRUE;
-#endif
-
- for (y = -1; y <= 1; y++) {
- newpos.y = My_pos.y + y;
- if (newpos.y <= 0 || newpos.y >= Y_FIELDSIZE)
- continue;
- for (x = -1; x <= 1; x++) {
- newpos.x = My_pos.x + x;
- if (newpos.x <= 0 || newpos.x >= X_FIELDSIZE)
- continue;
- if (Field[newpos.y][newpos.x] > 0)
- continue;
- if (!eaten(&newpos))
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/*
- * do_move:
- * Execute a move
- */
-do_move(dy, dx)
-int dy, dx;
-{
- static COORD newpos;
-
- newpos.y = My_pos.y + dy;
- newpos.x = My_pos.x + dx;
- if (newpos.y <= 0 || newpos.y >= Y_FIELDSIZE ||
- newpos.x <= 0 || newpos.x >= X_FIELDSIZE ||
- Field[newpos.y][newpos.x] > 0 || eaten(&newpos)) {
- if (Running) {
- Running = FALSE;
- leaveok(stdscr, FALSE);
- move(My_pos.y, My_pos.x);
- refresh();
- }
- else {
- putchar(CTRL('G'));
- reset_count();
- }
- return FALSE;
- }
- else if (dy == 0 && dx == 0)
- return TRUE;
- mvaddch(My_pos.y, My_pos.x, ' ');
- My_pos = newpos;
- mvaddch(My_pos.y, My_pos.x, PLAYER);
- if (!jumping())
- refresh();
- return TRUE;
-}
-
-/*
- * eaten:
- * Player would get eaten at this place
- */
-eaten(pos)
-COORD *pos;
-{
- int x, y;
-
- for (y = pos->y - 1; y <= pos->y + 1; y++) {
- if (y <= 0 || y >= Y_FIELDSIZE)
- continue;
- for (x = pos->x - 1; x <= pos->x + 1; x++) {
- if (x <= 0 || x >= X_FIELDSIZE)
- continue;
- if (Field[y][x] == 1)
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/*
- * reset_count:
- * Reset the count variables
- */
-reset_count()
-{
- Count = 0;
- Running = FALSE;
- leaveok(stdscr, FALSE);
- refresh();
-}
-
-/*
- * jumping:
- * See if we are jumping, i.e., we should not refresh.
- */
-jumping()
-{
- return (Jump && (Count || Running || Waiting));
-}
diff --git a/games/robots/move_robs.c b/games/robots/move_robs.c
deleted file mode 100644
index 23f39f6..0000000
--- a/games/robots/move_robs.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)move_robs.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-# include <signal.h>
-
-/*
- * move_robots:
- * Move the robots around
- */
-void
-move_robots(was_sig)
-bool was_sig;
-{
- COORD *rp;
- int y, x;
- int mindist, d;
- static COORD newpos;
-
- if (Real_time)
- signal(SIGALRM, move_robots);
-# ifdef DEBUG
- move(Min.y, Min.x);
- addch(inch());
- move(Max.y, Max.x);
- addch(inch());
-# endif /* DEBUG */
- for (rp = Robots; rp < &Robots[MAXROBOTS]; rp++) {
- if (rp->y < 0)
- continue;
- mvaddch(rp->y, rp->x, ' ');
- Field[rp->y][rp->x]--;
- rp->y += sign(My_pos.y - rp->y);
- rp->x += sign(My_pos.x - rp->x);
- if (rp->y <= 0)
- rp->y = 0;
- else if (rp->y >= Y_FIELDSIZE)
- rp->y = Y_FIELDSIZE - 1;
- if (rp->x <= 0)
- rp->x = 0;
- else if (rp->x >= X_FIELDSIZE)
- rp->x = X_FIELDSIZE - 1;
- Field[rp->y][rp->x]++;
- }
-
- Min.y = Y_FIELDSIZE;
- Min.x = X_FIELDSIZE;
- Max.y = 0;
- Max.x = 0;
- for (rp = Robots; rp < &Robots[MAXROBOTS]; rp++)
- if (rp->y < 0)
- continue;
- else if (rp->y == My_pos.y && rp->x == My_pos.x)
- Dead = TRUE;
- else if (Field[rp->y][rp->x] > 1) {
- mvaddch(rp->y, rp->x, HEAP);
- rp->y = -1;
- Num_robots--;
- if (Waiting)
- Wait_bonus++;
- add_score(ROB_SCORE);
- }
- else {
- mvaddch(rp->y, rp->x, ROBOT);
- if (rp->y < Min.y)
- Min.y = rp->y;
- if (rp->x < Min.x)
- Min.x = rp->x;
- if (rp->y > Max.y)
- Max.y = rp->y;
- if (rp->x > Max.x)
- Max.x = rp->x;
- }
-
- if (was_sig) {
- refresh();
- if (Dead || Num_robots <= 0)
- longjmp(End_move, 0);
- }
-
-# ifdef DEBUG
- standout();
- move(Min.y, Min.x);
- addch(inch());
- move(Max.y, Max.x);
- addch(inch());
- standend();
-# endif /* DEBUG */
- if (Real_time)
- alarm(3);
-}
-
-/*
- * add_score:
- * Add a score to the overall point total
- */
-add_score(add)
-int add;
-{
- Score += add;
- move(Y_SCORE, X_SCORE);
- printw("%d", Score);
-}
-
-/*
- * sign:
- * Return the sign of the number
- */
-sign(n)
-int n;
-{
- if (n < 0)
- return -1;
- else if (n > 0)
- return 1;
- else
- return 0;
-}
diff --git a/games/robots/pathnames.h b/games/robots/pathnames.h
deleted file mode 100644
index 2be7857..0000000
--- a/games/robots/pathnames.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define _PATH_SCORE "/var/games/robots_roll"
diff --git a/games/robots/play_level.c b/games/robots/play_level.c
deleted file mode 100644
index b03bbc4..0000000
--- a/games/robots/play_level.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)play_level.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-
-/*
- * play_level:
- * Let the player play the current level
- */
-play_level()
-{
- COORD *cp;
- int y, x, bonus;
-
- move(My_pos.y, My_pos.x);
- addch(PLAYER);
- refresh();
- for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++) {
- if (cp->y < 0)
- continue;
- move(cp->y, cp->x);
- addch(ROBOT);
- }
- refresh();
-# ifdef DEBUG
- standout();
- move(Min.y, Min.x);
- addch(inch());
- move(Max.y, Max.x);
- addch(inch());
- standend();
-# endif /* DEBUG */
- setjmp(End_move);
- flush_in();
- while (!Dead && Num_robots > 0) {
- move(My_pos.y, My_pos.x);
- if (!jumping())
- refresh();
- get_move();
- if (Real_time)
- alarm(0);
- if (Field[My_pos.y][My_pos.x] != 0)
- Dead = TRUE;
- if (!Dead)
- move_robots(FALSE);
- if (Was_bonus) {
- move(Y_PROMPT, X_PROMPT);
- clrtoeol();
- move(Y_PROMPT + 1, X_PROMPT);
- clrtoeol();
- Was_bonus = FALSE;
- }
- }
-
- /*
- * if the player didn't die, add on the possible bonuses
- */
-
- if (!Dead) {
- Was_bonus = FALSE;
-
- if (Level == Start_level && Start_level > 1) {
- move(Y_PROMPT, X_PROMPT);
- printw("Advance bonus: %d", S_BONUS);
- refresh();
- add_score(S_BONUS);
- Was_bonus = TRUE;
- }
-
- if (Wait_bonus != 0) {
- if (!Was_bonus)
- move(Y_PROMPT, X_PROMPT);
- else
- move(Y_PROMPT + 1, X_PROMPT);
- printw("Wait bonus: %d", Wait_bonus);
- refresh();
- add_score(Wait_bonus);
- Was_bonus = TRUE;
- }
- }
-}
diff --git a/games/robots/query.c b/games/robots/query.c
deleted file mode 100644
index bc6590c..0000000
--- a/games/robots/query.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)query.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <string.h>
-# include "robots.h"
-
-/*
- * query:
- * Ask a question and get a yes or no answer. Default is "no".
- */
-query(prompt)
-char *prompt;
-{
- int c, retval;
- int y, x;
-
- getyx(stdscr, y, x);
- move(Y_PROMPT, X_PROMPT);
- addstr(prompt);
- clrtoeol();
- refresh();
- retval = ((c = getchar()) == 'y' || c == 'Y');
- move(Y_PROMPT, X_PROMPT);
- clrtoeol();
- move(y, x);
- return retval;
-}
diff --git a/games/robots/rnd_pos.c b/games/robots/rnd_pos.c
deleted file mode 100644
index 13be7ca..0000000
--- a/games/robots/rnd_pos.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)rnd_pos.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include <stdlib.h>
-# include "robots.h"
-
-# define IS_SAME(p,y,x) ((p).y != -1 && (p).y == y && (p).x == x)
-
-/*
- * rnd_pos:
- * Pick a random, unoccupied position
- */
-COORD *
-rnd_pos()
-{
- static COORD pos;
- static int call = 0;
- int i = 0;
-
- do {
- pos.y = rnd(Y_FIELDSIZE - 1) + 1;
- pos.x = rnd(X_FIELDSIZE - 1) + 1;
- refresh();
- } while (Field[pos.y][pos.x] != 0);
- call++;
- return &pos;
-}
-
-rnd(range)
-int range;
-{
- return random() % range;
-}
diff --git a/games/robots/robots.6 b/games/robots/robots.6
deleted file mode 100644
index 2f89853..0000000
--- a/games/robots/robots.6
+++ /dev/null
@@ -1,142 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)robots.6 8.1 (Berkeley) 5/31/93
-.\" $FreeBSD$
-.\"
-.TH ROBOTS 6 "May 31, 1993"
-.UC 6
-.SH NAME
-robots \- fight off villainous robots
-.SH SYNOPSIS
-.B robots
-[
-.B \-sjta
-] [
-.B scorefile
-]
-.SH DESCRIPTION
-.I Robots
-pits you against evil robots, who are trying to kill you (which is why
-they are evil).
-Fortunately for you, even though they are evil, they are not very bright
-and have a habit of bumping into each other, thus destroying themselves.
-In order to survive, you must get them to kill each other off, since you
-have no offensive weaponry.
-.PP
-Since you are stuck without offensive weaponry, you are endowed with one
-piece of defensive weaponry: a teleportation device.
-When two robots run into each other or a junk pile, they die.
-If a robot runs into you, you die.
-When a robot dies, you get 10 points, and when all the robots die,
-you start on the next field.
-This keeps up until they finally get you.
-.PP
-Robots are represented on the screen by a
-.RB ` + ',
-the junk heaps from their collisions by a
-.RB ` \(** ',
-and you
-(the good guy)
-by a
-.RB ` @ '.
-.PP
-The commands are:
-.sp
-.nf
-.ta
-.ta \w'\fBHJKLBNYU\fP\ \ 'u
-\fBh\fP move one square left
-\fBl\fP move one square right
-\fBk\fP move one square up
-\fBj\fP move one square down
-\fBy\fP move one square up and left
-\fBu\fP move one square up and right
-\fBb\fP move one square down and left
-\fBn\fP move one square down and right
-\fB\&.\fP (also space) do nothing for one turn
-\fBHJKLBNYU\fP run as far as possible in the given direction
-\fB>\fP do nothing for as long as possible
-\fBt\fP teleport to a random location
-\fBw\fP wait until you die or they all do
-\fBq\fP quit
-\fB^L\fP redraw the screen
-.sp
-.fi
-All commands can be preceded by a count.
-.PP
-If you use the
-.RB ` w '
-command and survive to the next level, you will get a bonus of 10%
-for each robot which died after you decided to wait.
-If you die, however, you get nothing.
-For all other commands, the program will save you from typos
-by stopping short of being eaten.
-However, with
-.RB ` w '
-you take the risk of dying by miscalculation.
-.PP
-Only five scores are allowed per user on the score file.
-If you make it into the score file, you will be shown the list at the end
-of the game.
-If an alternate score file is specified, that will be used instead of the
-standard file for scores.
-.PP
-The options are
-.TP
-.B \-s
-Don't play, just show the score file.
-.TP
-.B \-j
-Jump,
-.IR i.e. ,
-when you run, don't show any intermediate positions; only show things at
-the end.
-This is useful on slow terminals.
-.TP
-.B \-t
-Teleport automatically when you have no other option.
-This is a little disconcerting until you get used to it, and then it is
-very nice.
-.TP
-.B \-a
-Advance into the higher levels directly, skipping the lower, easier levels.
-.SH AUTHOR
-Ken Arnold
-.SH FILES
-.ta
-.ta \w'/var/games/robots_roll\ \ \ \ 'u
-/var/games/robots_roll the score file
-.SH BUGS
-Bugs?
-You
-.IR crazy ,
-man?!?
diff --git a/games/robots/robots.h b/games/robots/robots.h
deleted file mode 100644
index 0139a1d..0000000
--- a/games/robots/robots.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)robots.h 8.1 (Berkeley) 5/31/93
- */
-
-# include <curses.h>
-# include <setjmp.h>
-
-/*
- * miscellaneous constants
- */
-
-# define Y_FIELDSIZE 23
-# define X_FIELDSIZE 60
-# define Y_SIZE 24
-# define X_SIZE 80
-# define MAXLEVELS 4
-# define MAXROBOTS (MAXLEVELS * 10)
-# define ROB_SCORE 10
-# define S_BONUS (60 * ROB_SCORE)
-# define Y_SCORE 21
-# define X_SCORE (X_FIELDSIZE + 9)
-# define Y_PROMPT (Y_FIELDSIZE - 1)
-# define X_PROMPT (X_FIELDSIZE + 2)
-# define MAXSCORES (Y_SIZE - 2)
-# define MAXNAME 16
-# define MS_NAME "Ten"
-
-/*
- * characters on screen
- */
-
-# define ROBOT '+'
-# define HEAP '*'
-# define PLAYER '@'
-
-/*
- * type definitions
- */
-
-typedef struct {
- int y, x;
-} COORD;
-
-/*
- * global variables
- */
-
-extern bool Dead, Full_clear, Jump, Newscore, Real_time, Running,
- Teleport, Waiting, Was_bonus;
-
-#ifdef FANCY
-extern bool Pattern_roll, Stand_still;
-#endif
-
-extern char Cnt_move, Field[Y_FIELDSIZE][X_FIELDSIZE], *Next_move,
- *Move_list, Run_ch;
-
-extern int Count, Level, Num_robots, Num_scores, Score,
- Start_level, Wait_bonus;
-
-extern COORD Max, Min, My_pos, Robots[];
-
-extern jmp_buf End_move;
-
-/*
- * functions types
- */
-
-int cmp_sc();
-void move_robots();
-
-COORD *rnd_pos();
-
-
-
-
diff --git a/games/robots/score.c b/games/robots/score.c
deleted file mode 100644
index 21fadf5..0000000
--- a/games/robots/score.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 1980, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-# include "robots.h"
-# include <sys/types.h>
-# include <pwd.h>
-# include "pathnames.h"
-
-typedef struct {
- int s_uid;
- int s_score;
- char s_name[MAXNAME];
-} SCORE;
-
-typedef struct passwd PASSWD;
-
-char *Scorefile = _PATH_SCORE;
-
-int Max_per_uid = MAX_PER_UID;
-
-static SCORE Top[MAXSCORES];
-
-/*
- * score:
- * Post the player's score, if reasonable, and then print out the
- * top list.
- */
-score()
-{
- int inf;
- SCORE *scp;
- int uid;
- bool done_show = FALSE;
- static int numscores, max_uid;
-
- Newscore = FALSE;
- if ((inf = open(Scorefile, 2)) < 0) {
- perror(Scorefile);
- return;
- }
-
- if (read(inf, &max_uid, sizeof max_uid) == sizeof max_uid)
- read(inf, Top, sizeof Top);
- else {
- for (scp = Top; scp < &Top[MAXSCORES]; scp++)
- scp->s_score = -1;
- max_uid = Max_per_uid;
- }
-
- uid = getuid();
- if (Top[MAXSCORES-1].s_score <= Score) {
- numscores = 0;
- for (scp = Top; scp < &Top[MAXSCORES]; scp++)
- if (scp->s_score < 0 ||
- (scp->s_uid == uid && ++numscores == max_uid)) {
- if (scp->s_score > Score)
- break;
- scp->s_score = Score;
- scp->s_uid = uid;
- set_name(scp);
- Newscore = TRUE;
- break;
- }
- if (scp == &Top[MAXSCORES]) {
- Top[MAXSCORES-1].s_score = Score;
- Top[MAXSCORES-1].s_uid = uid;
- set_name(&Top[MAXSCORES-1]);
- Newscore = TRUE;
- }
- if (Newscore)
- qsort(Top, MAXSCORES, sizeof Top[0], cmp_sc);
- }
-
- if (!Newscore) {
- Full_clear = FALSE;
- close(inf);
- return;
- }
- else
- Full_clear = TRUE;
-
- for (scp = Top; scp < &Top[MAXSCORES]; scp++) {
- if (scp->s_score < 0)
- break;
- move((scp - Top) + 1, 15);
- if (!done_show && scp->s_uid == uid && scp->s_score == Score)
- standout();
- printw(" %d\t%d\t%-8.8s ", (scp - Top) + 1, scp->s_score, scp->s_name);
- if (!done_show && scp->s_uid == uid && scp->s_score == Score) {
- standend();
- done_show = TRUE;
- }
- }
- Num_scores = scp - Top;
- refresh();
-
- if (Newscore) {
- lseek(inf, 0L, 0);
- write(inf, &max_uid, sizeof max_uid);
- write(inf, Top, sizeof Top);
- }
- close(inf);
-}
-
-set_name(scp)
-SCORE *scp;
-{
- PASSWD *pp;
-
- if ((pp = getpwuid(scp->s_uid)) == NULL)
- pp->pw_name = "???";
- strncpy(scp->s_name, pp->pw_name, MAXNAME);
-}
-
-/*
- * cmp_sc:
- * Compare two scores.
- */
-cmp_sc(s1, s2)
-SCORE *s1, *s2;
-{
- return s2->s_score - s1->s_score;
-}
-
-/*
- * show_score:
- * Show the score list for the '-s' option.
- */
-show_score()
-{
- SCORE *scp;
- int inf;
- static int max_score;
-
- if ((inf = open(Scorefile, 0)) < 0) {
- perror(Scorefile);
- return;
- }
-
- for (scp = Top; scp < &Top[MAXSCORES]; scp++)
- scp->s_score = -1;
-
- read(inf, &max_score, sizeof max_score);
- read(inf, Top, sizeof Top);
- close(inf);
- inf = 1;
- for (scp = Top; scp < &Top[MAXSCORES]; scp++)
- if (scp->s_score >= 0)
- printf("%d\t%d\t%.*s\n", inf++, scp->s_score,
- (int)sizeof(scp->s_name), scp->s_name);
-}
OpenPOWER on IntegriCloud