QB64.org Forum

Active Forums => Programs => Topic started by: CharlieJV on April 05, 2022, 03:07:29 pm

Title: Just a silly "Hello World" Marquis
Post by: CharlieJV on April 05, 2022, 03:07:29 pm
Just a barely tweaked Commodore BASIC program over on Rosetta Code, works in both BASIC Anywhere Machine and QB64.

I was in an old-school BASIC reminiscing mood ...

Title: Re: Just a silly "Hello World" Marquis
Post by: bplus on April 05, 2022, 03:54:29 pm
Classic Basic, like the frame!
Title: Re: Just a silly "Hello World" Marquis
Post by: SierraKen on April 05, 2022, 06:46:33 pm
That's cool Charlie!

I still remember my first "Hello World" in my High School Apple 2e BASIC class in the 1980's:

10 PRINT "HELLO WORLD"
20 GOTO 10

Muahahahahaha... well, we thought we were cool. :D
Title: Re: Just a silly "Hello World" Marquis
Post by: bplus on April 05, 2022, 08:00:12 pm
Code: QB64: [Select]
  1. 1 Print Mid$("Hello world!  ", i + 1) + Mid$("Hello world!  ", 1, i)
  2. i = (i + 1) Mod 14: _Limit 10: GoTo 1
  3.  

EDIT: think I have it fixed?
Title: Re: Just a silly "Hello World" Marquis
Post by: SMcNeill on April 05, 2022, 09:33:16 pm
Reminds me of the way we ended up doing "Hello World" back in high school where we tried our best to drive our teacher completely insane.

Imagine 30+ old Apple IIc computers running a program very similar to this one (no delays needed back then, of course!):

Code: QB64: [Select]
  1. Const Annoying_Sounds = -1 'TRUE!
  2.  
  3. centerText 10, "Hello World", 1
  4. centerText 12, "presented by", 1
  5. centerText 14, "Steve McNeill", 1
  6. centerText 16, "1990, Floyd VA", 1
  7.  
  8.  
  9. Sub centerText (y, text$, delay)
  10.     text$ = _Trim$(text$) 'strip off leading or trailing spaces
  11.     l = Len(text$) 'length of text
  12.     If l Mod 2 Then text$ = text$ + " " 'make it even sized length
  13.     h = l \ 2 + 1 'half length
  14.         w = _Width \ _FontWidth
  15.     Else
  16.         w = _Width
  17.     End If
  18.     xLimit = w / 2 - 1
  19.     For i = 0 To h - 1
  20.         x = 1
  21.         Do
  22.             Locate y, x: Print Mid$(text$, h - i - 1, 1);
  23.             Locate y, w - x - 1: Print Mid$(text$, h + i, 1);
  24.             If x > 1 Then
  25.                 Locate y, x - 1: Print " ";
  26.                 Locate y, w - x: Print " ";
  27.             End If
  28.             x = x + 1
  29.             If Annoying_Sounds Then Sound Rnd * 4000 + 39, delay
  30.             _Delay delay / 18
  31.         Loop Until x > xLimit
  32.         xLimit = xLimit - 1
  33.     Next
Title: Re: Just a silly "Hello World" Marquis
Post by: bplus on April 05, 2022, 09:57:10 pm
Code: QB64: [Select]
  1. Width 130, 100: _FullScreen: View Print 1 To 100
  2. For i = 1 To 10: b$ = b$ + "Hello World! ": Next
  3. 1 Print Mid$(b$, i + 1) + Mid$(b$, 1, i)
  4. i = (i + 1) Mod 130: _Limit 10: GoTo 1
  5.  

No escape? nah, Alt+F4
Title: Re: Just a silly "Hello World" Marquis
Post by: CharlieJV on April 05, 2022, 10:02:32 pm
I find all of this simple stuff fun and wondrous.  Takes me right back to the early 80's.
Title: Re: Just a silly "Hello World" Marquis
Post by: SierraKen on April 06, 2022, 08:33:29 pm
LOL Steve and B+!

My history of using BASIC is a bit scattered, but here you go:

1987 - Used my friend's Texas Instruments to program with using magazines.
1988 - My parents bought a Franklin 2000 (Apple 2e compatible - which Franklin was sued a bit later by Apple but I never knew about that) from Sears. Remember the HOME command instead of CLS?
1988 - I took 2 programming classes in school, one in High School (Apple 2e BASIC) and one in the summer in college (BASICA on IBM's) (while I was still in High School).
1992 - We sold the Franklin.
1995 - We bought a Pentium 90 with Windows 95 and that is when I met my first online buddies on the comp.lang.basic.misc newsgroup and made my own GeoCities website with my new QBasic programs.
1996 - I found a free small BASIC language with a compiler called ASIC 5.0. It was based a lot on GW-BASIC. I added a lot of these to the old All Basic Code monthly packets and put them on my website.
Then I got bored and didn't like trying to fix programs until midnight all the time so I stopped for awhile.
Around 2005 or so I tried Visual Basic a little bit but not much.
Then finally in 2019 I found QB64! :D
Title: Re: Just a silly "Hello World" Marquis
Post by: _vince on April 06, 2022, 09:17:47 pm
Code: QB64: [Select]
  1. _HelloWorld
Title: Re: Just a silly "Hello World" Marquis
Post by: bplus on April 06, 2022, 09:26:44 pm
Here is what the program looks like in my interpreter called oh:
  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: Just a silly "Hello World" Marquis
Post by: SMcNeill on April 06, 2022, 09:37:22 pm
Code: QB64: [Select]
  1. _HelloWorld

Your syntax is wrong.  PHEW!  For a moment there, I thought you'd found one of the hidden Easter Egg commands we've squirreled away in QB64!

You'll have to try a little better than that, I'm afraid.  😂🤣🤪
Title: Re: Just a silly "Hello World" Marquis
Post by: _vince on April 07, 2022, 03:45:07 am
It's not an Easter Egg if they're ALL like that, Steve, squirreled away in the obscurity of uselessness
Title: Re: Just a silly "Hello World" Marquis
Post by: Cobalt on April 11, 2022, 11:52:53 am
It's not an Easter Egg if they're ALL like that, Steve, squirreled away in the obscurity of uselessness

Should I be embarrassed that in my copy that command works?


  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: Just a silly "Hello World" Marquis
Post by: SMcNeill on April 11, 2022, 12:24:13 pm
Should I be embarrassed that in my copy that command works?

Not at all!  My personal version of QB64 has a lot of little odd tweaks that the official version doesn't have.  It's nice to be able to mod your own.  ;)