Hard Light Productions Forums

Off-Topic Discussion => Programming => Topic started by: Colonol Dekker on October 20, 2008, 09:59:16 am

Title: I miss Basic
Post by: Colonol Dekker on October 20, 2008, 09:59:16 am
1- PRINT "Hello world!"
2-NEW LINE
3-GOTO 1


How easy was it back then...........

 :D
Title: Re: I miss Basic
Post by: Turey on October 20, 2008, 07:22:18 pm
Perl is simply:
Code: [Select]
while (1) {
   print "Hello, world!\n";
}

And many other languages are nearly as easy.

On the other hand, more complicated operations are much easier to perform in other languages as compared to Basic. The best example is quicksort. This is a simple thing to implement in any language with proper recursion, but basic makes it very difficult. I managed to write Quicksort for the TI-84 calculator (using TI-BASIC), but it basically involved writing my own call stack using a matrix and then writing a recursive Quicksort on top of that.
Title: Re: I miss Basic
Post by: Colonol Dekker on October 21, 2008, 03:56:23 am
Ok. I'm too stupid to use anything besides basic and html and flash. I should have said that instead :lol:
Title: Re: I miss Basic
Post by: Flipside on October 21, 2008, 11:55:51 am
Try learning Java, once you get your head around Object Oriented coding, it's a very easy language to learn ;)
Title: Re: I miss Basic
Post by: Colonol Dekker on October 23, 2008, 06:42:15 am
I did learn, and forget; the basic bare basics of Javascript........ten years back :nod:
Title: Re: I miss Basic
Post by: karajorma on October 25, 2008, 02:38:15 am
Javascript and Java are not the same thing though. Not by a long way. :)
Title: Re: I miss Basic
Post by: Flipside on October 25, 2008, 04:50:27 pm
Agreed, once you get over your initial concerns about it being interpreted rather than compiled, it's a nice little language, certainly preferable, in my opinion, to VB, which seems to make a mountain out of a molehill in 90% of cases.
Title: Re: I miss Basic
Post by: qazwsx on November 03, 2008, 11:09:29 am
If you still want to use basic, why not try the free Windows and Unix one, Yabasic?
http://www.yabasic.de/ (http://www.yabasic.de/)
It's rather fun, I've programmed a random colour fader before now...
Title: Re: I miss Basic
Post by: Rick James on November 20, 2008, 09:25:45 am
Oh, this takes me back to the many hours I spent in QBasic...

<3
Title: Re: I miss Basic
Post by: Aardwolf on January 05, 2009, 12:01:59 am
Gorillas.bas ftw

I don't care how old this thread is, the board needs more activity.
Title: Re: I miss Basic
Post by: portej05 on January 05, 2009, 01:23:22 am
I spent many hours with Gorillas.bas. That was a lot of fun.
Now I spend many (most?) hours fighting with VS and MFC.
Title: Re: I miss Basic
Post by: Aardwolf on January 05, 2009, 05:45:04 am
Turns out if you play gorillas at midnight it freezes :lol:

The timing routine wasn't sophisticated enough to handle the timer being reset to zero.
Title: Re: I miss Basic
Post by: Goober5000 on February 26, 2009, 09:16:53 pm
:bump:

I need to visit this forum more often...

I love BASIC.  In all its varieties. :D  Gorillas.bas was a classic, true, but the real goldmine came from all those books with BASIC code listings for games and such.  Tim Hartnell FTW.  Pretty much any book that he wrote is a must-read and must-code. :D  Another must-have is the CIA adventure game from Basic Fun With Adventure Games by Susan Lipscomb and Margaret Zuanich.
Title: Re: I miss Basic
Post by: Polpolion on February 26, 2009, 09:43:17 pm
I remember when I made FS2BASIC. I wonder if I still have it...

EDIT:

