Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - DANILIN

Pages: [1]
1
Programs / Relief 3d multivariate parametric
« on: November 17, 2021, 11:18:56 am »
Relief 3d multivariate parametric

3d relief of 2019 suddenly developed
and, in principle, there are developments of displacement in different directions
using mod function quantitatively and qualitatively

Next, an infinite 1-sided relief
or a 2-sided relief from array is possible

And it is also logical that colored grid should move
and angles can be changed axonometric

Code: QB64: [Select]
  1. 'relorto.bas 5d relief orto
  2. N = 200: q = 15: SCREEN 12: RANDOMIZE TIMER: DIM a(q+1, N)
  3. FOR x = 1 TO q: FOR y = 1 TO N: a(x, y) = INT(RND*20): NEXT: NEXT
  4.  
  5. FOR t = 1 TO N-q
  6.     FOR i = 1 TO q-1: FOR j = 1 TO q-1: a(i, j) = a(i, j+t): NEXT: NEXT: CLS
  7.  
  8.     FOR y = 1 TO q-1: FOR x = 1 TO q-2
  9.         LINE (30+20*x+20*y, 400-20*y-a(x, y))-(30+20*(x+1)+20*y, 400-20*y-a(x+1, y)), (y+t MOD 7)+1
  10.     NEXT: NEXT
  11.  
  12.     FOR x = 1 TO q-1: FOR y = 1 TO q-2
  13.         LINE (30+20*x+20*y, 400-20*y-a(x, y))-(30+20*(x+1)+20*y, 400-20*(y+1)-a(x, y+1)), 7

Animation 300 kB

 
relorto.gif


Changed a little and edges of field became undulating
and colored grid should move

2
Programs / Russian Circle Diagram
« on: November 06, 2021, 12:12:44 pm »
Russian Circle Diagram

We build pie charts in 2 ways as Russian Circle Diagram
and it is still possible other way around from edges to center

Code: QB64: [Select]
  1. 'diagram.bas  Russian Circle Diagram
  2. N = 13: s = 0: DIM d(N),r(N+1): SCREEN 12: RANDOMIZE TIMER
  3. FOR i = 1 TO N: d(i) = INT(RND*90+9): s = s+d(i): PRINT d(i): NEXT: PRINT "SUM= "; s
  4. FOR i = 2 TO N: r(i) = r(i-1)+d(i)*2*3.1416/s: NEXT: r(N+1) = r(1)
  5.  
  6. FOR i = 2 TO N+1: FOR j = 1 TO 100: CIRCLE (150,150),j,i,r(i-1),r(i)
  7.         CIRCLE (149,149),j,i,r(i-1),r(i): CIRCLE (151,149),j,i,r(i-1),r(i)
  8.  
  9. FOR j = 1 TO 100: FOR i = 2 TO N+1: CIRCLE (350,150),j,i,r(i-1),r(i)
  10.         CIRCLE (349,149),j,i,r(i-1),r(i): CIRCLE (351,149),j,i,r(i-1),r(i)

Necessary: schkolnaya olympiyskaya zadacha

 
diagram.gif


Plus it is also possible to build a pattern in corners
connecting all points together

 
soedin.gif


Practically: olympic school problem

 
komblife.gif


animations all: less than 300 kb

3
Programs / Guess Number
« on: June 20, 2021, 02:22:21 am »
Theme "Guess number" has disappeared and given usefulness
I create theme again remembering programs

Later there will be a repeat of program where
computer guesses 1 out of a billion for logarithmic number of steps

Now a my curiosity:
Single-line "Guess Number" program QBasic QB64 from Russia
Code: QB64: [Select]
  1. 1 IF Russia = 0 THEN Russia = 2222: RANDOMIZE TIMER: num = INT(RND * 100) + 1: GOTO 1 ELSE IF Russia <> 0 THEN INPUT n: IF n < num THEN PRINT "MORE": GOTO 1 ELSE IF n > num THEN PRINT "less": GOTO 1 ELSE IF n = num THEN PRINT "da": END ELSE GOTO 1 'DANILIN Russia 9-9-2019 guessnum.bas
  2.  

