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.


Messages - STxAxTIC

Pages: [1] 2 3 ... 73
1
QB64 Discussion / Re: QB64 Bounty List
« on: April 09, 2022, 11:52:00 am »
Where's Mennonite? if he still feels the way he does, I see a DO:PROFIT:LOOP scheme here... (I'll let Steve explain the history.)

2
Programs / Re: and another one for your toolbox...
« on: April 03, 2022, 04:11:17 am »
Not bad for fat integers, I think the more complete function captures this behavior and does these examples:

 
sssss.PNG

3
I know that the world of floating point is wild, but I'm not so taken aback by the example above, especially from a scientific notation point of view. As far as significant figures go, the x## number is just as accurate as the single version, to the precision of single, and that's all we can ask of it. It's like a conservation of information thing. There are lots of ways to justify it this point - something that helps is the single-precision number, print all of the implied zero that follow the last digit. Where ever those zeros end, that's where your x## version's digits start not mattering.

Maybe I should refine my request above. I'm not saying to write something that documents all possible behavior of float, or even to predict the stray digits that occur after the last significant one. What we should do is teach a zen that avoids these questions outright. Don't mess with edge cases, be careful with conversions, don't believe every decimal you see. It's garbage in, garbage out, and only up to the number if significant figures.

It's like calculating the area of something. If you decide some rectangle is 37.23 inches across, and 34.57 inches wide, the product of those numbers is 1287.0411. But ya know what? The ".0411" is complete bullshit if you want to interpret that answer as the area. Each input number had 4 digits, and the area can only be precise to 4 digits, so it's just 1287, no remainder. Anyway, that's same ghost haunting the example you laid out.

4
Hey Steve I was thinking - uh oh, get ready...

...and I know you're infinitely busy already, all thoughts and prayers going your way. That said, can I humbly encourage your QB64 Bible project to hit the issue of floating point math next? Even if it wasn't the next chapter you were going to write, we need something final on this question once and for all. It comes up way too often in the forums. The proper write-up should minimize out-of-house references, and be something written entirely by us, for us -  and you're the guy to do it Steve. The challenge is to write it out *so good* that it answers every question that ever came up about floating point math in qb64.exe, and also anticipates every future question that may arise. Do whatever you want to do, but make this section stand perfectly alone, and write it soon. No references to other chapters, just a stand alone gospel on QB64's float.

This might make the overall project feel less daunting. Do chapters by demand. Do float while it's fresh. Invest the 10,000 keystrokes and you'll save us all 100,000. Pretty Virginia Please.

5
Programs / Re: Easter Egg Decorating
« on: April 01, 2022, 09:54:52 am »
Holy crap, vince and dbox win. Bro, lemme make that link bigger:

THIS THIS THIS

6
QB64 Discussion / Re: Time to bring in at least 150K new users to QB64
« on: March 28, 2022, 11:11:09 am »
The question of "how to expand QB64's userbase by getting it to run on XYZ hardware" is a completely expired question. Forget it.

The real way to grow QB64 as a language is to return to its *intended* roots, which is to provide an accessible platform for anyone, at any level, to write code and get it to run. The true BASIC way. Listen boys, while QB64 as a *language* does this very thing, QB64.exe does not. QB64.exe, even with its GL backbone, is still a combustion horse trying to keep pace in an age of electric cars and rockets. The answer to the conundrum on hand is to somehow keep the *spirit* of QB64 whilst shedding the husk of its pasta code.

Enter dbox. Our Galleon 2.0. His qbjs project is SO good, came from such a new direction, that people don't even realize the answer has already arrived. I don't care if QB64.exe has more features, or has a dubugger, all of that is nil. What dbox has is a thing that runs QB64 code on any device (coming soon, just a matter of interface). This is it. Repent repent repent, for the lord has arrived early. Am I getting through to everyone?

The job now is to (i) let dbox round off the corners while receiving useful feedback from everyone, (ii) start to mass old-but-gold classics that can be showcased in qbjs, (iii) bulldog the hell out of this thing on the Internet. Make it known that BASIC really is back *in spirit*. It's on every machine that has a browser. It's in your face like it used to be. Microsoft blew it, every OS blew it, here now is your BASIC, just paste your code and go (just about).

Do that, and we grow. I'm sure of it.

