Guess My Number
#11
Binary Sequence Predictor "game"?
https://qb64forum.alephc.xyz/index.php?t...#msg140722
Reply #29 on: February 17, 2022

shuffle and make sure that number does not take its place
so far without control has array become binomially better

we create an array of numbers in a row
and in 1 pass we rearrange serial number and a random number
and if numbers of rearranged ones match: spinning line is my handwriting

check array and if there are numbers in their places:
we count number and write array as defective
marking matched ones with a minus sign

first and last numbers are displayed on screen but it is possible to write everything to file

how to copy text results from window is unknown therefore:
picture shows: 9 numbers were qualitatively shuffled from 6th attempt
in 0 seconds

next I plan to calculate whether sequence has become truly random
and apparently I will have to switch to index indexes as excel cells

result is visible if saved to disk or ram disk
between cells at least 10%
and number of repeated shuffles: up to 25% of array length


Code: (Select All)
    a = 100: DIM d(a): x=0: k=0: t$=CHR$(9): RANDOMIZE TIMER 'tas_ten.bas
    PRINT ,: FOR i = 1 TO a: d(i)=i: NEXT
    FOR i = 1 TO 5: PRINT d(i);: NEXT: PRINT ,
    FOR i = a-3 TO a: PRINT d(i);: NEXT: z = TIMER
    OPEN "control.txt" FOR OUTPUT AS #1

WHILE x < 1
v = 0: FOR i = 1 TO a

1 m = INT(RND*a)+1: IF ABS(d(i)-d(m)) < .1*a THEN v = v+1: GOTO 1

PRINT #1, ABS(d(i)-d(m)); t$; d(i); t$; d(m); t$; i; t$; m; t$; d(i)/d(m); t$; d(m)/d(i)
t = d(i): d(i) = d(m): d(m) = t
NEXT   
        s = 0: FOR i = 1 TO a
            IF d(i) = i THEN s = s+1
        NEXT

       5 k = k+1: PRINT: PRINT s; v,: IF s=0 THEN x = x+1
     
        FOR i = 1 TO 5
            IF d(i) = i THEN PRINT -d(i); ELSE PRINT d(i);
        NEXT: PRINT ,
        FOR i = a-3 TO a
            IF d(i) = i THEN PRINT -d(i); ELSE PRINT d(i);
        NEXT
WEND

PRINT: PRINT "    = "; k, TIMER-z: END

result control: open control.txt in notepad and search 1.0
as ratio is less than 10% and desired is missing
this means that elements are shuffled at a distance of at least 10% of array from each other

Code: (Select All)
 41     70     29     91     18     2.413793     .4142857
59     24     83     92     38     .2891566     3.458333
14     32     46     93     44     .6956522     1.4375
23     10     33     94     88     .3030303     3.3
29     19     48     95     36     .3958333     2.526316
11     41     30     96     11     1.366667     .7317073
38     1     39     97     21     2.564103E-02     39
60     26     86     98     55     .3023256     3.307692
17     4     21     99     58     .1904762     5.25
26     100     74     100     59     1.351351     .74

I think this mine long-standing development
will help synthesize high-quality random
Write name of program in 1st line to copy & paste & save filename.bas
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic

Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself
Reply


Messages In This Thread
Guess My Number - by SierraKen - 09-18-2022, 11:04 PM
RE: Guess My Number - by PhilOfPerth - 09-18-2022, 11:11 PM
RE: Guess My Number - by bplus - 09-19-2022, 12:25 AM
RE: Guess My Number - by SierraKen - 09-20-2022, 09:23 PM
RE: Guess My Number - by DANILIN - 09-25-2022, 12:47 PM
RE: Guess My Number - by mnrvovrfc - 09-25-2022, 05:21 PM
RE: Guess My Number - by SierraKen - 09-25-2022, 08:21 PM
RE: Guess My Number - by mnrvovrfc - 09-26-2022, 05:16 AM
RE: Guess My Number - by SierraKen - 09-25-2022, 08:24 PM
RE: Guess My Number - by DANILIN - 11-07-2022, 10:45 AM
RE: Guess My Number - by DANILIN - 02-23-2023, 02:45 AM
RE: Guess My Number - by Sprezzo - 02-24-2023, 02:33 PM
RE: Guess My Number - by DANILIN - 02-24-2023, 04:22 PM
RE: Guess My Number - by bplus - 02-24-2023, 04:36 PM
RE: Guess My Number - by DANILIN - 02-24-2023, 04:52 PM
RE: Guess My Number - by bplus - 02-24-2023, 05:09 PM
RE: Guess My Number - by DANILIN - 04-04-2023, 08:35 AM
RE: Guess My Number - by SMcNeill - 04-04-2023, 10:58 AM
RE: Guess My Number - by DANILIN - 05-20-2023, 03:36 AM



Users browsing this thread: 4 Guest(s)