An array of programs in many languages and a similar topic here:

http://rosettacode.org/wiki/Guess_the_number#BASIC
rosettacode.org/wiki/Guess_the_number

http://rosettacode.org/wiki/Guess_the_number/With_feedback_(player)#BASIC
rosettacode.org/wiki/Guess_the_number/With_feedback_(player)

Hi Lo without Secret Number?
https://qb64.org/forum/index.php?topic=3120.30

Update: program better view

1 IF Russia = 0 THEN Russia = 2222: RANDOMIZE TIMER: num = INT(RND * 100) + 1: GOTO 1 ELSE IF Russia <> 0 THEN INPUT n: IF n < num THEN PRINT "MORE": GOTO 1 ELSE IF n > num THEN PRINT "less": GOTO 1 ELSE IF n = num THEN PRINT "da": END ELSE GOTO 1 'DANILIN Russia 9-9-2019 guessnum.bas

4
Programs / Shuffling Letters
« on: June 12, 2021, 06:22:49 pm »
Shuffling Letters

This program mixes letters inside words
except for initial and final ones checking language puzzles

Feature of my programs: spinning string
here spinning strings: 5 where goto 5 and 8 where goto 8 and 9 where goto 9

Algorithm: at beginning and at end of string, spaces
i - beginning of found and j - end of found
and except for extreme letters inside word letters are mixed up

Dots change and repeat until end of phrase

Code: QB64: [Select]
  1. RANDOMIZE TIMER ' dashuffle.bas
  2. a$ = " Russians looks World from Future ": d$=a$: a = LEN(a$): i=0: j=1: PRINT a$
  3. open "dashuf.txt" for output as #1: PRINT #1, a$
  4. 5 i = i+1: IF MID$(a$, i, 1) <> " " THEN IF i <= a THEN 5 ELSE END
  5. 7 j = i+1:
  6. 8 IF MID$(a$, j, 1) <> " " THEN IF j <= a THEN j = j+1: GOTO 8 ELSE PRINT a$: END
  7. u = j-2-i-1: PRINT i, j, a
  8. FOR k = 1 TO u
  9.    9 w = INT(i+2+RND*u/2): r = INT(i+2+RND*u/2+u/2): IF w = r THEN 9
  10.  
  11.     q1$ = MID$(d$, 1, w-1)
  12.     w$ = MID$(d$, r, 1)
  13.     q3$ = MID$(d$, w+1, r-w-1)
  14.     r$ = MID$(d$, w, 1)
  15.     q5$ = MID$(d$, r+1, a-r)
  16.     d$ = q1$+w$+q3$+r$+q5$
  17. PRINT d$: PRINT #1, d$: i = j-1: GOTO 5

Results:
Code: [Select]
Russians looks World from Future
1 9 34
Rsaunsis looks World from Future
9 15 34
Rsaunsis lkoos World from Future
15 21 34
Rsaunsis lkoos Wrold from Future
21 26 34
Rsaunsis lkoos Wrold from Future
26 33 34
Rsaunsis lkoos Wrold from Ftruue
Russians looks World from Future

Arocdnicg to rsceearch at Ruiassn Uinervtisy it deosnt mttaer in waht oredr ltteers in a wrod
are olny iprmoatnt tihng is taht frist and lsat ltteer are in rghit pcale
Rset can be a toatl mses and you can sitll raed it wouthit pobelrm
Tihs is buseace huamn mnid deos not raed ervey lteter by istlef but wrod as a wlohe

UPDATE 13jun21
open "dashuf.txt" for output as #1: PRINT #1, a$
PRINT #1, d$:


5
Programs / Diagonal snake filling array qb64 qbasic: witty task
« on: January 24, 2021, 06:40:55 pm »
Diagonal snake filling array: witty task

01 02 06 07
03 05 08 13
04 09 12 14
10 11 15 16

It is allowed to peek on Internet in other languages

I only get 1st corner so far

There are no universal solutions for all configurations anywhere

