[net.games.rogue] Rogue 5.3 Source

ARPAVAX:reeds (09/19/82)

I consider Ken Arnold's public submission for the source of his long-awaited
rogue 5.3 to net.sources, viz:
	
	main()
	{
		srand(getpid());
		sleep((rand() % 120) * 60);
		if ((rand() % 1000000) == 0)
			printf("You Win!\n");
		else
			printf("You Loose.\n");
		exit(0);
	}
to be cruel and unusual, for this reason:

As soon as I read this code I set about devising a rascally way to cheat.
So I asked myself, which values of getpid() will luck out?  So I wrote a
little program of my own:
	main() {
		int pid;

		for(pid=0; pid<=30000; pid++) {
			srand(pid);
			rand();
			if((rand() % 1000000) == 0)
				printf("pid = %d\n", pid);
		}
	}
I found it made NO OUTPUT.  A few hours of reflection told me that this
meant that Arnold's latest could be rewritten to read:
	main()
	{
		srand(getpid());
		sleep((rand() % 120) * 60);
		printf("You Loose.\n");
		exit(0);
	}
without changing any observable program behavior.
At last Arnold has written a cheat-proof version of rogue.  RATS! PHOOIE!!

Jim Reeds