* Copyright (c) 1988 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
"@(#) Copyright (c) 1988 The Regents of the University of California.\n\
static char sccsid
[] = "@(#)ching.cno.c 5.1 (Berkeley) %G%";
* cno - Read a question, cast a change, and output the line values to the
* standard output for processing by "phx".
long now
; /* current time */
unsigned seed
; /* seed for random number generator */
char string
[6+1]; /* where the actual change string is put */
{ { OYIN
, YYANG
,}, { YYANG
, YYIN
,} },
{ { YYANG
, YYIN
,}, { YYIN
, OYANG
,} },
seed
= (int)now
+ getquest() + getgid() + getuid() + getpid(); /* randomize */
printf("%s\n", change());
if ((logf
= fopen("log", "a")) != (FILE *)NULL
) {
fprintf(logf
, "%s\t%s", string
, ctime(&now
));
* Hash the question by adding all the characters together.
while ((c
= getchar()) != EOF
)
* Get a set of six lines making up a change.
string
[i
] = table
[getrnum()&01][getrnum()&01][getrnum()&01] + '0';
* Get a number more random than what getrand() gives.
return((getrand())>>(getrand()%17));
return(seed
= (seed
*13077) + 6925);