Code: [Select]
OPTION NOLET
SET WINDOW 0,1000,0,1000
RANDOMIZE
CALL Read_image("MS BMP",BAD$,"BAD.BMP")
CALL Read_image("MS BMP",BKGRND$,"BKGRND.BMP")
CALL Read_image("MS BMP",SUBF$,"SUBF.BMP")
CALL Read_image("MS BMP",PROMF$,"PROMF.BMP")
CALL Read_image("MS BMP",ROCKF$,"ROCKF.BMP")
CALL Read_image("MS BMP",HRPF$,"HRPF.BMP")
CALL Read_image("MS BMP",DIE$,"DIE.BMP")
CALL Read_image("MS BMP",HIT$,"HIT.BMP")
CALL Read_image("MS BMP",BFIRE$,"BFIRE.BMP")
DO
   PRINT " FREESPACE"
   PRINT " 1) Ready room"
   PRINT " 2) Tech room"
   PRINT " 3) Bath room"
   PRINT " 4) Airlock"
   PRINT
   PRINT
   PRINT "Where do you want to go? Input #"
   INPUT GO
   IF  GO = 1 THEN
      CALL PLAY
   ELSE IF GO = 2 THEN
      CALL WHAT
   ELSE IF GO = 3 THEN
      CALL POOP
   ELSE IF GO = 4 THEN
      STOP
   ELSE
      PRINT "Pick another number, idiot."
   END IF
LOOP
END

!==================================================================


SUB PLAY
    CLEAR
    PRINT "What laser do you want?"
    PRINT " 1) Subach HL-7 (Damage 8)"
    PRINT " 2) Prometheus - S (Damage 12)"
    PRINT " Input number"
    INPUT GUN
    CLEAR
    PRINT "What missile do you want?"
    PRINT " 1) Rockeye (10 missiles) (Damage 30)"
    PRINT " 2) Harpoon (6 missiles) (Damage 50)"
    PRINT " Input number"
    INPUT MISS
    PRINT "YOUR WEAPONS:";
    IF GUN = 1 THEN
       PRINT "Subach HL-7";
    ELSE
       PRINT "Prometheus - S";
    END IF
    IF MISS = 1 THEN
       PRINT " and Rockeye"
    ELSE
       PRINT "and Harpoon."
    END IF
    PRINT
    PRINT
    PRINT "Press a key when you are ready."
    GET KEY PSE
    CLEAR
    !=============================

    PHLTH = 100
    DO
       BHLTH = 100
       A=rnd*800
       B=rnd*800
       DO
          FWB = FWB - 1
          FW = FW-1
          FWM = FWM-1
          !BOX SHOW $ at ,
          !32
          !122
          BOX SHOW BKGRND$ at 0,0
          BOX SHOW BAD$ at A,B
          GET MOUSE X,Y,S
          GET KEY S
          IF S=122 THEN
             IF GUN = 1 AND FW >= 0 THEN
                BOX SHOW SUBF$ at 0,0
             ELSE
                BOX SHOW PROMF$ at 0,0
             END IF
             IF X>A AND X<(A+200) AND Y>B AND Y<(B+200) THEN
                BOX SHOW HIT$ at A,B
                IF GUN = 1 THEN
                   BHLTH = (BHLTH-8)
                   FW = 6
                ELSE
                   BHLTH = (BHLTH-12)
                   FW = 10
                END IF
             END IF
          END IF
          IF S=32 THEN
             IF MISS = 1 AND FWM >= 0 THEN
                BOX SHOW ROCKF$ at 0,0
             ELSE
                BOX SHOW HRPF$ at 0,0
             END IF
             IF X>A AND X<(A+200) AND Y>B AND Y<(B+200) THEN
                BOX SHOW HIT$ at A,B
                IF GUN = 1 THEN
                   BHLTH = (BHLTH-30)
                   FWM = 10
                ELSE
                   BHLTH = (BHLTH-50)
                   FWM = 15
                END IF
             END IF
          END IF
          PAUSE 0.1
          !PLOT TEXT, at x, y:
          IF FWB >= 0 THEN
             BOX SHOW BFIRE$ at A,B
             PHLTH = PHLTH - (RND*4+6)
             BAR =(100 - PHLTH)
             SET COLOR "GREEN"
             PLOT TEXT, AT  BAR,10 : "|"
             PLOT TEXT, AT 101,10 : "YOUR DAMAGE"
             SET COLOR "BLACK"
             FWB = (RND*5+4)
          END IF
       LOOP UNTIL BHLTH >=0 OR PHLTH >= 0
       IF BHLTH >= 0 THEN
          KILL = KILL + 1
       END IF
       IF PHLTH >= 0 THEN
          CLEAR
          PRINT " YOU SUCK AT THIS GAME!    !! YOU LOSE!!"
       END IF
    LOOP UNTIL KILL = 10 OR PHLTH >= 0
    IF KILL = 10 THEN
       PRINT "YOU ROCK AT A GAME THAT TAKES NO SKILL WHATSOEVER TO PLAY!  !"
    END IF