6
Programs / Integral of letters: all combinations of letters of all words
« on: October 07, 2020, 02:45:01 pm »
Integral of letters: all combinations of letters of all words

Given a dictionary of thousands of words without extra characters
12345.txt

My program decomposes each word into letters
and creates a table 54321.txt
number of combinations of all letters

 
komblife.gif


=26*25/2 = 25*13 = 325

While sorting is not implemented
I ordered in Excel:

Code: [Select]
1 18912 E S
2 17898 I N
3 14121 A E
4 13913 E R
5 13057 E N
6 12980 I S
7 12694 A N
8 12372 A I
9 12010 A T
10 11760 R S

Code: QB64: [Select]
  1. 'izhitsa.bas
  2. DIM a(26, 26)
  3. OPEN "12345.txt" FOR INPUT AS #1
  4. OPEN "54321.txt" FOR OUTPUT AS #2
  5.  
  6. FOR a = 1 TO 45400
  7.     INPUT #1, s$: s = LEN(s$) ': PRINT s$ ' or all words in memory
  8.  
  9.     FOR x = 1 TO s - 1: FOR y = x + 1 TO s
  10.             v = ASC(MID$(s$, x, 1)) - 64
  11.             w = ASC(MID$(s$, y, 1)) - 64
  12. a(v, w) = a(v, w) + 1: NEXT: NEXT: NEXT
  13.  
  14. z = 1: FOR i = 1 TO 25: FOR j = i + 1 TO 26
  15.         PRINT z, a(i, j), CHR$(i + 64), CHR$(j + 64)
  16.         PRINT #2, z; CHR$(9); a(i, j); CHR$(9); CHR$(i + 64); CHR$(9); CHR$(j + 64)
  17. z = z + 1: NEXT: PRINT: PRINT #2,: NEXT

7
Programs / Rebus of Letters
« on: August 28, 2020, 05:44:52 am »
Rebus of Letters

My program solves a rebus from letters of form:
UDAR + UDAR = DRAKA

Russian: Punch + Punch = Fight

I'm looking for other options possibly using an array

Code: QB64: [Select]
  1. ' daudar.bas
  2.  
  3. start = TIMER
  4.  
  5. FOR u = 1 TO 9
  6.     FOR d = 1 TO 9
  7.         FOR a = 0 TO 9
  8.             FOR r = 0 TO 9
  9.                 FOR k = 0 TO 9
  10.  
  11. IF u = d THEN 22
  12. IF u = a THEN 33
  13. IF u = r THEN 44
  14. IF u = k THEN 55
  15.  
  16. IF d = a THEN 33
  17. IF d = r THEN 44
  18. IF d = k THEN 55
  19.  
  20. IF a = r THEN 44
  21. IF a = k THEN 55
  22. IF r = k THEN 55
  23.  
  24. udar = 1000*u + 100*d + 10*a + r
  25. draka = d*10000 + r*1000 + a*100 + k*10 + a
  26.  
  27. IF udar + udar = draka THEN PRINT udar, draka
  28.  
  29.                 55 NEXT k
  30.            44 NEXT r
  31.        33 NEXT a
  32.    22 NEXT d
  33. 11 NEXT u
  34.  
  35. finish = TIMER
  36.  
  37. PRINT finish - start
  38.  

Next: combinatorics of letter combinations and formulas

Offer your rebuses

8
Programs / Running strings
« on: September 18, 2019, 03:11:55 am »
Running strings from ost to west and from left to right
plus width of screen include in velocity
and I'm searching for same programs

