QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Pete on November 19, 2018, 01:25:07 pm

Title: How big is yours?
Post by: Pete on November 19, 2018, 01:25:07 pm
Back in the day, when dinosaurs roamed the Earth and QBasic only had 64K worth of memory, about 4x that if you knew how to use the multi-modular capability, but I digress, coders had to figure out how to optimize large projects. Now that QB64 has been around about 10 years, those limits have been vanquished; so I was wondering... What is the largest (most lines of code) program any of you have written? I'll just add one criterion for reporting...

Please separate out DATA. In other words a program with 100 lines of statements and 100000 lines of copied and pasted data isn't "code" it's filler.

I'll start. My QBasic written office software project, whicj I consolidated when QB64 came out, turned out to be...

Code Statements: 86,000 lines (2.85 MB)
Data: Approx 1000 lines kept in external files.


I thought up this topic based on the discussion thread about embedding files: https://www.qb64.org/forum/index.php?topic=790.0

I think 10 years ago 80+ thousand line programs were pretty rare, but I bet a lot of you have had some pretty big or bigger monster projects over the past years, too. I know, I know, bigger isn't always better. Oh wait, who are we kidding!

Pete
Title: Re: How big is yours?
Post by: johnno56 on November 19, 2018, 03:51:40 pm
Wow! 86,000+ lines of code. Most impressed... I struggle just keeping a reasonable track of 100+ lines... You MUST have a secret...

J
Title: Re: How big is yours?
Post by: Pete on November 19, 2018, 04:36:13 pm
I used to have a secret, but I was afraid it would get out. So I sold all the used whips and chains, and started mega-coding! It's cheaper, and considerably more painful... I mean satisfying!

Pete :D
Title: Re: How big is yours?
Post by: RhoSigma on November 19, 2018, 06:41:07 pm
Well Pete, you have a really big one, my GuiTools project counts to approx. 15000 lines, but is scattered over two dozens files. Data lines are negligible, but approx. 20-25% of it are just comments, as every sub/function has a description block noting its usage, inputs and results.
Title: Re: How big is yours?
Post by: SMcNeill on November 19, 2018, 06:51:09 pm
A few years back, I got hired by the local historical society to help them organize their records, and that ended up being a program which was several hundred thousand lines long.  Data entry, sorting, indexing, searches, and a custom graphical interface were all required to meet their needs.  It took me a little over a month to write the data handling part, at which point I assigned two of my farm hands to data entry work which lasted them both for several years, and then I spent who knows how long working out the GUI and making small tweaks to the society's specifications.

I'd share the code, as I'm rather proud of how it all turned out, except they refused to allow any rights with it due to "security concerns".   The source code is stored in a non-password protected folder on their local server in the courthouse basement; it's written in BASIC; and they're worried over "security" from sharing the source to people who'll never be able to access their off-line system...   
Title: Re: How big is yours?
Post by: Pete on November 19, 2018, 07:00:22 pm
Do you recall approximately how many lines were code statements?
Title: Re: How big is yours?
Post by: STxAxTIC on November 19, 2018, 08:12:57 pm
This thread reminds me to either (i) invent, or (ii) ask Luke if there exists - a convention for calculating the "entropy" of source code. Things like comments, DATA statements, and oft-repeated patterns will have small representation compared to the actual statements that get things done... Because talking about raw numbers is a complete dead end.

Example: because who never saw The Shining? ... If I write 10 PRINT "All play and no work makes Jill a fun girl" a million times, that can be reduced to like, 2 or 3 unique items. The obvious reduction is to capture the work of pasting 999,999 instances of a line be imagining a loop structure doing the same thing... *provided* that the individual PRINT statements don't change the program state or interact with something in a nontrivial way (obviously not in the case of PRINT). Meaning this (as a counter-example): If I count all the times in a program that "i = i + 1" occurs, I don't get to lump all those together - context probably mattered in each case.

Anyway, we need a new measuring tool.

I propose we flip this on its head: instead of asking about our memory's biggest program designed for a big and specific task that doesnt work anymore (or is inaccessible), we should compare sizes by flaunting the *smallest* complete work we have that can do the *most*. Flip the competition on its polished little head, amirite?
Title: Re: How big is yours?
Post by: Pete on November 19, 2018, 08:22:30 pm
What are you trying to compensate for Bill?  Oh, you mentioned you needed a new tool. Toshiba!:D

Hey wait, this isn't actually a competition. It's more a census. Back in the QB45 era, programmers who wanted to make big applications got beat up bloody by the memory limits; so most coders back then didn't stick with that language if they wanted to accomplish a work that required a lot of code. Now we don't have those limits, so I was just curious how other programmers here have taken advantage of this major product improvement.

