Author Topic: Russian Sorting Halves Danilin  (Read 13334 times)

0 Members and 1 Guest are viewing this topic.

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #15 on: October 28, 2018, 12:32:58 pm »
files are convenient for testing
to create an array of same array
on disk according to certain laws

and there is an additional program synthesizing
for testing array of species thresholds
convenient for comparing with natural sorting
understandable 99% of people

? What sorting is being studied in school?
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Russian Sorting Halves Danilin
« Reply #16 on: October 28, 2018, 12:55:09 pm »
files are convenient for testing
to create an array of same array
on disk according to certain laws

and there is an additional program synthesizing
for testing array of species thresholds
convenient for comparing with natural sorting
understandable 99% of people

? What sorting is being studied in school?

I am not in school, haven't been for years, so can't say what they are studying.

Quote
files are convenient for testing
to create an array of same array
on disk according to certain laws

This in only True if you supply the file of data so people can compare their code methods to it. Otherwise you might be accused of setting up a Straw Man argument.

When testing sort methods your comparisons would be so much better if they weren't based on times on your machine.
Compare times one method takes on your machine to time another method takes on your machine THEN you can say how much faster one method is to another on your machine.

Code: QB64: [Select]
  1. MethodOneOverMethodTwo = TimeOfMethodOne / TimeOfMethodTwo
  2. PRINT "MethodOne takes "; MethodOneOverMethodTwo;" times longer than MethodTwo."



« Last Edit: October 28, 2018, 01:05:15 pm by bplus »

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #17 on: October 28, 2018, 01:13:08 pm »
thresholds make cases unfavorable for sorting.
and are designated in configuration by numbers 0 ... 9

for example in column 9375 or 8642
creating an array unprofitable bubble sort

however for Russian sorting halves
any array is same as what was found out
after writing program and after hundreds of comparisons

? why we do not see in topic of comparison with a bubble?



  [ You are not allowed to view this attachment ]  
« Last Edit: October 28, 2018, 01:18:19 pm by DANILIN »
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Russian Sorting Halves Danilin
« Reply #18 on: October 28, 2018, 01:21:32 pm »
Believe me, this RussianSort Method has nothing over QSort, nothing! Why do you keep bringing up Bubble Sort, more crap!

This snip taken from that method makes it impossible to use with Strings:
Code: QB64: [Select]
  1. FOR i = ab TO yz
  2.     summa = summa + d(i)
  3. middle = summa / (yz - ab + 1)
  4.  
PLUS! you have to be careful not to exceed the type limit!!!

You are adding up all the values in the array you are sorting? WTH?
« Last Edit: October 28, 2018, 01:23:16 pm by bplus »

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #19 on: October 28, 2018, 01:37:23 pm »
we read: "nothing over QSort"
fuller: "nothing over QSort is understandable <1% of people"

about excess, many ask and answer in inverse problem:
? what should be data and in what quantity to exceed limits?

about strings: there is a working prototype
sorting lines applying concept of "integral of letters"

yes I come back to bubble comparisons
to form a clear answer for everyone:

at schools they study bubble and do not study qsort
therefore Russian sorting halves
accelerating bubble 2 times addition
multiple lines in program should be claimed

Code: QB64: [Select]
  1. summa=0: FOR i=1 TO n: summa=summa+d(i): NEXT: middle=summa/n: y=1: z=0
  2. FOR i=1 TO n
  3. IF d(i) < middle THEN a(y)=d(i): y=y+1: ELSE a(n-z)=d(i): z=z+1

  [ You are not allowed to view this attachment ]  

Z = N*(N-1)/2
Z = 2*(N/2*(N/2-1)/2+2*N/2)
Z = 4*(N/4*(N/4-1)/2+2*N/4)
Z = log(N;2)*(N/log(N;2)*(N/log(N;2)-1)/2+2*N/log(N;2))

Currently 13 options are created
Russian sorting halves:

1. Acceleration of bubble sorting by 2 times
adding a few lines code by dividing array into 2 parts

2. Acceleration of bubble sorting 4 times
adding a few lines code by dividing array into 4 parts

3. Acceleration of selection sorting by 2 times
adding a few lines code by dividing array into 2 parts

4. Acceleration of selection sorting by 4 times
adding a few lines code by dividing array into 4 parts

    [ You are not allowed to view this attachment ]  

5. Recursive of QB64 1'000'000 in 2.2 seconds
6. Recursive of PureBasic 1'000'000 in 0.3 seconds
7. Recursive of FreeBasic 1'000'000 in 0.15 seconds