7
QB64 Discussion / TIMER vs SLEEP
« on: March 28, 2022, 07:57:16 am »
What happens when the unstoppable force of TIMER meets the immovable object of SLEEP?

Code: QB64: [Select]
  1. Screen _NewImage(600, 600, 32)
  2.  
  3. On Timer(t1, .01) moo
  4. Timer(t1) On
  5.  
  6.     PSet (Rnd * _Width, Rnd * _Height), _RGB(255, 255, 255)
  7.     'Sleep
  8.     _Display
  9.  
  10.  
  11. Sub moo
  12.     'do nothing

When there's a Timer at play, SLEEP never fully halts the program - or, it sorta does. It slows the thing down in kindof an interesting way. Not that anybody should ever depend on SLEEP for anything, so it's weird that this question would come up in the first place.... anyway... Thought I'd share.

8
Programs / Re: Neon Clock
« on: March 25, 2022, 10:12:37 pm »
Not really sure what's going on here overall, but I had to fix the pendulum:

Code: QB64: [Select]
  1. _Title "1 Without Numerals  2 With Numerals  S Speak Time  Space Bar For Chimes"
  2. Screen _NewImage(600, 600, 32)
  3.  
  4. Type vec2
  5.     x As Single
  6.     y As Single
  7. Print "Neon Clock Selections"
  8. Print "----------------------------------"
  9. Print "(1) Without Roman Numerals"
  10. Print "(2) With Roman Numerals"
  11. Print "You can also press 1 or 2 anytime."
  12. Print "->";
  13.     sel$ = InKey$
  14.     If sel$ = "1" Then rom = 0: GoTo nexxx:
  15.     If sel$ = "2" Then rom = 1: GoTo nexxx:
  16. nexxx:
  17. ReDim Shared vert(4024) As vec2, max_v_index
  18. Dim Shared rFactor!, gFactor!, bFactor!
  19. rFactor! = 0.5: gFactor! = 1: bFactor! = 0.5
  20.  
  21. For t = 0 To 360 Step .5
  22.     x2 = (Sin(t) * 260) + 400
  23.     y2 = (Cos(t) * 190) + 300
  24.     max_v_index = max_v_index + 1
  25.     vert(max_v_index).x = x2
  26.     vert(max_v_index).y = y2
  27.  
  28. For t = 1 To 359
  29.     For tt = t - 2 To t + 2 Step .5
  30.         x2 = Int((Sin(tt) * 230) + 400)
  31.         y2 = Int((Cos(tt) * 170) + 300)
  32.         max_v_index = max_v_index + 1
  33.         vert(max_v_index).x = x2
  34.         vert(max_v_index).y = y2
  35.     Next tt
  36. tt = 23
  37. d = 0
  38.     _Limit 50
  39.     If rom = 0 Then GoTo skip:
  40.     For sc = 1 To 60
  41.         ss = (60 - sc) * 6 + 180
  42.         x4 = Int(Sin(ss / 180 * 3.141592) * 150) + 300
  43.         y4 = Int(Cos(ss / 180 * 3.141592) * 150) + 300
  44.         Circle (x4, y4), 3, _RGB32(230, 230, 230)
  45.         n2 = (60 - sc) * 6 + 180
  46.         x3 = Int(Sin(n2 / 180 * 3.141592) * 140) + 290
  47.         y3 = Int(Cos(n2 / 180 * 3.141592) * 140) + 295
  48.         Color _RGB32(255, 255, 255), _RGB32(0, 0, 0)
  49.         If sc = 5 Then _PrintString (x3, y3), "I"
  50.         If sc = 10 Then _PrintString (x3, y3), "II"
  51.         If sc = 15 Then _PrintString (x3, y3), "III"
  52.         If sc = 20 Then _PrintString (x3, y3), "IV"
  53.         If sc = 25 Then _PrintString (x3, y3), "V"
  54.         If sc = 30 Then _PrintString (x3, y3), "VI"
  55.         If sc = 35 Then _PrintString (x3, y3), "VII"
  56.         If sc = 40 Then _PrintString (x3, y3), "VIII"
  57.         If sc = 45 Then _PrintString (x3, y3), "IX"
  58.         If sc = 50 Then _PrintString (x3, y3), "X"
  59.         If sc = 55 Then _PrintString (x3, y3), "XI"
  60.         If sc = 60 Then _PrintString (x3, y3), "XII"
  61.     Next sc
  62.     skip:
  63.     hours = Timer \ 3600
  64.     minutes = Timer \ 60 - hours * 60
  65.     seconds = (Timer - hours * 3600 - minutes * 60)
  66.     ho$ = Left$(Time$, 2): hou = Val(ho$)
  67.     min$ = Mid$(Time$, 4, 2): minu = Val(min$)
  68.     seco$ = Right$(Time$, 2): secon = Val(seco$)
  69.  
  70.     pendulum tt, d
  71.  
  72.     'Minutes
  73.     m = 180 - minutes * 6
  74.     xx = Int(Sin(m / 180 * 3.141592) * 120) + 300
  75.     yy = Int(Cos(m / 180 * 3.141592) * 120) + 304
  76.     For b = -5 To 5 Step .1
  77.         Line (300 + b, 304)-(xx, yy), _RGB32(0, 255, 255)
  78.         Line (300, 304 + b)-(xx, yy), _RGB32(0, 255, 255)
  79.     Next b
  80.     'Hours
  81.     h = 360 - hours * 30 + 180
  82.     xxx = Int(Sin(h / 180 * 3.141592) * 75) + 300
  83.     yyy = Int(Cos(h / 180 * 3.141592) * 75) + 304
  84.     For b = -5 To 5 Step .1
  85.         Line (300 + b, 304)-(xxx, yyy), _RGB32(0, 255, 0)
  86.         Line (300, 304 + b)-(xxx, yyy), _RGB32(0, 255, 0)
  87.     Next b
  88.     'Seconds
  89.     s = (60 - seconds) * 6 + 180
  90.     xxxx = Int(Sin(s / 180 * 3.141592) * 125) + 300
  91.     yyyy = Int(Cos(s / 180 * 3.141592) * 125) + 304
  92.     For b = -5 To 5 Step .1
  93.         Line (300 + b, 304)-(xxxx, yyyy), _RGB32(255, 0, 0)
  94.         Line (300, 304 + b)-(xxxx, yyyy), _RGB32(255, 0, 0)
  95.     Next b
  96.     For sz = .1 To 10 Step .1
  97.         Circle (300, 300), sz, _RGB32(255, 255, 127)
  98.     Next sz
  99.  
  100.     _Display
  101.     Line (175, 175)-(425, 440), _RGB32(0, 0, 0, 20), BF
  102.  
  103.     'Chimes
  104.     If (minu = 0 And secon = 0) Or song = 1 Then
  105.         song = 0
  106.  
  107.         'note frequencies
  108.         For notes = 1 To 20
  109.             If notes = 1 Then note = 311.13 'D#
  110.             If notes = 2 Then note = 246.94 'B
  111.             If notes = 3 Then note = 277.18 'C#
  112.             If notes = 4 Then note = 185.00 'F#
  113.             If notes = 5 Then note = 0
  114.             If notes = 6 Then note = 185.00 'F#
  115.             If notes = 7 Then note = 277.18 'C#
  116.             If notes = 8 Then note = 311.13 'D#
  117.             If notes = 9 Then note = 246.94 'B
  118.             If notes = 10 Then note = 0
  119.             If notes = 11 Then note = 311.13 'D#
  120.             If notes = 12 Then note = 277.18 'C3
  121.             If notes = 13 Then note = 246.94 'B
  122.             If notes = 14 Then note = 185.00 'F#
  123.             If notes = 15 Then note = 0
  124.             If notes = 16 Then note = 185.00 'F#
  125.             If notes = 17 Then note = 277.18 'C#
  126.             If notes = 18 Then note = 311.13 'D#
  127.             If notes = 19 Then note = 246.94 'B
  128.             If notes = 20 Then note = 0
  129.  
  130.             Do
  131.                 'queue some sound
  132.                 Do While _SndRawLen < 0.5 'you may wish to adjust this
  133.                     sample = Sin(ttt * note * Atn(1) * 8) '340Hz sine wave (ttt * 440 * 2p)
  134.                     sample = sample * Exp(-ttt * 3) 'fade out eliminates clicks after sound
  135.                     _SndRaw sample
  136.                     ttt = ttt + 1 / _SndRate 'sound card sample frequency determines time
  137.                 Loop
  138.                 'do other stuff, but it may interrupt sound
  139.             Loop While ttt < 1 'play for 1 second
  140.             Do While _SndRawLen > 0 'Finish any left over queued sound!
  141.             Loop
  142.             ttt = 0
  143.         Next notes
  144.         hour2 = hou
  145.         If hour2 > 12 Then hour2 = hour2 - 12
  146.         If hour2 = 0 Then hour2 = 12
  147.         For chimes = 1 To hour2
  148.             ttt = 0
  149.             Do
  150.                 'queue some sound
  151.                 Do While _SndRawLen < 0.1 'you may wish to adjust this
  152.                     sample = Sin(ttt * 240 * Atn(1) * 8) '340Hz sine wave (ttt * 440 * 2p)
  153.                     sample = sample * Exp(-ttt * 3) 'fade out eliminates clicks after sound
  154.                     _SndRaw sample
  155.                     ttt = ttt + 1 / _SndRate 'sound card sample frequency determines time
  156.                 Loop
  157.                 'do other stuff, but it may interrupt sound
  158.             Loop While ttt < 2 'play for 2 seconds
  159.             Do While _SndRawLen > 0 'Finish any left over queued sound!
  160.             Loop
  161.         Next chimes
  162.     End If
  163.     two:
  164.     a$ = InKey$
  165.     If a$ = Chr$(27) Then End
  166.     If a$ = " " Then song = 1
  167.     If a$ = "1" Then
  168.         rom = 0
  169.         For sz = .1 To 180 Step .1
  170.             Circle (300, 300), sz, _RGB32(0, 0, 0)
  171.         Next sz
  172.     End If
  173.     If a$ = "2" Then rom = 1
  174.     If a$ = "s" Or a$ = "S" Then
  175.         hour2 = hou
  176.         If hour2 > 11 Then
  177.             ampm$ = "P M"
  178.         Else
  179.             ampm$ = "A M"
  180.         End If
  181.         If hour2 > 12 Then hour2 = hour2 - 12
  182.         hour3$ = Str$(hour2)
  183.         hour4 = Val(hour3$)
  184.         If hour4 = 0 Then hour4 = 12
  185.         hour5$ = Str$(hour4)
  186.         min2 = Val(min$)
  187.         min3$ = Str$(min2)
  188.         seco2 = Val(seco$)
  189.         seco3$ = Str$(seco2)
  190.         sentence$ = "The time is " + hour5$ + ampm$ + min3$ + " minutes and " + seco3$ + " seconds."
  191.         speak sentence$, 1, 0
  192.     End If
  193.  
  194.  
  195. Sub pendulum (tt, d)
  196.     'Locate 1, d + 1: Print tt
  197.     If d = 0 Then tt = tt + (.26 / 2)
  198.     If d = 1 Then tt = tt - (.26 / 2)
  199.     If tt < 24.25 Then d = 0
  200.     If tt > 26 Then d = 1
  201.     theta = .3 * Cos(Timer)
  202.     x5 = (Sin(theta) * 80) + 300
  203.     y5 = (Cos(theta) * 80) + 300
  204.     For sz = -3 To 4
  205.         Line (300 + sz, 300)-(x5, y5), _RGB32(255, 255, 127)
  206.         Line (300, 300 + sz)-(x5, y5), _RGB32(255, 255, 127)
  207.     Next sz
  208.     For sz = .1 To 15 Step .1
  209.         Circle (x5, y5), sz, _RGB32(255, 255, 127)
  210.     Next sz
  211.     _Delay .06
  212.     _Display
  213.  
  214. Sub _GL ()
  215.     Static glInit
  216.     If glInit = 0 Then
  217.         glInit = 1
  218.  
  219.     End If
  220.     'set the gl screen so that it can work normal screen coordinates
  221.     _glTranslatef -1, 1, 0
  222.     _glScalef 1 / 400, -1 / 300, 1
  223.  
  224.     _glEnable _GL_BLEND
  225.  
  226.     _glBlendFunc _GL_SRC_ALPHA, _GL_ONE
  227.     _glEnableClientState _GL_VERTEX_ARRAY
  228.     _glVertexPointer 2, _GL_FLOAT, 0, _Offset(vert())
  229.     For j = 1 To 15
  230.         _glColor4f rFactor!, gFactor!, bFactor!, 0.015
  231.         _glPointSize j
  232.         _glDrawArrays _GL_POINTS, 10, max_v_index
  233.     Next
  234.     _glFlush
  235.  
  236. Sub speak (text As String, Speaker As Integer, Speed)
  237.     Dim message As String, remove$, out$
  238.     Dim As Long i, j
  239.     message = text
  240.     'some symbols and such can't be used with Powershell like this, as they're command symbols
  241.     'we need to strip them out of our text.  (Like apostrophes!)
  242.     remove$ = "'" + Chr$(34) 'add to remove$ here, if more symbols need to be removed as future testing showcases problems
  243.     For j = 1 To Len(remove$)
  244.         Do
  245.             i = InStr(message, Mid$(remove$, j, 1))
  246.             If i Then message = Left$(message, i - 1) + Mid$(message, i + 1)
  247.         Loop Until i = 0
  248.     Next
  249.     out$ = "Powershell -Command " + Chr$(34)
  250.     out$ = out$ + "Add-Type -AssemblyName System.Speech; "
  251.     out$ = out$ + "$Speech = New-Object System.Speech.Synthesis.SpeechSynthesizer; "
  252.     If Speaker = 0 Then out$ = out$ + "$Speech.SelectVoice('Microsoft David Desktop'); "
  253.     If Speaker = 1 Then out$ = out$ + "$Speech.SelectVoice('Microsoft Zira Desktop'); "
  254.     If Speed Then out$ = out$ + "$Speech.Rate =" + Str$(Speed) + "; "
  255.     out$ = out$ + "$Speech.Speak('" + message + "');" + Chr$(34)
  256.     Shell _Hide out$
  257.  
  258.  

