Author Topic: a new glitch of QB64 1.3 or an old glictch ?  (Read 3098 times)

0 Members and 1 Guest are viewing this topic.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
a new glitch of QB64 1.3 or an old glictch ?
« on: December 27, 2019, 05:28:06 pm »
Hi guys
during these Christmas holiday (not so long!) I have found a little time to open QB64IDE and compile just some code posted by all you!
Well during this my activity I fell in this glitch of QB64IDE....
you must do the same my steps to get the glitch result

1. paste a code working into QB64IDE that produces OK plus one or more warning in the Status section of the QB64IDE
if you have no one take this
Code: QB64: [Select]
  1. ' TDB 27 12 2019 (it)/ 2019 12 27 (international) dd-mm-yyyy/yyyy-mm-dd
  2. 'Hi here I play with code translating it into a more modular shape
  3. 'like SUBs FUNCTIONs and loops
  4.  
  5. 'I made this program for programmers that don't know too much math and need the coordinates of a circle.
  6. 'Of course you can always use the CIRCLE command but this could be needed to find partcular points.
  7. 'The more coordinates you make of the circle, the lesser gaps between pixels..
  8. 'Programmers can use the CircleCoordinates.txt to either copy/paste it into code or use it as a data file to read with their program.
  9. 'Made on Dec. 27, 2019 by Ken G.
  10. 'Freeware
  11.  
  12. DIM AnyMaxX AS INTEGER, AnyMaxY AS INTEGER, r AS INTEGER, Again AS INTEGER
  13. DIM xx AS INTEGER, yy AS INTEGER, co AS INTEGER, cco AS SINGLE, seconds AS SINGLE
  14. AnyMaxX = 800
  15. AnyMaxY = 600
  16. SCREEN _NEWIMAGE(800, 600, 32)
  17. Again = -1
  18. DO WHILE Again
  19.     HelpScreen
  20.     PRINT "Center Point Horizon X (between 0 and "; STR$(AnyMaxX) + "): ": INPUT xx
  21.     IF xx < 0 OR xx > 800 THEN Again = -1 ELSE Again = 0
  22.     PRINT "Center Point Vertical Y (between 0 and " + STR$(AnyMaxY) + "): ": INPUT yy
  23.     IF yy < 0 OR yy > 600 THEN Again = -1 ELSE Again = 0
  24.     INPUT "Center To Middle (radius larger than zero): ", r
  25.     IF r < 0 OR r = 0 THEN Again = -1 ELSE Again = 0
  26.     PRINT
  27.     PRINT "Choose how many coordinates you want here."
  28.     PRINT "(1) 61"
  29.     PRINT "(2) 601"
  30.     PRINT "(3) 6001"
  31.     PRINT
  32.     INPUT "->", co
  33.     IF co = 1 THEN cco = 1
  34.     IF co = 2 THEN cco = .1
  35.     IF co = 3 THEN cco = .01
  36.     IF co > 3 THEN Again = -1 ELSE Again = 0
  37. OPEN "CircleCoordinates.txt" FOR OUTPUT AS #1
  38.  
  39.     _LIMIT 200
  40.     seconds = seconds + cco
  41.     s = (60 - seconds) * 6 + 180
  42.     x = INT(SIN(s / 180 * 3.141592) * r) + xx
  43.     y = INT(COS(s / 180 * 3.141592) * r) + yy
  44.     WRITE #1, x, y
  45.     PSET (x, y), _RGB32(255, 255, 255)
  46.     IF seconds > 60 THEN
  47.         seconds = 0
  48.         CLOSE #1
  49.         PRINT "CircleCoordinates.txt has been created."
  50.         PRINT
  51.         PRINT "Goodbye."
  52.         END
  53.     END IF
  54.  
  55. SUB HelpScreen
  56.     CLS
  57.     PRINT "      Circle Coordinate Maker   by Ken G."
  58.     PRINT
  59.     PRINT "This program will create the file CircleCoordinates.txt"
  60.     PRINT "which will have x and then y coordinates of a circle."
  61.     PRINT "If this file already exists in this directory,"
  62.     PRINT "it will be deleted to make a new one."
  63.     PRINT "This screen is x=800 by y=600 coordinates big."
  64.     PRINT

2. now or you press F11 key or you click on menu RUN and then on MAKE EXE ONLY F11.
3. after compiled in the Status section of QB64IDE you get the output
Quote
.EXE file create
Location: c:\user1\program\...\.EXE
if now you leftclick on the path after location you'll get the glitch: instead of run the .EXE you get the warning box to reach the point  generating the warning!

Fine! :-) The Status section works yet as file hasn't been compiled!


Happy New Year Guys!
« Last Edit: December 28, 2019, 10:23:00 am by TempodiBasic »
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #1 on: December 27, 2019, 06:03:27 pm »
Hi TempodiBasic,