END SUB

!======================================================================
SUB WHAT
    PRINT " This is a 'port' of the most basic aspects of the game of Freespace 2 to True basic."
    PRINT " When you go into play mode, you get to select guns. Some do more damage than others"
    PRINT "  Put your mouse pointer on the bad guys. 'Z' shoots your lasers,  Spacebar shoots a missile"
    PRINT " Click on bad guys to destroy them."
    PRINT
    PRINT " Back to the main hall! *press key"
    GET KEY PSE
    CLEAR
END SUB
!=====================================================================

SUB POOP
    PRINT " You unzip your pants. Then you remember that this is a game"
    PRINT " and you get up from your computer desk and walk to the real"
    PRINT " bathroom. Thank goodness! *press key"
    GET KEY PSE
    CLEAR
END SUB

Unfortunately, I no longer have the pictures.
Title: Re: I miss Basic
Post by: chief1983 on March 30, 2009, 03:04:55 pm
Same here, I should put this forum on my auto-notify of new topics.

BASIC Stuff (http://swc.fs2downloads.com/files/BASIC.7z)

There's a lot of stuff in there, from almost every version of QBASIC (and FirstBasic for DOS 1.0!), to gorilla.bas, plus a modified version I made where the building hits are as big as gorilla hits and the gorilla hits are like a nuke that wipes the screen (it was much more fun to watch on a Pentium 33/66 than it probably is on a new PC), to numerous other BASIC files I ran across, to a golf game I wrote my freshman year of high school (compiled!).  That's right, QB after 1.1 had a compiler.  Really I think it just wraps the interpreter and the script together, but whatever.
Title: Re: I miss Basic
Post by: kode on March 30, 2009, 04:08:46 pm
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."
-- Edsger W. Dijkstra

And tbh, I agree. BASIC is ****e.
Title: Re: I miss Basic
Post by: Scooby_Doo on April 11, 2009, 04:45:34 am
:bump:

I need to visit this forum more often...

I love BASIC.  In all its varieties. :D  Gorillas.bas was a classic, true, but the real goldmine came from all those books with BASIC code listings for games and such.  Tim Hartnell FTW.  Pretty much any book that he wrote is a must-read and must-code. :D  Another must-have is the CIA adventure game from Basic Fun With Adventure Games by Susan Lipscomb and Margaret Zuanich.

How about all those classic 3.2.1 Contact magazines?  ;)
Title: Re: I miss Basic
Post by: castor on April 11, 2009, 05:22:19 am
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."
-- Edsger W. Dijkstra

And tbh, I agree. BASIC is ****e.
Or maybe its just an excuse by someone who is better with computers than they are with people :D
Title: Re: I miss Basic
Post by: Flipside on April 11, 2009, 09:56:57 am
It is ironic, therefore that many 30-somethings, i.e. a fair percentage of the programmers around, started on something like BBC or Commodore BASIC, probably moving on to PASCAL or something like 8-Bit machine code, if they were really lucky, they would have learned something like Amiga OS, which is heading towards Linux, but for the main part, I'd suggest that quite a lot of coders were 'born in BASIC', as it were, and then moved on to something more flexible.
Title: Re: I miss Basic
Post by: blackhole on April 11, 2009, 03:28:52 pm
I started on visual basic. While anything BASIC-related is a sh*tty programming language, saying that programmer's minds are hopelessly "mutilated beyond hope of regeneration" is stupid and wrong.
Title: Re: I miss Basic
Post by: The E on April 11, 2009, 03:38:21 pm
This may be true today. VB certainly is closer to Java, or other "real" programming languages, than the original version.
Title: Re: I miss Basic
Post by: blackhole on April 11, 2009, 03:41:13 pm
This may be true today. VB certainly is closer to Java, or other "real" programming languages, than the original version.

