Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 318
» Latest member: coletteleger
» Forum threads: 1,745
» Forum posts: 17,906

Full Statistics

Latest Threads
astuce pour survivre fina...
Forum: Utilities
Last Post: coletteleger
05-14-2025, 04:47 AM
» Replies: 0
» Views: 11
trouver permis de conduir...
Forum: Utilities
Last Post: nicolasrene
05-05-2025, 05:24 AM
» Replies: 0
» Views: 19
LIGHTBAR Menu
Forum: Programs
Last Post: nicolasrene
05-05-2025, 05:08 AM
» Replies: 15
» Views: 945
Learning Pallet Rack Safe...
Forum: Utilities
Last Post: Sandrapew
04-03-2025, 09:36 AM
» Replies: 0
» Views: 39
Choosing New Versus or Pr...
Forum: Utilities
Last Post: Sandrapew
03-18-2025, 01:11 AM
» Replies: 0
» Views: 33
The QB64 IDE shell
Forum: Utilities
Last Post: JasonPag
09-16-2024, 05:37 PM
» Replies: 9
» Views: 1,059
Importance regarding Ches...
Forum: Utilities
Last Post: JasonPag
09-01-2024, 06:34 PM
» Replies: 0
» Views: 71
Chess and Analysis and En...
Forum: Utilities
Last Post: JasonPag
08-28-2024, 02:37 PM
» Replies: 0
» Views: 68
DAY 009:_PutImage
Forum: Keyword of the Day!
Last Post: grymmjack
09-02-2023, 02:57 PM
» Replies: 54
» Views: 3,440
Fall Banner Contest?
Forum: Site Suggestions
Last Post: grymmjack
08-31-2023, 11:50 PM
» Replies: 36
» Views: 2,169

 
  QB64PE Discord Integration is now in place.
Posted by: grymmjack - 06-03-2023, 06:54 PM - Forum: Announcements - No Replies

We have implemented an integration between this forum and the QB64PE Discord.

This is a one way integration FROM the forum TO the Discord (trust us you want it this way!)

Thanks

Print this item

  Welcome grymmjack as Forum Guru!
Posted by: SMcNeill - 06-03-2023, 06:53 PM - Forum: General Discussion - Replies (12)