This terrible checking
Code: QB64: [Select]
  1.     PRINT "Center Point Horizon X (between 0 and "; STR$(AnyMaxX) + "): ": INPUT xx
  2.     IF xx < 0 OR xx > 800 THEN Again = -1 ELSE Again = 0
  3.     PRINT "Center Point Vertical Y (between 0 and " + STR$(AnyMaxY) + "): ": INPUT yy
  4.     IF yy < 0 OR yy > 600 THEN Again = -1 ELSE Again = 0
  5.     INPUT "Center To Middle (radius larger than zero): ", r
  6.     IF r < 0 OR r = 0 THEN Again = -1 ELSE Again = 0
  7.  

if r is right and x and/or y are wrong then wont go again to fix x and/or y

Oh it's worse! there is another check at bottom of block:
Code: [Select]
iF co > 3 THEN Again = -1 ELSE Again = 0so if co is OK then x, y, r are too???

I plugged in -100 for xx, yy, r and coo = 1 and got this but no exe glitch??? Did you expect a left click on the exe location to run the exe?
Quote
-111,-1
-121,-3
-131,-5
-141,-9
-151,-14
-159,-20
-167,-26
-175,-34
-181,-42
-187,-51
-192,-60
-196,-70
-198,-80
-200,-90
-200,-101
-200,-111
-198,-121
-196,-131
-192,-141
-187,-151
-181,-159
-175,-167
-167,-175
-159,-181
-150,-187
-141,-192
-131,-196
-121,-198
-111,-200
-100,-200
-90,-200
-80,-198
-70,-196
-60,-192
-50,-187
-42,-181
-34,-175
-26,-167
-20,-159
-14,-150
-9,-141
-5,-131
-3,-121
-1,-111
-1,-100
-1,-90
-3,-80
-5,-70
-9,-60
-14,-50
-20,-42
-26,-34
-34,-26
-42,-20
-51,-14
-60,-9
-70,-5
-80,-3
-90,-1
-101,-1
-111,-1





How 'bout:
Code: QB64: [Select]
  1.     bad = 0
  2.     HelpScreen
  3.     PRINT "Center Point Horizon X (between 0 and "; STR$(AnyMaxX) + "): ": INPUT xx
  4.     IF xx < 0 OR xx > 800 THEN bad = -1
  5.     PRINT "Center Point Vertical Y (between 0 and " + STR$(AnyMaxY) + "): ": INPUT yy
  6.     IF yy < 0 OR yy > 600 THEN bad= -1
  7.     INPUT "Center To Middle (radius larger than zero): ", r
  8.     IF r < 0 OR r = 0 THEN bad = -1
  9.     PRINT
  10.     PRINT "Choose how many coordinates you want here."
  11.     PRINT "(1) 61"
  12.     PRINT "(2) 601"
  13.     PRINT "(3) 6001"
  14.     PRINT
  15.     INPUT "->", co
  16.     IF co = 1 THEN cco = 1
  17.     IF co = 2 THEN cco = .1
  18.     IF co = 3 THEN cco = .01
  19.     IF co > 3 THEN bad = -1
  20. LOOP until bad = 0
  21.  
« Last Edit: December 27, 2019, 06:33:02 pm by bplus »

FellippeHeitor

  • Guest
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #2 on: December 27, 2019, 08:52:28 pm »
I had already noticed the incorrect status link, Tempodi. Thanks for reporting, it'll be fixed before the next version comes out.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #3 on: December 28, 2019, 05:10:47 am »
Sorry Bplus for my lazyness to not test the conditions