I do agree with your comments about quality vs quantity. I should have included that I left out comment lines, because back then I didn't use them. I'm older now, and finally appreciate the REM statement.

Pete

Title: Re: How big is yours?
Post by: STxAxTIC on November 19, 2018, 08:26:29 pm
Yeah no worries - not attempting to derail the confidence contest here.

To answer the question on hand, no program o' mine has ever surpassed say, 8000 lines.

Oooey, I just thought of another metric. This one may be useful actually - and that is to create a histogram of the indentations of each line. The first layer in a DO...LOOP or IF...THEN is indented once, nested things once more, and so on. I wonder what the shape would be. Gaussian?
Title: Re: How big is yours?
Post by: Pete on November 19, 2018, 08:39:51 pm
You know I never used to indent, either. I think a few years ago a particularly heavily nested loop caused me to change my mind on that, too. If I had to guess, it would probably have been 14 or more loop/next/then/case situations. Probably 800 lines of nests.

8000 is no small matter. That would have maxed out QB45 with modules.

I'd like to take a peek at Steve's, but he keeps insisting I show him mine, first.

Pete
Title: Re: How big is yours?
Post by: SMcNeill on November 19, 2018, 08:40:17 pm
@STxAxTIC: Have you ever seen a program written by ARB.  (You probably remember him as Anthony for Walt's site.  Pete will remember him as, "Crazy Ass Spammer-Dude over at N54.)

He writes the longest programs I've *EVER* saw, and it's all for one reason:  He doesn't understand arrays, so he doesn't use them.  One of his lottery prediction programs had a sort routine in it which astounded me at the complexity behind it...

If Var1 < Var2 THEN SWAP Var1, Var2
If Var1 < Var3 THEN SWAP Var1, Var3
If Var1 < Var4 THEN SWAP Var1, Var4
.... Copy/paste for Var1, 100 times...  Then Var2, 100 times...  Then Var3, 100 times...  And on till Var100, 100 times...

And the whole program was like that.  No LOOPs as he didn't use arrays, so trying to follow program flow was utterly baffling to me.  By the time I scrolled from one action to the next, I'd forgotten what the heck was going on in the program.

If we're comparing LONGEST programs, ARB wins hands-down...

***************************

Comparing code is almost always a waste of time.  I can write a nice BMP image routine for screen capture in 100 lines of code...  Somebody else might DECLARE LIBRARY and do it in 4 lines of code.  If I save it as an $INCLUDE, I can do it in 2 lines of code...

Which does the most?  Which is "shortest"?  "Best?" 

Do we count all the lines from a library as adding to our program length?  If not, then can't we just cheat and wire a 1-line program for:  $INCLUDE:'QB64.BAS', and then say, "Look, I can do EVERYTHING QB64 does in one line!"

Of course, if we DO count library lines, then why don't we count all the lines in the font/sound/graphic libraries which QB64 uses behind the scenes?  By that definition, PRINT "HELLO WORLD" is probably a 100,000 line program...

The only real criteria that's useful when discussing programs is, "Does it work and fulfill the user's needs." 

Anything else is just trivialities.  ;D
Title: Re: How big is yours?
Post by: Pete on November 19, 2018, 08:44:28 pm
Dammit Bill, apparently you did manage to throw the train off the track here. People who do that without interjecting politics into the thread really piss me off! :D

Pete
Title: Re: How big is yours?
Post by: Bert22306 on November 19, 2018, 09:59:15 pm
You guys put me to shame. Actually, years ago, using QBasic, I wrote a program so long that QBasic got upset and told me it was too long. I had to break it up into subroutines.

Since then, that program has evolved in many ways. It's now 4105 lines of code, although perhaps 25% are comments. The main program is 599 lines.
Title: Re: How big is yours?
Post by: STxAxTIC on November 19, 2018, 10:17:46 pm
Holy damn do I remember ARB... the paradox of that guy...

So yeah, his code was horrendous. He did the computer's work for it far too often. Yyyyuuuuuck. But yall remember that he championed himself as having made an ARB Chess System, which routinely bet the best chess AI in the world? I have suffered the chess problem in BASIC (stopped before implementing checkmate or castling before calling it "done enough" so its actually useless), and that whole kind of problem is not only a mindfap to implement, but staggeringly unimaginable to do without arrays. I want to know how deep his delusion really went, in a bittersweet way. Has he been banned from *.org yet?

(Sorry to flame when a person isn't around. ARB is a real exception though...)
Title: Re: How big is yours?
Post by: Pete on November 19, 2018, 10:27:04 pm
Yeah, that guy used every character code in the chart... You might say he was a real ascii-whole.

And now, back to our regularly scheduled topic...

Pete :D
Title: Re: How big is yours?
Post by: RonB on November 19, 2018, 10:36:49 pm
On another note, I once REMOVED around 23K lines of code from a program without affecting any functionality - and it wasn't "dead" code, either. I merely changed thousands and thousands of very "similar" code blocks that used hard-coded values into just couple of dozen subroutines that used variables passed on the Calls instead. Even so, the resulting program still had over 40K lines of code left.
Title: Re: How big is yours?
Post by: Pete on November 19, 2018, 10:38:17 pm
That's a really big program. What was/is it used for?

Pete
Title: Re: How big is yours?
Post by: SMcNeill on November 19, 2018, 11:25:53 pm
On another note, I once REMOVED around 23K lines of code from a program without affecting any functionality - and it wasn't "dead" code, either. I merely changed thousands and thousands of very "similar" code blocks that used hard-coded values into just couple of dozen subroutines that used variables passed on the Calls instead. Even so, the resulting program still had over 40K lines of code left.

And I once did the exact opposite of that.  I took a small routine and exploded it into thousands of lines of code in the QBDbase library.

My original sort routine started out like:

FOR I = 1 TO LIMIT
   FOR J = 1 TO LIMIT
     SELECT CASE MemType
         CASE INTEGER:  'set MEM compare size to 2 bytes
         CASE SINGLE: set MEM compare size to 4 bytes
         and so on for each type...
     END SELECT
     Compare values/ swap if needed...
    NEXT
NEXT

The only issue was the speed of the routine was unacceptable from doing the select case and signed/unsigned decision making and calculations, so the solution was to restructure:

SELECT CASE MemType
     CASE Integer
          FOR I =.....
                FOR J = ......
                   Compare/Swap Values
                NEXT
           NEXT
     CASE Single
           FOR....
                 FOR.....


The Select Case moved outside the 16? (I think 16) different sorting routines, and each case had its own sort process to it, which ended up exploding a crapload of lines into the routine. 

The plus side to the whole thing, however, was that by removing such decision making and computations to the OUTSIDE of the sort loop, the sort times dropped from hours/minutes to seconds/milliseconds.

In this case, smaller wasn't better, which I thought was worth pointing out since most programmers instantly seem to think, "few lines = better code", and that may not always be true.  ;)
Title: Re: How big is yours?
Post by: RonB on November 20, 2018, 12:00:42 am
That's a really big program. What was/is it used for?

Pete

It was a program that took in several demographic values and generated rate quotes based on the combination of those values.
Title: Re: How big is yours?
Post by: Pete on November 20, 2018, 12:07:07 am
I once tried to purchased moron insurance, but the agent told me I was self-insured.

Hey a business app, neat! Please tell me you wrote it in SCREEN 0.

Pete
Title: Re: How big is yours?
Post by: TempodiBasic on November 20, 2018, 10:09:55 am
Hi Pete

about the amount of line of effective code
I have riched 1400 lines and no more in QBASIC when I decide to make a copy of that tools very useful in DOS time like Norton commander and Disktool...
I'm just hobbist :-)

however there is a saying
no how big  it is but how  you use it that makes the difference
:P
Title: Re: How big is yours?
Post by: Cobalt on November 20, 2018, 10:46:03 am
That would have to be Tetris 64 for me, at 2524 lines(~2450 after comments/white space). Go over to programs and check it out if you haven't already. https://www.qb64.org/forum/index.php?topic=661.msg6027#msg6027
Title: Re: How big is yours?
Post by: Pete on November 20, 2018, 11:07:26 am
Hi Pete

about the amount of line of effective code
I have riched 1400 lines and no more in QBASIC when I decide to make a copy of that tools very useful in DOS time like Norton commander and Disktool...
I'm just hobbist :-)

however there is a saying
no how big  it is but how  you use it that makes the difference
:P

But if you use it well AND it's big...

I also like utility programs. Usually they don't get too large, so you can get sometime accomplished in less than a couple of lifetimes.

Pete
Title: Re: How big is yours?
Post by: Ashish on November 20, 2018, 11:13:35 am
I have coded about 2658 lines of code for my game!
It is beautiful game - https://www.qb64.org/forum/index.php?topic=345.msg2322#msg2322

 [ This attachment cannot be displayed inline in 'Print Page' view ]  
Screenshot of the gameplay
Title: Re: How big is yours?
Post by: Pete on November 20, 2018, 11:17:15 am
That would have to be Tetris 64 for me, at 2524 lines(~2450 after comments/white space). Go over to programs and check it out if you haven't already. https://www.qb64.org/forum/index.php?topic=661.msg6027#msg6027

I'm not a gamer, but I did follow the link and tried it. Apparently we have that in common, as you made the game and only hold 2nd place in the top scores? What the hell is that about???

Very professionally done, great looking skin, too, but I wouldn't be able to say if it is a dup of the Nintendo, because I never played it on a N64 or whatever it was called. Your game supports my wish that QB64 could upload and rn these types of apps on Android or other mobile devices. Still, that is just for personal use, as when you put something like this iin an app, I would imagine you have to have an original game. In 1980, I made Wheel of Fortune, Password, Card Sharks, and Monopoly for the Atari 2600 and thought, I could make a fortune off of this stuff, except... Anyway, all of those came out on CD's a few years later, with better graphics than I could produce at the time.

Anyway, great job and from what I can see, some pretty efficient code... which supports Temp's call.

Pete
Title: Re: How big is yours?
Post by: TempodiBasic on November 21, 2018, 09:14:41 am
@Ashish
thanks to remark it! I have loosen it when you have post... because I have to spend little time in this forum and so I let me drive in prevalene  by discussion part of forum.
Cool, fine shooter, you have got the animalists against you :-)


@Pete

Quote
But if you use it well AND it's big...
I absolutely agree! ;-)
Title: Re: How big is yours?
Post by: Pete on November 21, 2018, 11:41:09 am
I have coded about 2658 lines of code for my game!
It is beautiful game - https://www.qb64.org/forum/index.php?topic=345.msg2322#msg2322

