Welcome, Guest |
You have to register before you can post on our site.
|
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
|
|
|
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....
|
|
|
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
|
|
|
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
|
|
|
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! 
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.
|
|
|
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
|
|
|
|