in a first time I have thought to invert simply the condition operator the > with < and viceversa
then I have thought to MOD so much the structure of the program and I have hoped that an ELSE can solve this issue but I have done no test of  the flow.
A little voice in my head said me to add another condition to the stressed conditional block (an
Code: QB64: [Select]
  1. AND Again = -1
but at the end the lazyness won!

about
Quote
I plugged in -100 for xx, yy, r and coo = 1 and got this but no exe glitch??? Did you expect a left click on the exe location to run the exe?

Does your QB64IDE toss a warning of variable unused in Status window when you paste the code that I have posted?
It must for
Code: QB64: [Select]
, but if no you must only add a variable unused in declaration with DIM or as parameter of some SUB or FUNCTION

Thanks for feedback

PS
I love this community!
Happy New Year  and don't make a wish if you don't want to realize it!
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #4 on: December 28, 2019, 07:18:48 am »
Oh damn lazyness!

it was only needed to nest the IF to reach the goal without no more complications

Code: QB64: [Select]
  1. ' TDB 27 12 2019 (it)/ 2019 12 27 (international) dd-mm-yyyy/yyyy-mm-dd
  2. 'Hi here I play with code translating it into a more modular shape
  3. 'like SUBs FUNCTIONs and loops
  4.  
  5. 'I made this program for programmers that don't know too much math and need the coordinates of a circle.
  6. 'Of course you can always use the CIRCLE command but this could be needed to find partcular points.
  7. 'The more coordinates you make of the circle, the lesser gaps between pixels..
  8. 'Programmers can use the CircleCoordinates.txt to either copy/paste it into code or use it as a data file to read with their program.
  9. 'Made on Dec. 27, 2019 by Ken G.
  10. 'Freeware
  11.  
  12. DIM AnyMaxX AS INTEGER, AnyMaxY AS INTEGER, r AS INTEGER, Again AS INTEGER
  13. DIM xx AS INTEGER, yy AS INTEGER, co AS INTEGER, cco AS SINGLE, seconds AS SINGLE
  14. AnyMaxX = 800
  15. AnyMaxY = 600
  16. SCREEN _NEWIMAGE(800, 600, 32)
  17. Again = -1
  18. DO WHILE Again = -1
  19.     HelpScreen
  20.     PRINT "Center Point Horizon X (between 0 and "; STR$(AnyMaxX) + "): ": INPUT xx
  21.     IF xx < 0 OR xx > 800 THEN
  22.         Again = -1
  23.     ELSE
  24.         Again = 0
  25.         PRINT "Center Point Vertical Y (between 0 and " + STR$(AnyMaxY) + "): ": INPUT yy
  26.         IF yy < 0 OR yy > 600 THEN
  27.             Again = -1
  28.         ELSE
  29.             Again = 0
  30.             INPUT "Center To Middle (radius larger than zero): ", r
  31.             IF r <= 0 THEN
  32.                 Again = -1
  33.             ELSE
  34.                 Again = 0
  35.                 PRINT
  36.                 PRINT "Choose how many coordinates you want here."
  37.                 PRINT "(1) 61"
  38.                 PRINT "(2) 601"
  39.                 PRINT "(3) 6001"
  40.                 PRINT
  41.                 INPUT "->", co
  42.                 IF co < 1 OR co > 3 THEN
  43.                     Again = -1
  44.                 ELSE
  45.                     IF co = 1 THEN cco = 1
  46.                     IF co = 2 THEN cco = .1
  47.                     IF co = 3 THEN cco = .01
  48.                 END IF
  49.             END IF
  50.         END IF
  51.     END IF
  52.  
  53. OPEN "CircleCoordinates.txt" FOR OUTPUT AS #1
  54.     _LIMIT 200
  55.     seconds = seconds + cco
  56.     s = (60 - seconds) * 6 + 180
  57.     x = INT(SIN(s / 180 * 3.141592) * r) + xx
  58.     y = INT(COS(s / 180 * 3.141592) * r) + yy
  59.     WRITE #1, x, y
  60.     PSET (x, y), _RGB32(255, 255, 255)
  61.     IF seconds > 60 THEN
  62.         seconds = 0
  63.         CLOSE #1
  64.         PRINT "CircleCoordinates.txt has been created."
  65.         PRINT
  66.         PRINT "Goodbye."
  67.         END
  68.     END IF
  69.  
  70. SUB HelpScreen
  71.     CLS
  72.     PRINT "      Circle Coordinate Maker   by Ken G."
  73.     PRINT
  74.     PRINT "This program will create the file CircleCoordinates.txt"
  75.     PRINT "which will have x and then y coordinates of a circle."
  76.     PRINT "If this file already exists in this directory,"
  77.     PRINT "it will be deleted to make a new one."
  78.     PRINT "This screen is x=800 by y=600 coordinates big."
  79.     PRINT
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #5 on: December 28, 2019, 10:24:37 am »
Here screenshot of glitch
  [ You are not allowed to view this attachment ]  
thanks to give a look
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #6 on: December 28, 2019, 10:50:05 am »
Quote
Does your QB64IDE toss a warning of variable unused in Status window when you paste the code that I have posted?

Yes, both before the exe is compiled and then when I left clicked the the little message made after F11 compile. I never took it for a glitch, I just assumed it was getting back to it's warning about variable m not being used.

I know this is not the topic of this tread but it seems we've stumbled upon a pretty good case to use GOTO instead of modern looping structures, at least in my opinion.

I can't believe I was thinking more and more about this little example of getting proper INPUT's from the user last night. But it is always a little nightmare to anticipate any crazy thing a user may try to INPUT to keep the code bullet-proof and this that I see this morning is perfect example!:
Code: QB64: [Select]
  1. Again = -1
  2. DO WHILE Again = -1
  3.     HelpScreen
  4.     PRINT "Center Point Horizon X (between 0 and "; STR$(AnyMaxX) + "): ": INPUT xx
  5.     IF xx < 0 OR xx > 800 THEN
  6.         Again = -1
  7.     ELSE
  8.         Again = 0
  9.         PRINT "Center Point Vertical Y (between 0 and " + STR$(AnyMaxY) + "): ": INPUT yy
  10.         IF yy < 0 OR yy > 600 THEN
  11.             Again = -1
  12.         ELSE
  13.             Again = 0
  14.             INPUT "Center To Middle (radius larger than zero): ", r
  15.             IF r <= 0 THEN
  16.                 Again = -1
  17.             ELSE
  18.                 Again = 0
  19.                 PRINT
  20.                 PRINT "Choose how many coordinates you want here."
  21.                 PRINT "(1) 61"
  22.                 PRINT "(2) 601"
  23.                 PRINT "(3) 6001"
  24.                 PRINT
  25.                 INPUT "->", co
  26.                 IF co < 1 OR co > 3 THEN
  27.                     Again = -1
  28.                 ELSE
  29.                     IF co = 1 THEN cco = 1
  30.                     IF co = 2 THEN cco = .1
  31.                     IF co = 3 THEN cco = .01
  32.                 END IF
  33.             END IF
  34.         END IF
  35.     END IF
  36.  

What gets me about my fix and this, TempodiBasic's above, and Ken's original where this code comes from, all, have problem if one thing is messed up we have to start over again with the 20 questions. Never liked the 20 questions game with INPUT to begin with and explains why multiple choice or GUI has become so popular since computer automation and programming.

So what is better (if not using multiple choice, or slider, or GUI)?

Do each question in a loop either GOTO or modern form with check and feedback if incorrect :

Code: QB64: [Select]
  1. inputxx:
  2. input "Enter x, such that x >= 0 and x <= 800, (-1 to quit) ";xx
  3. if xx = -1 then system '>>>>>>>>>> allow quit
  4. if xx <0 or xx > 800 then print "x is not right, try again... ": goto inputxx

Code: QB64: [Select]
  1.   OK = -1 ' <<< edit move OK = true  into loop
  2.    input "Enter x, such that x >= 0 and x <= 800, (-1 to quit) ";xx
  3.    if xx = -1 then system '>>>>>>>>>> allow quit
  4.    if xx < 0 or xx > 800 then OK = 0 :  print "x is not right, try again... "

Of course, still might need to work on scrolling screen or clear screen for each question.
« Last Edit: December 28, 2019, 11:13:46 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #7 on: December 28, 2019, 10:52:37 am »
Here screenshot of glitch
  [ You are not allowed to view this attachment ]  
thanks to give a look

Oh it's a mislabeled title on the warning message, I see it now!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #8 on: December 28, 2019, 11:54:05 am »
Dear Bplus

1. GOTO + Label & GOSUB + RETURN + label vs SUB & loops is wasting time.  If the program runs and do its works the rest is about the style of coding of programmer. So my more modular modification is just to give a different face to the program. Never thought that Ken's version is bad or inferior, just spaghetti and remember I love spaghetti ;-) I'm from Italy.

2. in my last memory (now I use always F5)  about F11 and then double click on the path of compiled file  .EXE I remember that I could get the running program, and now it triggers the warning feedback window to bring me to the code of warning.
I don't know more.

I thank you for your time and your feedbacks!
I hope  to gain no angry of moderator for this one post a bit off topic about point 1.
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #9 on: December 28, 2019, 12:01:29 pm »
Dear Bplus

1. GOTO + Label & GOSUB + RETURN + label vs SUB & loops is wasting time.  If the program runs and do its works the rest is about the style of coding of programmer. So my more modular modification is just to give a different face to the program. Never thought that Ken's version is bad or inferior, just spaghetti and remember I love spaghetti ;-) I'm from Italy.

2. in my last memory (now I use always F5)  about F11 and then double click on the path of compiled file  .EXE I remember that I could get the running program, and now it triggers the warning feedback window to bring me to the code of warning.
I don't know more.

I thank you for your time and your feedbacks!
I hope  to gain no angry of moderator for this one post a bit off topic about point 1.

Hi TempodiBasic,

I don't think you understood my point. If you have 10 INPUTS to get from a user and the user screws up one, why make them go through all 10 INPUT's again? Why not get each one right before moving onto next INPUT?

This isn't about coding style, it is about being merciful to your user :D

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #10 on: December 29, 2019, 09:01:31 am »
I agree Bplus
changing the shape I don't change the design of the application!
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: a new glitch of QB64 1.3 or an old glictch ?
« Reply #11 on: December 29, 2019, 09:59:15 am »
Hi about the glicth

1. it is also in Development version 64bits

2. if you have no set the option of menu RUN: Output  EXE to source folder there is no glitch
because there is no path on which we can click by mouse.

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