---

REM Sat 22 Nov 97 22:54
REM By: mkimes@ibm.net (Mark Kimes)
REM To: William Putnam
REM
REM wp> Your "52 cards" is reminiscent of another anecdote: The case
REM wp> of the "Disassembled watch parts in a box."  How long must you
REM wp> shake to get the parts to randomly fall into perfect place
REM wp> and reassemble the watch?
REM
REM Depends -- do parts that wind up in the right place get retained?
REM Run this program, which fills a 100 part array with the number
REM corresponding to its index at random, either with (naturalselection
REM = 1) or without (naturalselection = 0) "natural selection":

    CLS
    PRINT "Fundy bopper."
    naturalselection = 1
    DIM a(100)

    SLEEP(1)

    RANDOMIZE TIMER

    z = 0

STARTOVER:
    FOR x = 1 TO 100
        IF naturalselection <> 0 AND a(x) = x THEN GOTO DONEXT
        PRINT x
TRYAGAIN:
        y = INT((RND(1) * 100) + 1)
        IF y <> x THEN z = z + 1
        IF naturalselection <> 0 AND y <> x THEN GOTO TRYAGAIN
        a(x) = y
DONEXT:
    NEXT

    FOR x = 1 TO 100
        IF a(x) <> x THEN GOTO STARTOVER
    NEXT

    PRINT
    PRINT z; "random choices required with";
    IF naturalselection = 0 THEN PRINT "out";
    PRINT " natural selection."

REM Don't bother waiting for a run with naturalselection = 0 on
REM line 5 to complete... [That's without having the program employ
REM natural selection; that would take a long, long time to run to
REM completion. - flr]


And for people who don't like that, Eddy L O Jansson offers the following:

Program FundyBopper; { Original by Mark Kimes }

CONST
 NaturalSelection               :Boolean = TRUE;
 Timescale                      = 100;

VAR
 A                              :Array[1..Timescale] of Word;
 Z                              :LongInt; { This will wrap anyway }
 X,Y                            :Word;
 Done                           :Boolean;

BEGIN
 Randomize;
 Done:=FALSE;
 z:=0;

While NOT Done do
begin
 for x:=1 to Timescale do
  begin
   if NOT ((NaturalSelection) and (A[x]=x)) then
    begin
     REPEAT
      y:=Random(Timescale)+1;
      if (y<>x) then Inc(z);
     UNTIL NOT ((NaturalSelection) and (y<>x));
     A[x]:=y;
    end;
  end;
  for x:=1 to Timescale do if a[x]<>x then Break; { Optimization ... }
  if x=Timescale then Done:=TRUE; { ... Scope could be compiler-specific? }
  if z mod Timescale*1000=0 then
   WriteLn(z,' choices made.'); { Keep fundie hooked }
end;
 Write(z,' random choices required with');
 if NOT NaturalSelection then Write('out');
 WriteLn(' natural selection.');
END.

---

The views and opinions stated within this web page are those of the author or authors which wrote them and may not reflect the views and opinions of the ISP or account user which hosts the web page.

Return to The Skeptic Tank's main Index page.

E-Mail Fredric L. Rice / The Skeptic Tank