9
Programs / Re: Jazzy Blocks 🟦🟥🟪🟩🟨🟧🎵🎶🔊
« on: March 25, 2022, 09:43:52 am »
saw this on reddit. nice.

10
QB64 Discussion / Re: What's your philosophy about constants?
« on: March 23, 2022, 06:33:00 pm »
my ted talk on const, 2022 edition:
const is completely redundant to ordinary variables, and its implemented more stupidly. so don't use it.
no, i mean it: const is nothing but a brain diaper. if you aren't sure whether you're editing your variables, you should go use an easy language like QBAS--- wait. step away from the computer instead.
... and that's what i say!

my credentials for having this opinion:
i do motivational talks for battered women and entertainment at youth mitzvah parties


11
Programs / Re: Garland of pearls
« on: March 22, 2022, 10:47:24 pm »
Yeah, this really is something special!

12
Programs / Re: Double Pendulum Studies
« on: March 22, 2022, 04:34:27 pm »
REDACTED

13
Programs / Finished Driven Pendulum + Mouse Toy
« on: March 22, 2022, 04:32:01 pm »
REDACTED

14
Programs / Re: Garland of pearls
« on: March 22, 2022, 10:52:40 am »
Hey MasterGy,

I think I understand what you're saying. I use a similar piece of mathematics for mouse controls in my pendulum code:

(There may be a version of it floating around that shows a trail behind the mouse pointer.)

Code: QB64: [Select]
  1. SUB RePin
  2.     DIM AS DOUBLE n
  3.     n = .05
  4.     mx0 = n * mx + (1 - n) * mx0
  5.     my0 = n * my + (1 - n) * my0

15
Programs / Re: Garland of pearls
« on: March 22, 2022, 06:07:00 am »
This program is incredibly fun to play with. Thanks very much for sharing MasterGy! This could most likely be used to study standing wave motion in flexible chains, both transverse and longitudinal waves. You always manage to pack so much action into your programs, it's impressive.

I'm pretty sure your program solves a thing called the "elastic catenary", which might just be a stretched-out version of a hyperbolic cosine. I'm not positive on that though, something tells me no closed solution exists, but I haven't tried the math by hand myself. Oh boy, here we go... (just kidding) No need to do the actual math, you've already got the simulation on hand!

I like that you mention spider webs. I think I can see what you're about to do next and it's very exciting!



Pages: [1] 2 3 ... 73