mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
Stop people from cheating. Especially those that believe in FIPS, they
are the worst. ok millert ingo tedu
This commit is contained in:
parent
ab2d8696bc
commit
1e1477420a
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bog.c,v 1.23 2014/10/11 03:58:11 doug Exp $ */
|
||||
/* $OpenBSD: bog.c,v 1.24 2014/12/04 06:12:33 deraadt Exp $ */
|
||||
/* $NetBSD: bog.c,v 1.5 1995/04/24 12:22:32 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -88,14 +88,14 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch, done;
|
||||
char *bspec, *p, *seed;
|
||||
char *bspec, *p;
|
||||
|
||||
batch = debug = reuse = selfuse;
|
||||
bspec = seed = NULL;
|
||||
bspec = NULL;
|
||||
minlength = -1;
|
||||
tlimit = 180; /* 3 minutes is standard */
|
||||
|
||||
while ((ch = getopt(argc, argv, "Bbcds:t:w:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "Bbcdt:w:")) != -1)
|
||||
switch(ch) {
|
||||
case 'B':
|
||||
grid = 5;
|
||||
@ -109,9 +109,6 @@ main(int argc, char *argv[])
|
||||
case 'd':
|
||||
debug = 1;
|
||||
break;
|
||||
case 's':
|
||||
seed = optarg;
|
||||
break;
|
||||
case 't':
|
||||
if ((tlimit = atoi(optarg)) < 1)
|
||||
errx(1, "bad time limit");
|
||||
@ -163,7 +160,7 @@ main(int argc, char *argv[])
|
||||
(void) printf("%s\n", p);
|
||||
exit(0);
|
||||
}
|
||||
setup(seed);
|
||||
setup();
|
||||
prompt("Loading the dictionary...");
|
||||
if ((dictfp = opendict(DICT)) == NULL) {
|
||||
warn("%s", DICT);
|
||||
@ -606,7 +603,7 @@ newgame(char *b)
|
||||
/* Shuffle the cubes using Fisher-Yates (aka Knuth P). */
|
||||
p = ncubes;
|
||||
while (--p) {
|
||||
q = (int)random() % (p + 1);
|
||||
q = (int)arc4random_uniform(p + 1);
|
||||
tmp = cubes[p];
|
||||
cubes[p] = cubes[q];
|
||||
cubes[q] = tmp;
|
||||
@ -614,15 +611,15 @@ newgame(char *b)
|
||||
|
||||
/* Build the board by rolling each cube. */
|
||||
for (i = 0; i < ncubes; i++)
|
||||
board[i] = cubes[i][random() % 6];
|
||||
board[i] = cubes[i][arc4random_uniform(6)];
|
||||
|
||||
/*
|
||||
* For challenge mode, roll chal_cube and replace a random
|
||||
* cube with its value. Set the high bit to distinguish it.
|
||||
*/
|
||||
if (challenge) {
|
||||
i = random() % ncubes;
|
||||
board[i] = SETHI(chal_cube[random() % 6]);
|
||||
i = arc4random_uniform(ncubes);
|
||||
board[i] = SETHI(chal_cube[arc4random_uniform(6)]);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < ncubes; i++)
|
||||
@ -756,7 +753,7 @@ usage(void)
|
||||
extern char *__progname;
|
||||
|
||||
(void) fprintf(stderr, "usage: "
|
||||
"%s [-Bbcd] [-s seed] [-t time] [-w length] [+[+]] [boardspec]\n",
|
||||
"%s [-Bbcd] [-t time] [-w length] [+[+]] [boardspec]\n",
|
||||
__progname);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: boggle.6,v 1.19 2014/09/28 07:53:02 schwarze Exp $
|
||||
.\" $OpenBSD: boggle.6,v 1.20 2014/12/04 06:12:33 deraadt Exp $
|
||||
.\" $NetBSD: boggle.6,v 1.2 1995/03/21 12:14:35 cgd Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997, Jason Downs. All rights reserved.
|
||||
@ -56,7 +56,7 @@
|
||||
.\"
|
||||
.\" @(#)boggle.6 8.1 (Berkeley) 6/11/93
|
||||
.\"
|
||||
.Dd $Mdocdate: September 28 2014 $
|
||||
.Dd $Mdocdate: December 4 2014 $
|
||||
.Dt BOGGLE 6
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -65,7 +65,6 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm boggle
|
||||
.Op Fl Bbcd
|
||||
.Op Fl s Ar seed
|
||||
.Op Fl t Ar time
|
||||
.Op Fl w Ar length
|
||||
.Op Ar + Ns Op Ar +
|
||||
@ -114,11 +113,6 @@ Depending on the terminal capabilities, it may be displayed in
|
||||
underline or a different color (such as red).
|
||||
.It Fl d
|
||||
Enable debugging output.
|
||||
.It Fl s Ar seed
|
||||
Prime the random number generator with
|
||||
.Ar seed
|
||||
instead of data from
|
||||
.Pa /dev/arandom .
|
||||
.It Fl t Ar time
|
||||
Change the time limit for each game from the default 3 minutes to
|
||||
.Ar time
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: extern.h,v 1.7 2012/03/04 04:05:15 fgsch Exp $ */
|
||||
/* $OpenBSD: extern.h,v 1.8 2014/12/04 06:12:33 deraadt Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.3 1995/04/24 12:22:37 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -58,7 +58,7 @@ void prtable(char *[],
|
||||
void putstr(char *);
|
||||
void redraw(void);
|
||||
void results(void);
|
||||
int setup(char *);
|
||||
int setup(void);
|
||||
void showboard(char *);
|
||||
void showstr(char *, int);
|
||||
void showword(int);
|
||||
|
@ -20,13 +20,12 @@ Any time you are prompted while the board is displayed you can type:
|
||||
to see where "word" is on the board.
|
||||
|
||||
Usage:
|
||||
boggle [-Bbcd] [-s seed] [-t time] [-w length] [+[+]] [boardspec]
|
||||
boggle [-Bbcd] [-t time] [-w length] [+[+]] [boardspec]
|
||||
|
||||
-B: big boggle mode, uses a 5x5 board
|
||||
-b: batch mode (boardspec must be present); dictionary read from stdin
|
||||
-c: a challenge cube will be added to the board
|
||||
-d: debug mode
|
||||
-s seed: use "seed" as the random number seed
|
||||
-t time: time limit in seconds instead of default 180
|
||||
-w length: minimum word length in letters instead of default 3
|
||||
+: can reuse a cube, but not twice in succession
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mach.c,v 1.13 2012/03/04 04:05:15 fgsch Exp $ */
|
||||
/* $OpenBSD: mach.c,v 1.14 2014/12/04 06:12:33 deraadt Exp $ */
|
||||
/* $NetBSD: mach.c,v 1.5 1995/04/28 22:28:48 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
@ -94,18 +94,13 @@ static void winch_catcher(int);
|
||||
* This is called once, when the program starts
|
||||
*/
|
||||
int
|
||||
setup(char *seed)
|
||||
setup(void)
|
||||
{
|
||||
char *cp, *ep;
|
||||
|
||||
if (tty_setup() < 0)
|
||||
return(-1);
|
||||
|
||||
if (seed != NULL)
|
||||
srandom(atol(seed));
|
||||
else
|
||||
srandomdev();
|
||||
|
||||
separator = malloc(4 * grid + 2);
|
||||
if (separator == NULL)
|
||||
err(1, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user