8. Excel fast for 250 items on 5 second
9. Excel animation for 250 items on 150 second

10. Recursive of C# Csharp 1'000'000 in 0.2 seconds
11. QB64 sorting integral of letters

12. Acceleration of bubble sorting
by dividing into 4 parts C# Csharp
13. Nested loops and indexes of indexes
« Last Edit: November 02, 2018, 03:44:38 am by DANILIN »
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Russian Sorting Halves Danilin
« Reply #20 on: October 28, 2018, 01:56:58 pm »
Code: QB64: [Select]
  1. we read: "nothing over QSort"
  2. fuller: "nothing over QSort is understandable <1% of people"

Ha! You think your Russian Sort is more understandable? Z = log(N;2)*(N/log(n;2))*... yeah OK I see it now. ;-))

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #21 on: October 28, 2018, 02:04:20 pm »
I think: millions of schoolchildren got a chance
delve into sorting fast and human
just inserting lines into code

Code: QB64: [Select]
  1. summa=0: FOR i=1 TO n: summa=summa+d(i): NEXT: middle=summa/n: y=1: z=0
  2. FOR i=1 TO n
  3. IF d(i) < middle THEN a(y)=d(i): y=y+1: ELSE a(n-z)=d(i): z=z+1

and causing sorting twice
and speeding up studied all bubble by 2 times
and repeating more difficult by accelerating
bubble studied all by 4 times

which turns bubble suddenly into a bubble fast sort

Z = N*(N-1)/2
Z = 2*(N/2*(N/2-1)/2+2*N/2)
Z = 4*(N/4*(N/4-1)/2+2*N/4)
Z = log(N;2)*(N/log(N;2)*(N/log(N;2)-1)/2+2*N/log(N;2))
« Last Edit: October 28, 2018, 02:10:01 pm by DANILIN »
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Russian Sorting Halves Danilin
« Reply #22 on: October 28, 2018, 02:44:58 pm »
? What sorting is being studied in school?

A whole array of sorting is being taught, from Bubblesort/Selectionsort to Quicksort.  https://classic.csunplugged.org/sorting-algorithms/

It seems rather disingenuous by comparing and highlighting speeds only against the slowest methods (Bubble), without bothering to disclose performance against other, quicker methods.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Russian Sorting Halves Danilin
« Reply #23 on: October 28, 2018, 03:10:32 pm »
I think: millions of schoolchildren got a chance
delve into sorting fast and human
just inserting lines into code

Code: QB64: [Select]
  1. summa=0: FOR i=1 TO n: summa=summa+d(i): NEXT: middle=summa/n: y=1: z=0
  2. FOR i=1 TO n
  3. IF d(i) < middle THEN a(y)=d(i): y=y+1: ELSE a(n-z)=d(i): z=z+1

and causing sorting twice
and speeding up studied all bubble by 2 times
and repeating more difficult by accelerating
bubble studied all by 4 times

which turns bubble suddenly into a bubble fast sort

Z = N*(N-1)/2
Z = 2*(N/2*(N/2-1)/2+2*N/2)
Z = 4*(N/4*(N/4-1)/2+2*N/4)
Z = log(N;2)*(N/log(N;2)*(N/log(N;2)-1)/2+2*N/log(N;2))

In some cases, your math makes it seem slower than bubble, say when N = 4

Z = 4 * 3 /2 ....   6
Z = 2 * (2 * (2-1)/2) + 2 * 2) = 2 * (2 * 1/2) + 4) = 2 * (1 + 4)....   10
Z = 4 * (1 * (1-1)/2) + 2 * 1) = 4 * (2) = 8

So when there's only 4 elements, it's faster to just Bubblesort than "divide and conquer" the problem.

Who would've ever thought we'd call Bubblesort fast?!!  ;D
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #24 on: October 28, 2018, 03:24:33 pm »
yes indeed there are calculations:
column N and bubble data column
and data column Russian sorting halves
divide on 4 parts

Code: QB64: [Select]
  1. N       Bubble  RSH 4 parts
  2. 4       6       8
  3. 5       10      11
  4. 6       15      14
  5. 7       21      17
  6. 8       28      20
  7. 10      45      28
  8. 16      120     56
  9. 20      190     80
  10. 32      496     176
  11. 50      1225    388
  12. 64      2016    608
  13. 100     4950    1400
  14. 128     8128    2240
  15. 200     19900   5300
  16. 256     32640   8576
  17. 500     124750  32000
  18. 512     130816  33536
  19. 1000    499500  126500

4 times faster bubble means success

and further there will be an example
of sorting of integral of letters
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #25 on: October 28, 2018, 03:27:04 pm »
prototype Russian sorting halves of the integral of letters