Keep in mind that I started on VB6, not VB.net
Title: Re: I miss Basic
Post by: The E on April 11, 2009, 03:51:19 pm
But Dijkstra made his comment back in 1975, when BASIC was being used as a teaching tool, and still relied on abominations like GOTO as a control structure.

Disclaimer: I have never, ever done anything with BASIC, in any form whatsoever.
Title: Re: I miss Basic
Post by: blackhole on April 11, 2009, 03:54:38 pm
True, which means someone shouldn't really be quoting a comment that now has no relevance to the present day :P
Title: Re: I miss Basic
Post by: chief1983 on April 11, 2009, 09:54:48 pm
Except I was taught my first programming wiht BASIC in 1998/1999, using not only GOTO but GOTO with LINE NUMBERS.  Dijkstra was right, you can really pick up some bad habits with BASIC.   Honestly Java would probably make a better first language.  Get you in that OO mode.
Title: Re: I miss Basic
Post by: blackhole on April 12, 2009, 02:05:21 am
Except I was taught my first programming wiht BASIC in 1998/1999, using not only GOTO but GOTO with LINE NUMBERS.  Dijkstra was right, you can really pick up some bad habits with BASIC.   Honestly Java would probably make a better first language.  Get you in that OO mode.

O.o;;;;;
Title: Re: I miss Basic
Post by: kode on April 12, 2009, 08:32:18 am
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."
-- Edsger W. Dijkstra

And tbh, I agree. BASIC is ****e.
Or maybe its just an excuse by someone who is better with computers than they are with people :D

What are you implying, really?

I started on visual basic. While anything BASIC-related is a sh*tty programming language, saying that programmer's minds are hopelessly "mutilated beyond hope of regeneration" is stupid and wrong.

Dijkstra was far from stupid. And no, it is not wrong. You do not learn anything about how a computer works from BASIC. There are a lot of bad practices in the language which are very hard to unlearn.
Title: Re: I miss Basic
Post by: kode on April 12, 2009, 08:34:39 am
But Dijkstra made his comment back in 1975, when BASIC was being used as a teaching tool, and still relied on abominations like GOTO as a control structure.

Disclaimer: I have never, ever done anything with BASIC, in any form whatsoever.

Oh, I'd argue that goto has it's uses, but not necessarily as a control structure. It's a quck and easy way to kludge memory freeing when **** hits the fan, for example.
Title: Re: I miss Basic
Post by: castor on April 12, 2009, 10:52:43 am
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."
-- Edsger W. Dijkstra

And tbh, I agree. BASIC is ****e.
Or maybe its just an excuse by someone who is better with computers than they are with people :D

What are you implying, really?
In retrospect, we know that his statement does not hold water. So, the guy either didn't have a clue, or then just didn't have the patience to actually teach someone properly. And based on the stuff he did we can rule out the former explanation.
Title: Re: I miss Basic
Post by: The E on April 12, 2009, 05:38:16 pm
But Dijkstra made his comment back in 1975, when BASIC was being used as a teaching tool, and still relied on abominations like GOTO as a control structure.

Disclaimer: I have never, ever done anything with BASIC, in any form whatsoever.

Oh, I'd argue that goto has it's uses, but not necessarily as a control structure. It's a quck and easy way to kludge memory freeing when **** hits the fan, for example.

GOTO can be useful, no doubt about it. Consider this:
Code: [Select]
int parse()
{
    Token   tok;

reading:
    tok = gettoken();
    if (tok == END)
        return ACCEPT;
shifting:
    if (shift(tok))
        goto reading;
reducing:
    if (reduce(tok))
        goto shifting;
    return ERROR;
}

