[net.games.rogue] Nonexistent patterns in random numbers

flinn@seismo.UUCP (E. A. Flinn) (12/11/83)

>    I am sorry to disallusion you, but the "hidden characteristrics",
>    (INT, CON, etc.), are so well hidden, you cannot find them in the
>    code.    Luck is such an amazing thing, people just will not believe
>    that they are having a run of it, for good, or for bad.

Steven Maurer

Maurer is right in that people insist on seeing patterns in
random numbers.  Teddy Bullard, an English geophysicist who had been a
student of Rutherford's, said that when Rutherford discovered the
alpha particle, he was convinced that there were patterns, both in
space and time, of the flashes of light on the crt; apparently
Rutherford spent many hours recording times and places of the flashes,
and it was only with the greatest reluctance that he finally discarded
the idea.

I've sometimes been tempted to think I was on a lucky roll after
killing several H's with one tap on level 1, only to be creamed by
a lowly B or J.

amg@pyuxn.UUCP (12/13/83)

Yes, I'm sure people see patterns in random numbers, but let us not
forget that we are dealing with pseudo-random numbers, and I have seen
comments about how bad the rogue random number generator is (no data,
though).  The patterns we see in rogue might well be a combination of
nonrandomness added to our natural pattern-making abilities.

			Alan M. Gross
			pyuxn!amg

robison@eosp1.UUCP (Tobias D. Robison) (12/13/83)

I'm fascinated to discover that INT, CON, and DEX don't exist in the
rogue source, so of course I have been making them up.  Nonetheless
THEY DO HELP!!  I Also suspect that the random numbrs are not as random
as they should be  (but I really thought INT, CON and DEX existed in
Rogue, yes I did).  Here is another one -- I know this doesn't
exist in the source (Ken Arnold told me so), but I am convinced that
I have avoided many a loss of strength by following this theory:

	Ants are directional.  In each game, for each class of armor,
	they are more likely to sting you in some directions than
	others.  If an ant stings you, don't attack subsequent ants
	from the same direction.  {Now here it comes, please don't
	laugh too hard at the last sentence of this theory} A few
	superants will sting you no matter what you do; don't let them
	discourage you from following this theory.

				- Keremath,  care of:
				  Robison
			          decvax!ittvax!eosp1
				  or:   allegra!eosp1

riddle@ut-sally.UUCP (Prentiss Riddle) (12/15/83)

Not only do people insist on seeing patterns in random numbers, but the
converse is also true:  when people try to create a sequence of random
numbers, they usually insist on building patterns into it.

Years ago, the magazine "Creative Computing" published a rather simple-
minded program to demonstrate this.  It asked the user to pretend that
s/he was repeatedly flipping a coin.  The program would try to antici-
pate each "h" or "t" entered by the user.  The number of correct guesses
was expressed as a percentage; with a large number of guesses, the score
would almost always stabilize well above 50%.

For what it's worth, here is my re-creation of that "Creative Computing"
program.  If you work at it, it's quite easy to outwit the program, but
if you stick with the premise that it's trying to test (i.e., just imagine
that you're flipping a coin), you'll probably find that your flips are
anything but random.

--------------------------------------------------------------------------

/*  guess - heads/tails guesser		12/14/83
 *
 *  Guess is intended to demonstrate that human beings are poor random
 *  number generators.  The model for this program appeared in an old
 *  (ca. 1975?) issue of "Creative Computing".
 *
 *  Compilation: "cc -o guess guess.c"
 *
 *  Author:  Prentiss Riddle  (...{ihnp4,seismo,ctvax}!ut-sally!riddle)
 */

#include <signal.h>

#define CBREAKON  "stty cbreak"  /* system command to turn on cbreak mode */
#define CBREAKOFF "stty -cbreak" /* system command to turn off cbreak mode */

#define HEADS    1
#define TAILS    0


main ()

{
    int  flipit();           /* flip a coin */
    int  quit();             /* exit routine */

    static
    int  history[2][2][2] = {{{0,0},{0,0}},{{0,0},{0,0}}};
                             /* history -- three flips of heads/tails */
    int  f1, f2, f3;         /* three flips determining current state */
    int  flip;               /* user's flip */
    int  guess;              /* computer's guess */
    int  fcount = 0;         /* flip count */
    int  score = 0;          /* flips correctly guessed by computer */
    char c;                  /* user input */
    long seed;               /* seed for random number generator */

    /* set up interrupt handling and cbreak mode */
    signal (SIGINT, quit);
    system (CBREAKON);

    /* randomize initial state */
    seed = getpid() + 1984;
    f1 = flipit(&seed);
    f2 = flipit(&seed);
    f3 = flipit(&seed);

    while (1) {

        /* perform guess */
        if (history[f1][f2][f3] > 0)
            guess = HEADS;
        else if (history[f1][f2][f3] < 0)
            guess = TAILS;
        else guess = flipit(&seed);

        /* read user's flip */
        do {
            printf ("h(eads),t(ails),q(uit):");
            c = getchar();
            switch (c) {
                case 'h':
                    flip = HEADS;
                    break;
                case 't':
                    flip = TAILS;
                    break;
                case 'q':
                case '\0': /* control D */
                    putchar('\n');
                    quit();
                    break;
                default:
                    putchar('\n');
                    flip = -1;
                    break;
            }
        } while (flip == -1);

        /* update score */
        ++fcount;
        if (flip == guess)
            ++score;

        /* update history */
        switch (flip) {
            case HEADS:
                ++history[f1][f2][f3];
                break;
            case TAILS:
                --history[f1][f2][f3];
                break;
        }
        f1 = f2;
        f2 = f3;
        f3 = flip;

        printf ("    my guess:%c  my score: %d out of %d (%2d%%)\n",
                ((guess == HEADS) ? 'h' : 't'), score, fcount,
                (int) (((float) score / (float) fcount) * 100.0 + 0.5) );
    }

}


int flipit (seed)       /* flip a coin */

/* random number generator taken from Grogono p. 119 */

long *seed;	/* seed for random number generation */
{
    *seed = ( 25173 * *seed + 13849 ) % 65536;
    return (((((double) *seed) / 65536) > 0.5) ? HEADS : TAILS) ;
}


quit ()             /* fix terminal back up and exit */
{
    /* turn off further interrupts */
    signal (SIGINT, SIG_IGN);

    /* turn off cbreak mode */
    system (CBREAKOFF);

    /* bye-bye */
    putchar ('\n');
    exit (0);
}
--------------------------------------------------------------------------
Prentiss Riddle
{ihnp4,seismo,ctvax}!ut-sally!riddle