Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / [Semi-newbie] So slow I don't know if it's running right...

Author
Message
Mr909
11
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 10th Oct 2012 21:47
So, I had this system running for analyzing graphs of the Gaussian distribution as calculated with the rough equivalent of 10d10. It used to be working perfectly until I tweaked some of the code with hopes of implementing a system to be able to read the data in chart form, and now I'm not sure what I messed up. It used to be working fine, now it barely loads and I'm unsure what I could have possibly done to the code to make it go so slowly, I practically put it exactly where it was before I implemented the charting system.

So if anyone could look at this code and, if you have a higher-end rig, maybe try compiling it and telling me if this is just my computer or me. Like I said, it used to be running fine, but I don't know if I threw a wrench in on accident or not.

Attachments

Login to view attachments
mistsnake
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Inside the matrix
Posted: 11th Oct 2012 22:21
essentially the issue is ancient coding state, remember to use functions rather than the primitive goto/gosub
oh and indentation is real nice to have

i presume this is how you meant it to be
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Oct 2012 01:24
All I get is Count:10 and a red line...

What is supposed to happen?

mistsnake
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Inside the matrix
Posted: 12th Oct 2012 02:35
press the up key and it draws something
Mr909
11
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 12th Oct 2012 03:02
Hmmmm... it's funny because I have plenty of people who say use GOSUB instead of GOTO and to use functions sparingly XD Well, thank you very much mr. mistsnake. I really do need to get the hang of functions. :\

And to Mr. Valentine, it checks integrity and observes results for random number generators, essentially. The green line is 10 random numbers between 1 and 10 (like 10d10 on dice), the yellow is 12d10, minus the lowest 2, and the red is 14d10, minus four.
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Oct 2012 03:10
Nifty! and has me thinking about my latest project!

mistsnake
14
Years of Service
User Offline
Joined: 24th Apr 2010
Location: Inside the matrix
Posted: 12th Oct 2012 14:08
Quote: "it's funny because I have plenty of people who say use GOSUB instead of GOTO and to use functions sparingly"

i find it odd any people say to use at all - wide and far, i've seen people spitting on the idea of ever using those commands cause they were what led to 'spaghetti code' in the early-mid 80's

a function with no parameters is the same as a gosub except its more neater presented as code segment, underlying code wise there no difference but functions excel above the gosub cause they allow parameters to be passed without the need of having everything as a global variable - also a looked down on practice, a function can also return a value from it

as a side note, you'll encounter functions any other language but i'm not sure of any outside of basic containing goto/gosub so its good practice to be familar
Mr909
11
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 12th Oct 2012 20:43
Well, I'm starting to see where it's good form, however to be fair the code you posted doesn't work properly as the variables "count" and "seed_base" are supposed to be global. It's okay, you didn't know.


Mr.Valentine, in order to fix the code posted, append the color library (#CONSTANT) with these two lines:

GLOBAL count
GLOBAL seed_base

(Sorry, don't know spoiler tags)
Once you have those two lines, it'll show you the proper bell curve distribution.
Oh, and if you're using my code, my piffy little obvious color constants, or my random number generators, PLEASE credit me. I'm also working on more algorithms and systems for my personal projects, and if you want some assistance with number-crunching I might be able to help.
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Oct 2012 03:52
No, I do not understand its purpose eitherway...

And the code is not something I would personally benefit from in any way...

I said it had me thinking... not, I may have use for this code...

Just crarifying that

I might try that change when I have more time...

And for heavens sake it's MrValentine

Login to post a reply

Server time is: 2024-04-27 08:58:49
Your offset time is: 2024-04-27 08:58:49