copy in from cvs; cvs2svn fucked up big time

git-svn-id: file:///srv/svn/joey/trunk/src/packages/bsdgames@9775 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
joey
2003-12-19 19:12:08 +00:00
parent 351c8ca204
commit 51eabc017b
310 changed files with 7852 additions and 5005 deletions

View File

@@ -1,10 +1,14 @@
# $NetBSD: Makefile,v 1.8 1997/03/24 22:15:42 christos Exp $
# $NetBSD: Makefile,v 1.10 1999/02/13 02:54:21 lukem Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
.include <bsd.own.mk>
PROG= fish
MAN= fish.6
HIDEGAME=hidegame
.if ${MKSHARE} != "no"
FILES=fish.instr
FILESDIR=/usr/share/games
.endif
.include <bsd.prog.mk>

View File

@@ -1,4 +1,30 @@
# Makefrag - makefile fragment for fish
#
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
# 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. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
fish_DIRS := $(GAMESDIR) $(MAN6DIR) $(shell dirname $(FISH_INSTRFILE))

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: fish.6,v 1.5 1997/10/10 12:58:29 lukem Exp $
.\" $NetBSD: fish.6,v 1.7 2001/04/02 22:42:38 wiz Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -34,11 +34,12 @@
.\" @(#)fish.6 8.1 (Berkeley) 5/31/93
.\"
.Dd May 31, 1993
.Dt FISH 6
.Dt FISH 6
.Os
.Sh NAME
.Nm fish
.Nd play ``Go Fish''
.Nm fish
.Nd play
.Dq Go Fish
.Sh SYNOPSIS
.Nm
.Op Fl p
@@ -50,10 +51,10 @@ a traditional children's card game.
.Pp
The computer deals the player and itself seven cards, and places
the rest of the deck face-down (figuratively).
The object of the game is to collect
The object of the game is to collect
.Dq books ,
or all of the members of a single rank.
For example, collecting four 2's would give the player a
For example, collecting four 2's would give the player a
.Dq book of 2's .
.Pp
The options are as follows:
@@ -70,7 +71,7 @@ them up to the asking player.
A player must have at least one of the cards of the rank they request
in their hand.
When a player asks for a rank of which the other player has no
cards, the asker is told to
cards, the asker is told to
.Dq Go Fish! .
Then, the asker draws a card from the non-dealt cards.
If they draw the card they asked for, they continue their turn, asking

View File

@@ -1,4 +1,4 @@
/* $NetBSD: fish.c,v 1.6 1998/09/13 15:27:27 hubertf Exp $ */
/* $NetBSD: fish.c,v 1.13 2000/05/08 07:56:03 mycroft Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: fish.c,v 1.6 1998/09/13 15:27:27 hubertf Exp $");
__RCSID("$NetBSD: fish.c,v 1.13 2000/05/08 07:56:03 mycroft Exp $");
#endif
#endif /* not lint */
@@ -65,6 +65,7 @@ __RCSID("$NetBSD: fish.c,v 1.6 1998/09/13 15:27:27 hubertf Exp $");
#define RANKS 13
#define HANDSIZE 7
#define CARDS 4
#define TOTCARDS RANKS * CARDS
#define USER 1
#define COMPUTER 0
@@ -77,8 +78,9 @@ const char *const cards[] = {
#define PRC(card) (void)printf(" %s", cards[card])
int promode;
int asked[RANKS], comphand[RANKS], deck[RANKS];
int asked[RANKS], comphand[RANKS], deck[TOTCARDS];
int userasked[RANKS], userhand[RANKS];
int curcard = TOTCARDS;
void chkwinner __P((int, const int *));
int compmove __P((void));
@@ -164,13 +166,13 @@ usermove()
for (;;) {
(void)printf("You ask me for: ");
(void)fflush(stdout);
if (fgets(buf, BUFSIZ, stdin) == NULL)
if (fgets(buf, sizeof(buf), stdin) == NULL)
exit(0);
if (buf[0] == '\0')
continue;
if (buf[0] == '\n') {
(void)printf("%d cards in my hand, %d in the pool.\n",
countcards(comphand), countcards(deck));
countcards(comphand), curcard);
(void)printf("My books:");
(void)countbooks(comphand);
continue;
@@ -270,9 +272,7 @@ drawcard(player, hand)
{
int card;
while (deck[card = nrandom(RANKS)] == 0);
++hand[card];
--deck[card];
++hand[card = deck[--curcard]];
if (player == USER || hand[card] == CARDS) {
printplayer(player);
(void)printf("drew %s", cards[card]);
@@ -423,19 +423,21 @@ countbooks(hand)
void
init()
{
int i, rank;
int i, j, temp;
for (i = 0; i < RANKS; ++i)
deck[i] = CARDS;
for (i = 0; i < HANDSIZE; ++i) {
while (!deck[rank = nrandom(RANKS)]);
++userhand[rank];
--deck[rank];
for (i = 0; i < TOTCARDS; ++i)
deck[i] = i % RANKS;
for (i = 0; i < TOTCARDS - 1; ++i) {
j = nrandom(TOTCARDS-i);
if (j == 0)
continue;
temp = deck[i];
deck[i] = deck[i+j];
deck[i+j] = temp;
}
for (i = 0; i < HANDSIZE; ++i) {
while (!deck[rank = nrandom(RANKS)]);
++comphand[rank];
--deck[rank];
++userhand[deck[--curcard]];
++comphand[deck[--curcard]];
}
}