So I take it you made that game shortly before the app, "Angry Birds" came out?

Pete :D
Title: Re: How big is yours?
Post by: Ashish on November 21, 2018, 12:01:42 pm
I have coded about 2658 lines of code for my game!
It is beautiful game - https://www.qb64.org/forum/index.php?topic=345.msg2322#msg2322

So I take it you made that game shortly before the app, "Angry Birds" came out?

Pete :D
Yeah! But how do you know!?
Title: Re: How big is yours?
Post by: Pete on November 21, 2018, 12:07:32 pm
Well in the screen sot, the bird on the right, with the target affixed to it, is pretty much toast, but it's also pretty evident the bird on the left is flying off to tell all his red-breasted friends what you did!

Pete :D
Title: Re: How big is yours?
Post by: OldMoses on November 27, 2018, 06:48:39 pm
I'm pretty small fry, I do believe the biggest (or at least the most ambitious) I've ever done is the most recent project, my Runequest player character handler, which I dubbed PC Minder. A sort of gamemaster utility that keeps track of the number crunching for multiple PCs in that game system. Every time a new edition of the game comes out I code a character generator for it, but this one is a fairly radical departure from earlier attempts, incorporating in game PC management functions. The most recent working version is zipped with executable, source code, images, sample characters and PDF user guide at:

http://www.plainviewfarms.com/software/

At this point it comes in at just over 3600 lines of code, which includes DATA and comments. I have yet to try striping out the comments, but that would possibly cut that nearly in half as I put a lot of copious comments in their own lines to aid in finding stuff. Many SUBs have more comment than code as each SUB gets a descriptive header so I can tell what the hell I was thinking later on. I don't exclude DATA because I laboriously typed that crap in from printed reference materials. To my mind that qualifies as code.
Title: Re: How big is yours?
Post by: Pete on November 27, 2018, 07:36:10 pm
ROFL @ "laboriously typed all that crap!" I hear you. When I was in high school, back in those sexist days of the 70's, I vowed I'd never take some stupid worthless typing class. That was because I had no intention of growing boobs and becoming someone's secretary. Now I'm old, probably typed (coded) twice as much as anyone's secretary, and ended up growing boobs, anyway!

Pete 
Title: Re: How big is yours?
Post by: OldMoses on November 28, 2018, 01:44:12 am
ROFL @ "laboriously typed all that crap!" I hear you. When I was in high school, back in those sexist days of the 70's, I vowed I'd never take some stupid worthless typing class. That was because I had no intention of growing boobs and becoming someone's secretary. Now I'm old, probably typed (coded) twice as much as anyone's secretary, and ended up growing boobs, anyway!

