QB64.org Forum

Active Forums => Programs => Topic started by: bplus on June 08, 2020, 11:41:30 pm

Title: SOS
Post by: bplus on June 08, 2020, 11:41:30 pm
;-))

Code: QB64: [Select]
  1. _TITLE "SOS"
  2. DEFINT A-Z
  3. CONST o = "²"
  4. TYPE rc
  5.     r AS INTEGER
  6.     c AS INTEGER
  7. p(0) = "±±±±± ²²²²²² °°°°°°"
  8. p(1) = "±     ²    ² °     "
  9. p(2) = "±±±±± ²    ² °°°°°°"
  10. p(3) = "    ± ²           °"
  11. p(4) = "±±±±± ²²²²²² °°°°°°"
  12.  
  13. _DELAY .25
  14. ON TIMER(t, 5) signalSOS
  15. FOR y = 0 TO 14 STEP 7
  16.     FOR c = 6 TO 60 STEP 25
  17.         FOR r = 0 TO 4
  18.             LOCATE r + 4 + y, c: PRINT p(r);
  19.         NEXT
  20.     NEXT
  21.  
  22. DIM l(2, 2) AS rc
  23. row = 7: col = 17
  24. FOR y = 0 TO 14 STEP 7
  25.     FOR x = 0 TO 50 STEP 25
  26.         l(y \ 7, x \ 25).r = row + y
  27.         l(y \ 7, x \ 25).c = col + x
  28.         LOCATE l(y \ 7, x \ 25).r, l(y \ 7, x \ 25).c: PRINT o
  29.     NEXT
  30. signalSOS
  31. WHILE _KEYDOWN(27) = 0
  32.     FOR y = 0 TO 2
  33.         FOR x = 0 TO 2
  34.             LOCATE l(y, x).r, l(y, x).c: PRINT " ";
  35.             row = l(y, x).r: col = l(y, x).c
  36.             ran = INT(4 * RND)
  37.             SELECT CASE ran
  38.                 CASE 0: a = SCREEN(row, col + 1)
  39.                     IF a = 32 THEN col = col + 1
  40.                 CASE 1: a = SCREEN(row, col - 1)
  41.                     IF a = 32 THEN col = col - 1
  42.                 CASE 2: a = SCREEN(row + 1, col)
  43.                     IF a = 32 THEN row = row + 1
  44.                 CASE 3: a = SCREEN(row - 1, col)
  45.                     IF a = 32 THEN row = row - 1
  46.             END SELECT
  47.             IF row < 2 THEN row = 2
  48.             IF row > 24 THEN row = 24
  49.             IF col < 2 THEN col = 2
  50.             IF col > 79 THEN col = 79
  51.             LOCATE row, col: PRINT o;
  52.             l(y, x).r = row: l(y, x).c = col
  53.         NEXT
  54.     NEXT
  55.     _LIMIT 100
  56.  
  57. SUB signalSOS
  58.     FOR i = 1 TO 9
  59.         IF i < 4 OR i > 6 THEN SOUND 900, 1 ELSE SOUND 900, 3
  60.         IF i = 3 OR i = 6 OR i = 9 THEN _DELAY .35
  61.         _LIMIT 6
  62.     NEXT
  63.  
  64.  
Title: Re: SOS
Post by: DDBE on June 09, 2020, 12:19:02 am
Would certainly make for a great syntax error message if that would be flashing next to it! XD
Title: Re: SOS
Post by: bplus on June 09, 2020, 12:49:18 am
Ha! I did think about flashing. When I checked Internet for audio sound, they had one with flashes that matched the dots and dashes,
Title: Re: SOS
Post by: DANILIN on June 09, 2020, 10:56:02 am
large letters remind of my theme: running string

https://www.qb64.org/forum/index.php?topic=1724.msg109578#msg109578

and multicolored lines and letters are also possible
Title: Re: SOS
Post by: bplus on June 09, 2020, 11:51:18 am
large letters remind of my theme: running string

https://www.qb64.org/forum/index.php?topic=1724.msg109578#msg109578

and multicolored lines and letters are also possible

For tiny letters, best I've seen is @Richard Frost work, in fact, it would be nice for tool box when you need specially tiny print for labels.
Title: Re: SOS
Post by: bplus on June 09, 2020, 11:56:27 am
I guess the challenge for this code is to have the little blocks continue to move around while the SOS signal is SOUNDing ON TIMER intervals.

Even Pete could try this since we are using SCREEN 0 to try a demo of SCREEN() function for getting ASCII characters. I haven't been able to get it to work in other screens.
Title: Re: SOS
Post by: TempodiBasic on June 09, 2020, 02:47:07 pm
LOL
this is wonderful
I can imagine how it starts as soon as I type a synthax error! :-)

Moreover it is a friend because in the last 6 months I feel myself like one of the running characters

:-(

LOL I continue to eat letters while I'm typing... fine glitch starts-->stars
Title: Re: SOS
Post by: bplus on June 09, 2020, 03:02:16 pm
LOL
this is wonderful
I can imagine how it stars as soon as I type a synthax error! :-)

Moreover it is a friend because in the last 6 months I feel myself like one of the running characters

:-(

Aha! TempodiBasic, you get it!  ;-))