Author Topic: Running strings  (Read 7342 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
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
* strunqb64.bas (Filesize: 0.62 KB, Downloads: 212)
« Last Edit: September 18, 2019, 04:12:48 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 SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Running strings
« Reply #1 on: September 18, 2019, 03:38:06 am »
Question — WTH is:     FOR j = 1 TO 10 ^ 7 - ekran ^ (1.5) * 1 * 10 ^ 4: NEXT

A loop with a complex formula that does nothing??  What purpose does it hold?  Is it just there to help obfuscate the code, or to purposefully use a ton of CPU power just counting nothing??  What’s it for?

If it’s just to delay printing, why not use a SLEEP, _DELAY, or _LIMIT command inside the loop instead, and play nice with the CPU without needing the obtuse complexity.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Running strings
« Reply #2 on: September 18, 2019, 04:16:43 am »
ok I picked up a pause depending on width of screen
_DELAY (.1 - ekran / 1000)

sleep comand so there used
to be an extensive solution
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: Running strings
« Reply #3 on: September 18, 2019, 09:58:15 am »


Code: QB64: [Select]
  1. _TITLE "East meets West" 'B+ 2019-09-18  Outer Limits > [youtube]https://www.youtube.com/watch?v=8CtjhWhw2I8[/youtube]
  2. east$ = "> East >": west$ = "< West <": L = LEN(east$): Outer = 7
  3.     FOR i = 1 TO _WIDTH - L
  4.         FOR j = 1 TO _HEIGHT
  5.             IF j MOD 2 THEN LOCATE j, i: PRINT east$; ELSE LOCATE j, _WIDTH - i - L + 1: PRINT west$;
  6.         NEXT
  7.         _LIMIT Outer
  8.         IF i = 40 - L + 1 THEN CLS: Outer = Outer + 7
  9.     NEXT
  10.     CLS
  11.  

https://www.qb64.org/forum/index.php?topic=1674.msg109114#msg109114
« Last Edit: September 18, 2019, 10:36:08 am by bplus »

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Running strings
« Reply #4 on: September 18, 2019, 11:52:24 am »
I will look at another links later
and conveniently attach programs and pictures
or set program name in 1st line as in this Rissian IQ

and now: multi-line running string

Code: QB64: [Select]
  1. ' struniq.bas
  2. ' running strings from ost to west and from left to right
  3. ' multi-string plus width of screen include in velocity
  4.  
  5. DIM q$(5): ekran = 66: s$ = " "
  6. FOR i = 1 TO ekran + 10: s$ = s$ + " ": NEXT
  7.  
  8. q$(1) = "RRR  U U  SSS  SSS  I   A   N  N    III  QQ  "
  9. q$(2) = "R R  U U  S    S    I  AAA  NN N     I  Q  Q "
  10. q$(3) = "RR   U U  SSS  SSS  I  A A  N NN     I  Q  Q "
  11. q$(4) = "R R  U U    S    S  I  AAA  N  N     I  Q QQ "
  12. q$(5) = "R R  UUU  SSS  SSS  I  A A  N  N    III  QQ Q"
  13.  
  14. FOR i = 1 TO 5: q$(i) = s$ + q$(i) + s$: NEXT: q = LEN(q$(1))
  15.  
  16. FOR n = 1 TO 5
  17.     FOR i = 1 TO q - ekran
  18.         FOR j = 1 TO 5
  19.             LOCATE j + 5, 5: COLOR j + i / 15: PRINT MID$(q$(j), i, ekran)
  20.             LOCATE j + 15, 5: COLOR j + i / 22: PRINT MID$(q$(j), q - ekran + 1 - i, ekran)
  21. NEXT: _DELAY (.1 - ekran / 3000): NEXT: NEXT
and multicolored lines and letters are also possible
 
RussianIQ.PNG
 
RusIQ.PNG
* struniq.bas (Filesize: 0.81 KB, Downloads: 270)
« Last Edit: September 18, 2019, 02:05:16 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: Running strings
« Reply #5 on: September 18, 2019, 12:28:16 pm »


Code: QB64: [Select]
  1. _TITLE "East meets West" 'B+ 2019-09-18  Outer Limits > [youtube]https://www.youtube.com/watch?v=8CtjhWhw2I8[/youtube]
  2. east$ = "> East >": west$ = "< West <": L = LEN(east$): Outer = 7
  3.     FOR i = 1 TO _WIDTH - L
  4.         FOR j = 1 TO _HEIGHT
  5.             IF j MOD 2 THEN LOCATE j, i: PRINT east$; ELSE LOCATE j, _WIDTH - i - L + 1: PRINT west$;
  6.         NEXT
  7.         _LIMIT Outer
  8.         IF i = 40 - L + 1 THEN CLS: Outer = Outer + 7
  9.     NEXT
  10.     CLS
  11.  

https://www.qb64.org/forum/index.php?topic=1674.msg109114#msg109114

I see your East and West, and give you this version of it:

Code: QB64: [Select]
  1. e$ = "East": w$ = "West": l$ = "East meets West in an EPIC showdown!"
  2.  
  3. FOR i = 0 TO (_WIDTH - _PRINTWIDTH(e$)) \ 2
  4.     CLS
  5.     _PRINTSTRING (i - _PRINTWIDTH(e$) \ 2, 0), e$
  6.     _PRINTSTRING (_WIDTH - i - _PRINTWIDTH(e$) \ 2, 0), w$
  7.     _LIMIT 100
  8.     _DISPLAY
  9.  
  10. FOR i = 1 TO 80
  11.     LOCATE 2, i: PRINT _TRIM$(STR$(i MOD 10)) 'just a line of numbers to help show centering
  12.  
  13. FOR i = 0 TO LEN(l$) \ 2
  14.     t1$ = MID$(l$, LEN(l$) \ 2 - i, 1)
  15.     t2$ = MID$(l$, LEN(l$) \ 2 + i, 1)
  16.     FOR j = 0 TO _WIDTH \ _FONTWIDTH \ 2 - i
  17.         _PRINTSTRING ((j - 2) * _FONTWIDTH, 30), " " + t1$
  18.         _PRINTSTRING (_WIDTH - (j + 1) * _FONTWIDTH, 30), t2$ + " "
  19.         _LIMIT 100
  20.         _DISPLAY
  21.     NEXT
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Running strings
« Reply #6 on: September 18, 2019, 12:53:04 pm »
Well I hope yose guys dont run mine (#3) for 30 secs and think you've seen the whole effect!

Like I think I've seen yours after 30 secs, and think I've seen the whole effect. :)

When you've seen the whole effect, you might understand why I post a link to 45 sec vid that DANLIN doesn't have time to see :D

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Running strings
« Reply #7 on: September 18, 2019, 06:58:05 pm »
Hi Bplus
yes the effect is clear after 30-40 sec and it goes on ad libitum

BUT you must advice that it is not for epileptic person...
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Running strings
« Reply #8 on: October 13, 2019, 05:34:41 pm »
Help! A zombie in my mind!

Yes guys
it went out of my mind in these hours while I was playing chess online!
So sorry for my poor style of coding but it seems working....

What about?
Yep a vertical scrolling added to the original horizonthal scrolling of Danilin

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" ' a string
  6. west$ = "Russian Export Oriented Replace of Import" ' another string
  7. ekran = 66: s$ = " ": FOR i = 1 TO ekran + 10: s$ = s$ + " ": NEXT
  8. ' a single: third string: a FOR NEXT to set s$ = 77 spaces
  9. ost$ = s$ + ost$ + s$: west$ = s$ + west$ + s$ 'ost$ and west$ are the middle layer of a sandwich of s$
  10. ost = LEN(ost$): west = LEN(west$) ' ost and west are their lenghts 77+50 +77 , 77+41+77
  11.  
  12. io% = 0
  13. iw% = 0
  14. ost2$ = SPACE$(64) + " " + LTRIM$(RTRIM$(ost$)) + " "
  15. west2$ = " " + LTRIM$(RTRIM$(west$)) + " " + SPACE$(74)
  16.  
  17. FOR i = 1 TO west - ekran 'for 1 to 77+41+77-66=129
  18.     LOCATE 2, 1: PRINT MID$(ost$, i, ekran)
  19.     LOCATE 5, 1: PRINT MID$(west$, west - ekran + 1 - i, ekran)
  20.  
  21.     GOSUB Vertical
  22.  
  23.     _DELAY (.1 - ekran / 1000)
  24.     ' FOR j = 1 TO 10 ^ 7 - ekran ^ (1.5) * 1 * 10 ^ 4: NEXT
  25.  
  26. Vertical:
  27. 'COLOR 7, 1
  28. FOR i2 = 1 TO 25
  29.     LOCATE i2, (_WIDTH / 2) - 2
  30.     PRINT MID$(ost2$, i2 + io%, 1);
  31.     LOCATE 26 - i2, (_WIDTH / 2) + 2
  32.     PRINT MID$(west2$, LEN(west2$) - i2 - iw%, 1);
  33. 'COLOR 7, 0
  34. IF io% < LEN(ost$) THEN io% = io% + 1 ELSE io% = 0
  35. IF iw% < LEN(west$) THEN iw% = iw% + 1 ELSE iw% = 0

Programming isn't difficult, only it's  consuming time and coffee

Marked as best answer by DANILIN on October 13, 2019, 10:11:42 pm

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Running strings
« Reply #9 on: October 13, 2019, 06:42:33 pm »
And this is zombie 2 ! Revenge.

:-P
Code: QB64: [Select]
  1. ' struniq.bas
  2. ' running strings from ost to west and from left to right
  3. ' multi-string plus width of screen include in velocity
  4.  
  5. DIM q$(5): ekran = 66: s$ = " "
  6. FOR i = 1 TO ekran + 10: s$ = s$ + " ": NEXT
  7.  
  8. q$(1) = "RRR  U U  SSS  SSS  I   A   N  N    III  QQ  "
  9. q$(2) = "R R  U U  S    S    I  AAA  NN N     I  Q  Q "
  10. q$(3) = "RR   U U  SSS  SSS  I  A A  N NN     I  Q  Q "
  11. q$(4) = "R R  U U    S    S  I  AAA  N  N     I  Q QQ "
  12. q$(5) = "R R  UUU  SSS  SSS  I  A A  N  N    III  QQ Q"
  13.  
  14. DIM p$(5), q1, iQ
  15. FOR i = 1 TO 5: p$(i) = " " + q$(i) + " ": NEXT i: q1 = LEN(p$(1)): iQ = 0
  16.  
  17. FOR i = 1 TO 5: q$(i) = s$ + q$(i) + s$: NEXT: q = LEN(q$(1))
  18.  
  19. FOR n = 1 TO 5
  20.     FOR i = 1 TO q - ekran
  21.         FOR j = 1 TO 5
  22.             LOCATE j + 5, 5: COLOR j + i / 15: PRINT MID$(q$(j), i, ekran)
  23.             LOCATE j + 15, 5: COLOR j + i / 22: PRINT MID$(q$(j), q - ekran + 1 - i, ekran)
  24.             GOSUB vertical
  25. NEXT: _DELAY (.1 - ekran / 3000): NEXT: NEXT
  26.  
  27. vertical:
  28. FOR i2 = 1 TO 25
  29.     FOR j2 = 1 TO 5
  30.         COLOR j2 + i2 / 15
  31.         LOCATE i2, (_WIDTH / 2) - 8 + j2
  32.         PRINT MID$(p$(j2), i2 + iQ, 1);
  33.         COLOR j2 + i2 / 22
  34.         LOCATE 26 - i2, (_WIDTH / 2) + 8 - j2
  35.         PRINT MID$(p$(j2), q1 - i2 - iQ, 1);
  36.     NEXT
  37. IF iQ < q1 THEN iQ = iQ + 1 ELSE iQ = 0
Programming isn't difficult, only it's  consuming time and coffee