as a result any upper words
less than any lower words

Code: QB64: [Select]
  1. N = 10: DIM d$(N), a$(N), b(27)
  2.  
  3. d$(1) = "ABC": d$(2) = "QQQ": d$(3) = "SSS": d$(4) = "ZYX": d$(5) = "PPP":
  4. d$(6) = "FFF": d$(7) = "QBB": d$(8) = "DDD": d$(9) = "ZZZ": d$(10) = "AAA":
  5.  
  6. FOR i = 1 TO N
  7.     c = ASC(MID$(d$(i), 1, 1)) - 64
  8.     b(c) = b(c) + 1
  9.  
  10. FOR i = 1 TO 27 STEP 3: PRINT CHR$(i + 64); b(i), CHR$(i + 1 + 64); b(i + 1), CHR$(i + 2 + 64); b(i + 2): NEXT: PRINT
  11.  
  12. summa = 0: FOR i = 1 TO 26: summa = summa + i * b(i): NEXT
  13. h = 0: FOR i = 1 TO 26
  14.     IF b(i) > 0 THEN h = h + 1
  15.  
  16. middle = summa / h: PRINT summa, h, middle: PRINT
  17.  
  18. y = 1: z = 0: FOR i = 1 TO N
  19.     c = ASC(MID$(d$(i), 1, 1)) - 64: PRINT c; c * b(c),
  20.     IF c * b(c) < middle THEN a$(y) = d$(i): y = y + 1: ELSE a$(N - z) = d$(i): z = z + 1
  21.  
  22. FOR i = 1 TO N: PRINT a$(i),: NEXT: PRINT
  23. PRINT y - 1

animation of integral:
  [ You are not allowed to view this attachment ]  
« Last Edit: October 28, 2018, 03:31:26 pm by DANILIN »
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #26 on: October 29, 2018, 03:40:27 pm »
a 4 times acceleration proof

Code: QB64: [Select]
  1. 'RUSSIAN sorting halves 4 part bubble
  2. N=17539
  3. DIM d(N), a(N), v(N), q(5)
  4. RANDOMIZE TIMER: FOR i=1 TO N: d(i)=INT(RND * N): NEXT
  5. FOR k=1 TO 10: PRINT d(k);: NEXT: PRINT: FOR k=N-9 TO N: PRINT d(k);: NEXT: PRINT: PRINT
  6.  
  7. start=TIMER: s=0
  8.  
  9. ' ALL
  10. summa=0: FOR i=1 TO N: summa=summa+d(i): NEXT: middle=summa/N: y=1: z=0
  11. FOR i=1 TO N
  12.     IF d(i) < middle THEN a(y)=d(i): y=y+1: ELSE a(N-z)=d(i): z=z+1
  13. q(3)=y-1
  14. PRINT "ALL middle="; middle
  15. FOR k=1 TO 10: PRINT a(k);: NEXT: PRINT: FOR k=N-9 TO N: PRINT a(k);: NEXT: PRINT: PRINT
  16.  
  17. '1 FROM 2
  18. summa=0: FOR i=1 TO q(3): summa=summa+a(i): NEXT: middle=summa/q(3): y=1: z=0
  19. PRINT "1 FROM 2="; middle, "1 ..."; q(3)
  20. FOR i=1 TO q(3)
  21.     IF a(i) < middle THEN v(y)=a(i): y=y+1: ELSE v(q(3)-z)=a(i): z=z+1
  22. FOR k=1 TO 10: PRINT v(k);: NEXT: PRINT: FOR k=q(3)-9 TO q(3): PRINT v(k);: NEXT: PRINT: PRINT
  23. q(2)=y-1
  24.  
  25. '2 FROM 2
  26. summa=0: FOR i=q(3)+1 TO N: summa=summa+a(i): NEXT: middle=summa/(1+N-q(3)): y=q(3): z=0
  27. PRINT "2 FROM 2="; middle, q(3)+1; "..."; N
  28. FOR i=q(3) TO N
  29.     IF a(i) < middle THEN v(y)=a(i): y=y+1: ELSE v(N-z)=a(i): z=z+1
  30. FOR k=q(3) TO q(3)+10: PRINT v(k);: NEXT: PRINT: FOR k=N-9 TO N: PRINT v(k);: NEXT: PRINT: PRINT
  31. q(4)=y-1: q(1)=2: q(5)=N
  32.  
  33. ' SORTING
  34. PRINT "1="; 1, "2="; q(2), "3="; q(3), "4="; q(4), "5="; N: PRINT
  35. FOR t=1 TO 4
  36.     FOR i=q(t)-1 TO q(t+1): FOR j=i+1 TO q(t+1)
  37.             IF v(i) > v(j) THEN SWAP v(i), v(j): s=s+1
  38.  
  39. finish=TIMER
  40.  
  41. FOR k=1 TO 10: PRINT v(k);: NEXT: PRINT: FOR k=N-9 TO N: PRINT v(k);: NEXT: PRINT: PRINT
  42. PRINT "DA RUS 4 ", finish-start; "second ", "swap "; s
  43.  
  44. OPEN "c:/RUsortdav4.txt" FOR OUTPUT AS #2
  45. PRINT #2, finish-start; "second ", "swap "; s
  46. PRINT #2, N; "Russian sorting halves 4 parts bubble "
  47. FOR i=1 TO 20: PRINT #2, v(i): NEXT
  48. FOR i=N-19 TO N: PRINT #2, v(i): NEXT
  49.  
  50. start=TIMER: s=0
  51. FOR i=1 TO N: FOR j=i+1 TO N
  52.         IF d(i) > d(j) THEN SWAP d(i), d(j): s=s+1
  53. finish=TIMER
  54.  
  55. PRINT "BUBBLE ", finish-start; "second ", "swap "; s