That is one beautiful use for a goto. Original source here. (http://david.tribble.com/text/goto.html)
However, I guess that Dijkstra merely wanted to point out BASIC's deficiencies as a teaching tool, as it was severely lagging behind the other languages that came up later. That he chose deliberately inflammatory language to get people thinking about his point, and the fact that it is still debated, proved that that discussion had to be made
Title: Re: I miss Basic
Post by: blackhole on April 12, 2009, 06:38:54 pm
But applying his quote to Visual Basic doesn't work.
Title: Re: I miss Basic
Post by: The E on April 12, 2009, 06:40:54 pm
Yep. But I guess his quote (and the ensuing discussion) had more than a little influence on VB's design.
Title: Re: I miss Basic
Post by: Scooby_Doo on April 12, 2009, 08:08:07 pm
I've used goto's when dealing with error retries.

something like this:

Code: [Select]

Retry:

if (DoStuff ().Failed) then

    if (DisplayRetryMessage ().Answer == Retry) then
        goto Retry
   endif
endif

I know it can be done with loops, but it just looks more awkward.
Title: Re: I miss Basic
Post by: chief1983 on April 12, 2009, 10:47:55 pm
The point is that GOTO is pretty much BASIC's primary way of accessing independent chunks of code.  It's not saying it's totally useless, but there are far better ways in just about every other language.  And kode, you don't need to know much about computers themselves to write code.   Many programmers know very little about the hardware they write code for, and higher level programmers probably don't even know the difference between little-endian and big-endian.  Doesn't mean they'll be bad programmers, good object oriented programming, among other things, usually takes away the need for that kind of intimate knowledge of the machine.  The point is that getting engrossed in BASIC can develop habits that make it hard to fully grasp the fundamentals of object oriented programming, and can typically just make programmers lazy.  There are so many programmers I work with, who some of my coworkers consider 'good' programmers, simply because they can work quickly.  But their speed usually comes at the cost of good code design, with many things ending up hardcoded, no thought given to the more advanced features of the language we use, etc.  I've a feeling many of them learned BASIC as a first language, and never thought to expand their programming methods too far beyond what was capable with it.
Title: Re: I miss Basic
Post by: Scooby_Doo on April 12, 2009, 11:09:15 pm
At least we don't need GoSub anymore  :lol:
Title: Re: I miss Basic
Post by: castor on April 13, 2009, 05:38:31 am
But their speed usually comes at the cost of good code design, with many things ending up hardcoded, no thought given to the more advanced features of the language we use, etc.  I've a feeling many of them learned BASIC as a first language, and never thought to expand their programming methods too far beyond what was capable with it.
I have the same experience with some people, with the difference that most of them have no experience with basic at all. So (IMO) the problem has more to do with what they did not learn, rather than what they did learn wrong.
Title: Re: I miss Basic
Post by: portej05 on April 13, 2009, 07:33:34 am
Code: [Select]
int parse()
{
    Token   tok;

reading:
    tok = gettoken();
    if (tok == END)
        return ACCEPT;
shifting:
    if (shift(tok))
        goto reading;
reducing:
    if (reduce(tok))
        goto shifting;
    return ERROR;
}

That is a beautiful piece of code.
Title: Re: I miss Basic
Post by: kode on April 13, 2009, 03:36:33 pm
The point is that GOTO is pretty much BASIC's primary way of accessing independent chunks of code.  It's not saying it's totally useless, but there are far better ways in just about every other language.  And kode, you don't need to know much about computers themselves to write code.   Many programmers know very little about the hardware they write code for, and higher level programmers probably don't even know the difference between little-endian and big-endian.  Doesn't mean they'll be bad programmers, good object oriented programming, among other things, usually takes away the need for that kind of intimate knowledge of the machine.  The point is that getting engrossed in BASIC can develop habits that make it hard to fully grasp the fundamentals of object oriented programming, and can typically just make programmers lazy.  There are so many programmers I work with, who some of my coworkers consider 'good' programmers, simply because they can work quickly.  But their speed usually comes at the cost of good code design, with many things ending up hardcoded, no thought given to the more advanced features of the language we use, etc.  I've a feeling many of them learned BASIC as a first language, and never thought to expand their programming methods too far beyond what was capable with it.

I hear there's this new invention called "paragraphs" that make large walls of text appear legible. I suggest you try it out if I am to be able to respond to any points you want made.
Title: Re: I miss Basic
Post by: chief1983 on April 13, 2009, 07:00:00 pm
Sorry man, I'm a runaway train sometimes.  But trust me, I've seen far worse (it may not look bad to me cause of the 1920 width my monitor is at though...).
Title: Re: I miss Basic
Post by: blackhole on April 14, 2009, 04:32:23 pm
Oh jesus, I just read up on big-endian and little endian. All I can say is THANK GOD FOR COMMON ARCHITECTURES. Also, I never want to write a networking engine. Ever.
Title: Re: I miss Basic
Post by: chief1983 on April 14, 2009, 11:01:02 pm
Lol, see what I mean?  If you've never had to write highly portable, but relatively low-level code, you've probably never had to worry about it.  But it's good to know these things.  Mostly because every compiler ever available, was built with a previous compiler, sometimes written in lower level code, all the way back to the first ones written in straight machine code.  (Don't look that up on ED btw).
Title: Re: I miss Basic
Post by: Polpolion on April 18, 2009, 10:48:25 pm
But Dijkstra made his comment back in 1975, when BASIC was being used as a teaching tool, and still relied on abominations like GOTO as a control structure.