Everyone give a big hand of applause and many thanks to grymm for volunteering to step up and help with our server and forum maintenance and usability.  Pete was helping me with these things, but he's wandered off into the sunset after all the flooding his area of the world got since last December, and nobody's heard from him since.  (Let's all pray he's good and just dealing with insurance issues and such and simply hasn't felt like being indoors or programming for a while, and that nothing bad happened to him.)

Grymm's taken over handling our back-end server maintenance, and it's all thanks to him and @dbox that we can now embed QBJS in posts here and run those programs and examples.  He's currently at work on integrating our forum notifications so they appear in Discord for us, and who knows what improvements, optimizations, and fixes he'll bring in the future!  (After all, he's only been on the job for all of 2 days now, I think, and he's already finished the QBJS iFrame stuff!)

Any suggestions, issues, fixes, kindly @grymmjack with your concerns, and be certain to thank him for all his hard work and efforts.  Like everyone else who contributes to this project, grymm is doing so of his own free will and in his own free time, with no pay or reimbursement for his work.  Let him know if there's something he might can look into and help with, but as always -- be respectful and don't expect things to change instantly just cause someone reported something or requested something.  He's got a life, and he's got a right to live it first and foremost -- like any other dev here -- and even moreso, he now has admin rights and can ban those who are too pestersome for him....  

Wink

Print this item

Lightbulb qbjs evolving program #1
Posted by: grymmjack - 06-03-2023, 05:27 PM - Forum: QBJS, BAM, and Other BASICs - Replies (28)

On IRC back in the day, we used to play "neverending story".

How it worked:

The first person would provide a sentence or paragraph.

The next person picks up where that last person left off and continues.

e.g.:

First person: Once upon a time there was a pig that
Second person: had smelly breath and could talk like a human.

Story then is concatenated from that point:

"Once upon a time there was a pig that had smelly breath and could talk like a human."

... repeat ...

Let's try the same thing with qbjs!

The only change would be that you have to copy and paste the code from what you make into a new one in the qbjs.org site to get your version to persist for everyone. The other thing would be we should try to preserve what already is there, but extend on it. That is, don't do asshole things like in a SCREEN 0 text start thing, CLS the damned screen (be kind and have fun)?

Let's see what happens and where it goes.

@dbox you go first!

Print this item

Star qbjs bbcode now available!
Posted by: grymmjack - 06-03-2023, 02:55 PM - Forum: Announcements - Replies (11)

You can now use [qbjs] bbcode in your posts to embed qbjs.org code and play with it directly in the thread.

What is qbjs?
QBJS is an opensource project created by @dbox

QBJS is an implementation of the Basic programming language for the web, with multimedia support and easy sharing of programs. It aims to be compatible with QB64, which in turn implements the same dialect as the classic QBasic.

Support for browser APIs is built-in as of version 0.3.0-beta; a game engine is included separately.

Check it out on the qbjs GitHub

How do I use it?

  1. Go to https://qbjs.org
  2. Write some code
  3. Click the share button
  4. Copy the share link from the dialog to clipboard
  5. In forum use CTRL-SHIFT-S to switch to source mode (for whitespace preservation)
  6. Type: [qbjs]
  7. Paste from clipboard
  8. Type: [/qbjs]

Like this:

[Image: qbjs-share.png]


Anything you've made in qbjs.org IDE can be embedded in the new [qbjs] bbcode. You simply click the share button in qbjs.org, and copy the text and insert it between [qbjs] and [/qbjs] -- or you can just paste your share link from qbjs.org, select it, and click the QBJS button in the toolbar to wrap it in the new [qbjs] bbcode.

Here is an example:


(click the Play button to RUN it)

YOU CAN DO ALMOST ANYTHING YOU CAN DO IN QBASIC and QB64!
See: QBasic Language Support in QBJS
And: QBJS Supported Keywords (includes QBASIC and QB64, etc.)

Learn More:

Print this item

  BAM thingies in the works
Posted by: CharlieJV - 06-03-2023, 03:36 AM - Forum: QBJS, BAM, and Other BASICs - Replies (19)

Currently in the works (click here for details; click here to try the test version of BASIC Anywhere Machine)

  • Documentation: setup the architectural components for syntax diagrams, and start using/testing syntax diagrams with the statements/functions/operators below
  • Enhanced debugging: added generic code issue notification and viewing mechanism, and specific catching missing definitions for SUB and FUNCTION declarations
  • Added UrlQueryString$ function
  • Added UrlKey$ function
  • Added IFF function
  • Added MIN and MAX functions
  • Added BIN$ keyword (alternative name for already existing _BIN$ function)
  • Added DAY$ function
  • Added DIV keyword (alternative for the already existing "\", i.e. integer division, operator)
  • Added FRAC function
  • Added BETWEEN function
  • Added CHOOSE function
  • Enhanced compatibility of DEFtype statements
  • Enhanced compatibility of _BIN$, HEX$, OCT$ functions
  • Enhanced compatibility of SLEEP statement
  • Enhanced compatibility of INSTR function 
  • Enhanced compatibility of RANDOMIZE function 
  • Enhanced compatibility of INTEGER data type
  • Fixed the WIDTH statement: fixed a little glitch and documented behaviour
  • Added the HEIGHT statement (WIDTH specifying the number of text columns, why not be able to specify the number of rows?)
  • Added PUTSTRING statement
  • Added SCROLL statement

Print this item

  niXman gcc-13.1.0
Posted by: Jack - 06-02-2023, 10:14 AM - Forum: General Discussion - Replies (5)

niXman has updated gcc version from 12.2.0 to 13.1.0, I tried it and so far no problems

Print this item

  On Exit question
Posted by: NasaCow - 06-02-2023, 03:50 AM - Forum: Help Me! - Replies (52)

I am trying to control exiting to prevent work from getting loss and adding some basic code related to EXIT is having my program crash out with Error 10 - Duplicate definition (The error points to the label ShutDown). I tried to step through it to see how the program flows exactly but with no success. Is running the timer all the time to check a bad idea for complex programs? Getting it to work with a simple loop seems to be no problem, inserting into Grade Keeper seems to be breaking something...


Quote:'Disabling the default exit routinue
ExitFlag = EXIT
ON TIMER(1) GOSUB ShutDown
TIMER ON
...
ShutDown:
ExitFlag = EXIT
IF ExitFlag THEN SYSTEM
RETURN

Print this item

  BAM: One way to implement a colour picker
Posted by: CharlieJV - 06-01-2023, 10:53 PM - Forum: QBJS, BAM, and Other BASICs - No Replies

(Code below the running program.  Clicking on, or touching for touch devices, a colour will result in a popup saying what colour was selected.)

https://basicanywheremachine.neocities.o...lor_picker

Print this item

  Comb Sort versus Quick Sort
Posted by: bplus - 05-30-2023, 07:06 PM - Forum: Utilities - Replies (13)

I thought johnno had a contender for QSort when I ran 1 Million Numbers on QB64, it beat my Strings Quick Sort test times, BUT! When I compare the exact same String arrays QSort clearly wins every time! Smile

Here is my test code, both take the string array to sort as a parameter and QSort needs a high and low index, because it calls itself recursively:

Code: (Select All)
Option _Explicit
_Title "Comb Sort vrs Quick Sort" ' b+ 2023-05-30
Randomize Timer ' so we have a different array each time we compare

DefLng A-Z
Const nItems = 1000000
Dim sa$(1 To nItems) ' setup a string array sa$() to sort
Dim copy$(1 To nItems) ' make a copy of sa$() to compare another sort to
Dim As Long i, j ' indexes to array  for building and displaying the arrays
Dim As Long r '  a random posw integer = 2 to 6
Dim t##, qtime##, ctime##
Dim b$ ' building string
For i = 1 To nItems ' make a random list to sort
    b$ = ""
    r = (Rnd * 5) \ 1 + 2
    For j = 0 To r
        b$ = b$ + Mid$("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.?", (Rnd * 64) \ 1 + 1, 1)
    Next
    sa$(i) = b$
    copy$(i) = b$
    Print b$,
Next
Print
Print "Press any to Quick Sort"
Sleep
Cls
t## = Timer(.001)
QuickSort 1, nItems, sa$()
qtime## = Timer(.001) - t##
For i = 1 To 10
    Print sa$(i),
Next
Print: Print
For i = nItems - 9 To nItems
    Print sa$(i),
Next
Print: Print
Print "   Quick Sort time:"; qtime##
Print
Print "   Press any to Comb Sort with array copy, zzz..."
Print
Print
Sleep
t## = Timer(.001)
CombSort copy$()
ctime## = Timer(.001) - t##
For i = 1 To 10
    Print copy$(i),
Next
Print: Print
For i = nItems - 9 To nItems
    Print copy$(i),
Next
Print: Print
Print "   Comb Sort time:"; ctime##
Print
If ctime## < qtime## Then Print "   Comb winds!" Else Print "   QSort wins again!"


Sub QuickSort (start As Long, finish As Long, arr$())
    Dim Hi As Long, Lo As Long, Middle$
    Hi = finish: Lo = start
    Middle$ = arr$((Lo + Hi) / 2) 'find middle of arr$
    Do
        Do While arr$(Lo) < Middle$: Lo = Lo + 1: Loop
        Do While arr$(Hi) > Middle$: Hi = Hi - 1: Loop
        If Lo <= Hi Then
            Swap arr$(Lo), arr$(Hi)
            Lo = Lo + 1: Hi = Hi - 1
        End If
    Loop Until Lo > Hi
    If Hi > start Then Call QuickSort(start, Hi, arr$())
    If Lo < finish Then Call QuickSort(Lo, finish, arr$())
End Sub

' trans from johnno ref: https://rcbasic.freeforums.net/thread/779/sort-algorithms
Sub CombSort (arr$())
    Dim As Long itemCount, start, fini, swaps, gap, i
    start = LBound(arr$)
    itemCount = UBound(arr$) - start + 1
    fini = start + itemCount - 1
    gap = itemCount
    While gap > 1 Or swaps <> 0
        gap = Int(gap / 1.25)
        If gap < 1 Then gap = 1
        swaps = 0
        For i = start To itemCount - gap
            If arr$(i) > arr$(i + gap) Then
                Swap arr$(i), arr$(i + gap)
                swaps = 1
            End If
        Next
    Wend
End Sub
 I think I have Comb Sort generalized enough to be flexible to start with it's lower bound and end with it's upper bound.

Print this item

  A distorted image
Posted by: Petr - 05-29-2023, 10:10 PM - Forum: Programs - Replies (2)

This is just an example of how you can deform images using maptriangle 2D. On line 10, just overwrite the image name with a valid name for your image. Then after launch just move with the mouse.

Code: (Select All)
'image deform demo by Petr
$NoPrefix
Screen NewImage(1024, 768, 32)

DOWN = Height * .7
UP = Height * .3
Gstep = 3 '1 is smoothest cut, best output but "low" speed
ASize = Fix(Width / Gstep)

image& = LoadImage("img.jpg", 32)
v& = _NewImage(1024, 768, 32) 'set image to the same width and height as screen to handle v&
PutImage , image&, v&
FreeImage image&

Dim As Integer XX(ASize), YY(ASize), YY2(ASize)

Do
    While MouseInput
    Wend
    Cls

    i = 0
    XSTEPL = Gstep * Pi / 2 / MouseX '    program use for deformations SINUS so is image width and height recalculated to radians here
    XSTEPR = Gstep * Pi / 2 / (Width - MouseX)
    YP = (-Height / 2 + MouseY)

    For XD = 1 To MouseX Step Gstep
        X = XD
        Y = DOWN + Sin(XP) * YP
        Y2 = UP + Sin(XP) * -YP
        XP = XP + XSTEPL
        XX(i) = X
        YY(i) = Y
        YY2(i) = Y2
        i = i + 1
    Next


    For XD = MouseX To Width - 1 Step Gstep
        X = XD
        Y = DOWN + Sin(XP) * YP
        Y2 = UP + Sin(XP) * -YP
        XP = XP + XSTEPR
        XX(i) = X
        YY(i) = Y
        YY2(i) = Y2
        i = i + 1
    Next
    i = i - 1

    XP = 0

    For MPT = 0 To i - 1
        XS = MPT * Gstep 'step in x in 2d
        XS2 = (MPT + 1) * Gstep

        ScrX = XX(MPT)
        ScrX2 = XX(MPT + 1)
        ScrY2 = YY(MPT)
        ScrY = YY2(MPT + 1)

        MapTriangle (XS, 0)-(XS2, 0)-(XS, 768), v& To(ScrX, ScrY)-(ScrX2, ScrY)-(ScrX, ScrY2), 0
        MapTriangle (XS2, 0)-(XS, 768)-(XS2, 768), v& To(ScrX2, ScrY)-(ScrX, ScrY2)-(ScrX2, ScrY2), 0
    Next

    Display
    Limit 120
Loop

Print this item