a 4 times acceleration proof

  [ You are not allowed to view this attachment ]  

division of array into 4 parts occurs instantly
name q(3) will be replaced by a simpler name

but separation attempts for 2 nested loops
broken about order of midpoints 3 2 4

which leads to arrays with 2nd brackets
which complicates understanding and better apply

speaking variables of type middle3
leaving 3 cycles separate
« Last Edit: October 30, 2018, 04:56:08 pm by DANILIN »
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #27 on: March 22, 2019, 08:33:31 am »
We learn C# knowing Basic & Excel & qb64

? Why C# & Basic & Excel & qb64?
because C# & qb64 are compiled

I have a C# csc.exe compiler in Win7
and compile through an individual bat

Excel: even micro-sized environments
Basic: qb64 compatible with Win7

qb64 quadratic equation:

Code: QB64: [Select]
  1. ' quadratic equation QB64 DAV
  2. INPUT "INPUT A"; A
  3. INPUT "INPUT B"; B
  4. INPUT "INPUT C"; C
  5.  
  6. D = B ^ 2 - 4 * A * C
  7. IF D < 0 THEN PRINT "D<0 ": END
  8.  
  9. PRINT "ANSWER: "
  10. PRINT "D ="; D
  11.  
  12. X1 = (-B + SQR(D)) / (2 * A)
  13. X2 = (-B - SQR(D)) / (2 * A)
  14. PRINT "X1 ="; X1
  15. PRINT "X2 ="; X2

C# quadratic equation without checking d<0:

Code: QB64: [Select]
  1. // quadratic equation C# DAV  
  2. namespace DAV
  3. {
  4.         class Program
  5.                 {
  6.         static void Main(string[] args)
  7.         {
  8. Console.Write("INPUT A: ");
  9. long a = Convert.ToInt32(Console.ReadLine());
  10. Console.Write("INPUT B: ");
  11. long b = Convert.ToInt32(Console.ReadLine());
  12. Console.Write("INPUT C: ");
  13. long c = Convert.ToInt32(Console.ReadLine());
  14.  
  15. long d = (b * b - 4 * a * c);
  16. Console.WriteLine("ANSWER: ");
  17. Console.Write("D = ");
  18. Console.WriteLine(d);
  19.  
  20. var x1 = (-b + Math.Sqrt(d)) / (2 * a);
  21. var x2 = (-b - Math.Sqrt(d)) / (2 * a);
  22.  
  23. Console.Write("X1 = ");
  24. Console.WriteLine(x1);
  25. Console.Write("X2 = ");
  26. Console.WriteLine(x2);
  27.  
  28.                 Console.ReadKey();
  29.                 }
  30.         }
  31. }

excel quadratic equation without checking d<0:
excel: copy and paste in A1

Code: QB64: [Select]
  1. 6
  2. 7
  3. 2
  4. =A2^2-4*A1*A3
  5. =(-A2+(A4^(1/2)))/(2*A1)
  6. =(-A2-(A4^(1/2)))/(2*A1)

further need to examine conditions
creating a toy "guess number"
« Last Edit: March 22, 2019, 08:46:21 am by DANILIN »
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #28 on: March 22, 2019, 12:44:35 pm »
qb64 for 1 minute created main lines and for minutes issued
C# in 3 hours created by internet tips with new ideas