Disclaimer: I have never, ever done anything with BASIC, in any form whatsoever.

I don't get it. How does having used GOTO in graphing calculator basic make you a terrible programmer? I don't think I've ever used GOTO when I'm doing real programming. Not even in True BASIC.
Title: Re: I miss Basic
Post by: portej05 on April 19, 2009, 02:44:28 am
Oh jesus, I just read up on big-endian and little endian. All I can say is THANK GOD FOR COMMON ARCHITECTURES. Also, I never want to write a networking engine. Ever.

offtopic, but:
Have you ever tried different assemblers?

I forget which syntax is which, but in two different assemblers MOV D1, D0 can have totally different meanings  (e.g. D1->D0 or D0->D1)  :nod:
Title: Re: I miss Basic
Post by: cloneof on April 27, 2009, 09:22:05 am
I actually enjoyed playing with Cool Basic...

It's cool...
Title: Re: I miss Basic
Post by: Flipside on April 27, 2009, 10:59:35 am
Oh jesus, I just read up on big-endian and little endian. All I can say is THANK GOD FOR COMMON ARCHITECTURES. Also, I never want to write a networking engine. Ever.

offtopic, but:
Have you ever tried different assemblers?

I forget which syntax is which, but in two different assemblers MOV D1, D0 can have totally different meanings  (e.g. D1->D0 or D0->D1)  :nod:

In 6502 not only was the format little-endian, but you could only use indexed referencing, so if you wanted to jump to an address, you had to write it down (backwards) in memory and then order the code to jump to the address referenced to by the address you had just updated :)
Title: Re: I miss Basic
Post by: portej05 on April 27, 2009, 12:05:34 pm
Oh jesus, I just read up on big-endian and little endian. All I can say is THANK GOD FOR COMMON ARCHITECTURES. Also, I never want to write a networking engine. Ever.

offtopic, but:
Have you ever tried different assemblers?

I forget which syntax is which, but in two different assemblers MOV D1, D0 can have totally different meanings  (e.g. D1->D0 or D0->D1)  :nod:

In 6502 not only was the format little-endian, but you could only use indexed referencing, so if you wanted to jump to an address, you had to write it down (backwards) in memory and then order the code to jump to the address referenced to by the address you had just updated :)

Back in my day, we used to have to get up before we'd gone to bed and write windows applications in x86 assembler
http://www.youtube.com/watch?v=Xe1a1wHxTyo (http://www.youtube.com/watch?v=Xe1a1wHxTyo)
Title: Re: I miss Basic
Post by: Flipside on April 27, 2009, 12:15:51 pm
Aye, 26 hours a day down t'pit, 'were grim up North ;)