Perhaps the sexism was on the wane by the time I hit HS. I went ahead and took the typing class, mostly because I thought IBM Selectrics were cool machines at the time, what with the little whirling dervish ball and all. Kinda wish I had one today. That was followed by a class on programming in Applesoft Basic, which reinforced the typing skills. Then in college daze ('83 onward), typing papers for other students on an Apple II with a 5.25" floppy and dot matrix printer kept the pizza and beer money flowing. It was one of the most important skills I ever acquired.

Title: Re: How big is yours?
Post by: phred on November 28, 2018, 11:13:01 am
I learned to type on an IBM Selectric in a high school business class while I was learning the intricacies of punch cards and COBOL.  The typing ended up being a better time investment than the punch cards did and yes, that ball could fly!
Title: Re: How big is yours?
Post by: Pete on November 28, 2018, 01:18:56 pm
Oh don't get me started on punch cards. Do anyone remember making a stack of 30 or 40 of those cards, just to do something as simple as a "Hello World" program? You know, when I think about, my aversion to typing and punch cards makes me wonder how I ever got hooked on computers in the first place. I suppose I can thank/blame premed for that. Everything needed to be typed, except for math stuff and PE. I still remember banging away at those Smith-Corona keys inot the late hours and if you were smart enough to buy stock in the manufacture of their removable correction cartridges, well, I'm the guy who paid for your retirement.

Pete   
Title: Re: How big is yours?
Post by: STxAxTIC on November 28, 2018, 07:39:23 pm
What's crazy about the punch card era is how much of that nonsense persists to this day... Actually it's not nonsense (because it made sense at the time), and it's actually kindof beautiful that some of those relics are around. Gives a kind hope to people hooked on the relic BASIC language, does it not?

I surely can't name them all, but one corpse we keep animated is ASCII. Sure we have a trillion unicode characters, but when I look down on my physical keyboard, its ASCII.

Then there's the 80-character limit that never went away. Terminal applications often terminate lines at 80 for a reason that traces back to actual terminals, as you all know.

Of course, I can't leave out horrendous way you need to code in COBOL. The punchcards are there in your face in a perverted digital way. Follow weird indentation patterns, blah blah. Just a bunch of yuck. The code was so damn verbose, and to rub it in, you end a line with a period as if you really were writing a sentence. Terrible. It was the Java of the 80's.

One thing that the kids will ask about is why the "save" and "open" icons are this weird plastic thing and this weird yellow thing. We'll have to explain "kids, before quantum storage was perfected, we couldn't write our data to the wall of a black hole like we do now. We'd save it on a magnetic plastic thing. Yeah, they broke. Oh, and 1.44 megs at best." And then you'd have to explain what an *actual* file system is... and when you're done, surely the kid will say "what's paper?"

Title: Re: How big is yours?
Post by: Pete on November 28, 2018, 08:10:03 pm
I'm surprised our FORTRAN guy, Dean (qbguy) hasn't chimed in by now.

Pete
Title: Re: How big is yours?
Post by: rcamp48 on December 02, 2018, 05:55:33 am
My Lottery programs are only 3000 line max, but my data for them can extend to 10,000 lines depending on how many draws have been made and how far back I go, generally I go back at least 5 years. Russ
Title: Re: How big is yours?
Post by: Ryster on December 02, 2018, 01:11:25 pm
First of all, welcome to all QB64 Members.
Title: Re: How big is yours?
Post by: pagetelegram on December 17, 2018, 02:38:59 pm
433 lines: Benford Bench.

Touched up on it on and off for 6 years. It is a digital analysis program using Benford's Law.

https://www.qb64.org/basbin/4B4B.txt

I developed it for my groups primary use to investigate time stamps of in election log data for Chicago to demonstrate admissibility of it's method for fraud detection.

I use this program and another team member uses his program in Fox Pro to solidify results.

Trouble is finding a control pool.
Title: Re: How big is yours?
Post by: pagetelegram on December 17, 2018, 03:35:22 pm
My Lottery programs are only 3000 line max, but my data for them can extend to 10,000 lines depending on how many draws have been made and how far back I go, generally I go back at least 5 years. Russ

Lottery program?

Anything like this ?

http://pagetelegram.com/piball.html


A lot less lines than 4k tho.
Title: Re: How big is yours?
Post by: xra7en on December 17, 2018, 05:08:07 pm
I just thought of something while reading this. you guys brought back tons of memories (visiting my uncle in the army, i could only type text, and no monitors, no mice LOL (wayyyyy back)
Then I thought back to the days of my first "real? home? pc?? tape-recorder HDD with counter of course, 13" b/w TV 2k ram and a WOOT!! additional 16k rampack!!" TIMEX SINCLAIR and thought - what should make a thread for the SMALLEST qb64 fully functional game/app right now - one liners welcome - although not sure about machine language if that count hahaha