Code: QB64: [Select]
  1. ' strunqb64.bas
  2. ' running strings from ost to west and from left to right
  3. ' plus width of screen include in velocity
  4.  
  5. ost$ = "Russian Export Orientirovannoe Importo Zameschenie"
  6. west$ = "Russian Export Oriented Replace of Import"
  7. ekran = 66: s$ = " ": FOR i = 1 TO ekran + 10: s$ = s$ + " ": NEXT
  8.  
  9. ost$ = s$ + ost$ + s$: west$ = s$ + west$ + s$
  10. ost = LEN(ost$): west = LEN(west$)
  11.  
  12. FOR i = 1 TO west - ekran
  13.     LOCATE 2, 1: PRINT MID$(ost$, i, ekran)
  14.     LOCATE 5, 1: PRINT MID$(west$, west - ekran + 1 - i, ekran)
  15.     _DELAY (.1 - ekran / 1000)
  16.     ' FOR j = 1 TO 10 ^ 7 - ekran ^ (1.5) * 1 * 10 ^ 4: NEXT

9
QB64 Discussion / Russian Sorting Halves Danilin
« on: October 15, 2018, 07:40:40 pm »
Russian Sorting Halves and fast and human
sorts 1'000'000 in 2.2 seconds

number of elements is written to file with c:/N.txt or use variable n
array d(n) can be read from a file or synthesized in a program

Code: QB64: [Select]
  1. ' Russian Sorting Halves Danilin
  2.  
  3. DECLARE SUB RussianSortingHalvesDAV (ab!, yz!, part!, age!)
  4. OPEN "c:/N.txt" FOR INPUT AS #1
  5. INPUT #1, n
  6. 'n=1234567
  7. age = 1 + LOG(n) / LOG(2)
  8.  
  9. DIM SHARED d(n) 'AS LONG
  10. DIM SHARED a(n) 'AS LONG
  11.  
  12. 'OPEN "c:/ISX.txt" FOR INPUT AS #2
  13. 'FOR i=1 TO n: INPUT #2, d(i): NEXT
  14.  
  15. 'FOR i = 1 TO n: d(i) = n - i + 1: NEXT ' INT(RND*n)
  16. FOR i = 1 TO n: d(i) = INT(RND * n): NEXT '
  17.  
  18. FOR k = 1 TO 20: PRINT d(k);: NEXT: PRINT: PRINT
  19. FOR k = n - 19 TO n: PRINT d(k);: NEXT: PRINT: PRINT
  20.  
  21. start = TIMER
  22.  
  23. IF age > 0 THEN
  24.     CALL RussianSortingHalvesDAV(1, n, 1, age)
  25.  
  26. finish = TIMER
  27.  
  28. PRINT finish - start; "second ": PRINT
  29.  
  30. OPEN "c:/=RuSortHalves_dav.txt" FOR OUTPUT AS #3
  31. PRINT #3, finish - start; "second "
  32. PRINT #3, n; "elements", "RECURSION"
  33. FOR i = 1 TO 22: PRINT #3, d(i): NEXT
  34. FOR i = n - 22 TO n: PRINT #3, d(i): NEXT
  35.  
  36. FOR k = 1 TO 20: PRINT d(k);: NEXT: PRINT: PRINT
  37. FOR k = n - 19 TO n: PRINT d(k);: NEXT: PRINT: PRINT
  38.  
  39.  
  40. SUB RussianSortingHalvesDAV (ab, yz, part, age)
  41.  
  42. IF yz - ab < 1 THEN EXIT SUB
  43.  
  44. FOR i = ab TO yz
  45.     summa = summa + d(i)
  46. middle = summa / (yz - ab + 1)
  47.  
  48. abc = ab - 1
  49. xyz = yz + 1
  50.  
  51. FOR i = ab TO yz
  52.     IF d(i) < middle THEN abc = abc + 1: a(abc) = d(i): ELSE xyz = xyz - 1: a(xyz) = d(i)
  53.  
  54. FOR i = ab TO yz: d(i) = a(i): NEXT
  55.  
  56. IF part < age THEN
  57.     IF abc >= ab THEN CALL RussianSortingHalvesDAV(ab, abc, part + 1, age)
  58.     IF xyz <= yz THEN CALL RussianSortingHalvesDAV(xyz, yz, part + 1, age)
  59.  
  60.  

Russian Sorting Halves Danilin visualisation



http://kenokeno.ucoz.ru/win/rusortpol10.gif

  [ You are not allowed to view this attachment ]  

Pages: [1]