Code: QB64: [Select]
  1. 'qb64 dav guess number from 0 to 100 with counting of steps
  2. s = INT(RND * 100)
  3. t = 0
  4.  
  5. 10 PRINT: t = t + 1:
  6. INPUT "your variant"; a
  7.  
  8. IF a < s THEN PRINT "need MORE": GOTO 10
  9. IF a > s THEN PRINT "need less": GOTO 10
  10. PRINT "win by"; t; "steps"

Code: QB64: [Select]
  1. '//C# dav guess number from 0 to 100 with counting of steps
  2. namespace DAV
  3. {
  4.         class Program
  5.         {
  6.         static void Main(string[] args)
  7.         {
  8. Random rand = new Random();
  9. int s = rand.Next(100);
  10. int t = 0;
  11.  
  12. dav:
  13. Console.WriteLine();
  14. t++;
  15.  
  16. Console.Write("your variant ");
  17. string d = Console.ReadLine();
  18. int a = Convert.ToInt32(d);
  19.  
  20. if(a > s)
  21.         {
  22.         Console.WriteLine("need less");
  23.         goto dav;
  24.         }
  25. else if(a < s)
  26.         {
  27.         Console.WriteLine("need MORE");
  28.         goto dav;
  29.         }
  30. Console.Write("win by ");
  31. Console.Write(t);
  32. Console.Write(" steps");
  33.                 Console.ReadKey();
  34.                 }
  35.         }
  36. }
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #29 on: March 24, 2019, 10:20:59 am »
Code: QB64: [Select]
  1. 'milliard & billion qb64 DAV guess 1 number of 1'OOO'000'ooo by 30 steps
  2.  
  3. h2 = INT(RND * 10 ^ 9)
  4. h1 = 0
  5. c = INT(RND * h2) 'comp
  6. h = INT(RND * h2) 'human
  7. t = 0
  8.  
  9. 10 t = t + 1
  10. PRINT t, c, h,
  11.  
  12. IF h < c THEN PRINT "MORE": a = h: h = INT((h + h2) / 2): h1 = a: GOTO 10
  13. IF h > c THEN PRINT "less": a = h: h = INT((h1 + h) / 2): h2 = a: GOTO 10
  14. PRINT "win by "; t; " steps"

C# compiler feature noticed
remark that there is a mistake at beginning of program
may mean a lack of characters } at end

example for a range from 0 to 100
Code: QB64: [Select]
  1. 1    40    11    MORE
  2. 2    40    55    less
  3. 3    40    33    MORE
  4. 4    40    44    less
  5. 5    40    38    MORE
  6. 6    40    41    less
  7. 7    40    39    MORE
  8. 8    40    40    win by 8 steps
BasiC# qbc# C##


Online C# compiler detected
and dozens more languages without qbasic
working without registration

and there typing program is possible
save state with program

for example program C # Billion
guessing 1 of 1'000'OOO'ooo
=log(10^9;2) in 30 moves

rextester.com/JRGX29275

Code: QB64: [Select]
  1. //milliard & billion C# DAV guess 1 number of 1000000000 by 30 steps  
  2. namespace DAV
  3. {
  4.     class Program
  5.     {
  6.     static void Main(string[] args)
  7.     {
  8. int h2 = 1000000000;//or 500
  9. int h1 = 0;
  10. Random rand = new Random();
  11. int c = rand.Next(h2); //computer
  12. int h = rand.Next(h2); //human or h2/2;
  13. int t = 0;
  14.  
  15. dav:
  16. t++;
  17. Console.WriteLine();
  18. Console.Write(t);
  19. Console.Write("  ");
  20. Console.Write(c);
  21. Console.Write("  ");
  22. Console.Write(h);
  23. Console.Write("  ");
  24.  
  25. if(h < c)
  26.     {
  27.     Console.Write("MORE");
  28.     int a = h;
  29.     h = (h + h2) / 2;
  30.     h1 = a;
  31.     goto dav;
  32.     }
  33. else if(h > c)
  34.     {
  35.     Console.Write("less");
  36.     int a = h;
  37.     h = (h1 + h) / 2;
  38.     h2 = a;
  39.     goto dav;
  40.     }
  41. Console.Write("win by ");
  42. Console.Write(t);
  43. Console.Write(" steps");
  44.         Console.ReadKey();
  45.         }
  46.     }
  47. }


Searching see programs stored ... 5 years
and for certain still there is an online compiler C#
and really are through Yandex search

but since interested in graphics
while I use cs & bat
« Last Edit: March 28, 2019, 03:44:51 am by DANILIN »
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself