visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: General :: Anyone remember qbasic?


By: Bartender_1 U.S.A.  Date: 09/06/2003 00:00:00  English  Points: 300 Status: Answered
Quality : Excellent
Ok, first off, yes, I realize qbasic is ancient, and I should try another language.
If you're here simply to tell me this, then thank-you, but I've been told many times. :o)

I'm hoping someone is willing to dig up this old information from the depths of their memory and assist me in learning.

First off, can anyone remember how to get more than 16 colors with qbasic? I've tried researching the help, but it points to palettes and has examples that do nothing but confuse me. If you can provide a description of how to accomplish more colors, with examples, this would assist me in learning quicker. (I like to experiment with examples to learn the limits.)

Second, I've included a program I've written in qbasic. It's obviously very simple. (an imitation of the "bouncing line" screensaver.)
It of course draws lines, but my difficulty is that it doesn't remove the lines. And I have no idea how to cause it to remove them.
So, as a make shift fix, I've caused it to clear the screen after 500 lines.
the question: is there an easy way to erase the lines (say after 5 new lines have been drawn), or is it something like a subroutine that draws over the existing lines in black?

And lastly, does anyone have suggestions for learing more about programming in general? Is there somewhere I can go to learn about the basics for programming that apply to all language environments?

Bartender_1

(below is the program, I've included.)


CLS
vlim = 450
hlim = 640
RANDOMIZE TIMER
SCREEN 12
a = 0
b = 0
c = 0
d = 0
start:
IF count = 500 THEN GOSUB counts
IF count MOD 50 = 0 THEN GOSUB chcolr
LINE (a, b)-(c, d), colr
GOSUB times
IF al = 0 THEN GOSUB takea ELSE GOSUB adda
IF bl = 0 THEN GOSUB takeb ELSE GOSUB addb
IF cl = 0 THEN GOSUB takec ELSE GOSUB addc
IF dl = 0 THEN GOSUB taked ELSE GOSUB addd
IF a >= hlim THEN al = 0
IF b >= vlim THEN bl = 0
IF c >= hlim THEN cl = 0
IF d >= vlim THEN dl = 0
IF a <= 0 THEN al = 1
IF b <= 0 THEN bl = 1
IF c <= 0 THEN cl = 1
IF d <= 0 THEN dl = 1
count = count + 1
GOTO start
adda:
GOSUB reseed
a = a + e
RETURN
GOSUB reseed
addb:
b = b + e
RETURN
addc:
GOSUB reseed
c = c + e
RETURN
addd:
GOSUB reseed
d = d + e
RETURN

reseed:
e = INT(RND * 15)
RETURN
add:
takea:
GOSUB reseed
a = a - e
RETURN
takeb:
GOSUB reseed
b = b - e
RETURN
takec:
GOSUB reseed
c = c - e
RETURN
taked:
GOSUB reseed
d = d - e
RETURN

times:
FOR z = 1 TO 10000
NEXT z
RETURN
counts:
CLS 2
count = 0
RETURN
chcolr:
colr = INT(RND * 15)
RETURN


By: VGR Date: 09/06/2003 07:22:00 English  Type : Assist
to remove the lines, you have to re-draw them background-colour when starting to draw the new lines
By: PA1 Date: 09/06/2003 09:37:00 English  Type : Answer
And lastly, does anyone have suggestions for learing more about programming in general? Is there somewhere I can go to learn about the basics for programming that apply to all language environments?

One rule of thumb I can give you. When programming the more time you spend in determining what you require a at the beginning the less time you will spend correcting early mistakes. The time it takes to fix a problem is of exponential proportion to the amount of time after the start date that the problem was identified. Identify the problem a the begining and the time spent fixing it will be small identify it at the end and you might well find yourself starting again from scratch. :)

Why am I saying this? You have said that you want to learn programming techinques and you want to use qbasic. That is in itself not unreasonable but it is bizare. So let us know why you want to use q Basic and what you want to be able to do wiht it. Then we might be able to help.

As far as learning the fundamentals of programming you are best off learning one language to start with.
At the end of the day one language is pretty much like another in terms of the techniques you use to do things but there is no value in learning 5 different ways of saying the same thing when one will do the job. Conversely to learn programming techinques without a language is like learning to drive without getting into a car. It is practise and experience that will give you the skills you need and a proper understanding of how to program.

General (modern) programming techniques usually apply to structured languages which qBasic is not moreover most material nowadays uses an object oriented approach. I don't think (I am sure I will be corrected here if I am wrong) that the concept of object oriented code even existed when qbasic was released.

So really to answer this question we need to know what you wish to acheive.
Programming is just too big a topic to say here is how to do it unless you specify what you are trying to acheive.
By: c4santa Date: 09/06/2003 11:26:00 English  Type : Comment
This is quite funny , i learned Q-basic my junior year in highschool this year .. And you're saying its ancient.. Still very usefull when i got more into VB 6.0
By: VGR Date: 09/06/2003 15:43:00 English  Type : Comment
absolutely, that's also why a lot of schools still use Turbo-Pascal 5.0->6.0 ;-)
By: Bartender_1 Date: 20/06/2003 17:47:00 English  Type : Comment
PA1 what am I trying to achieve:
Well, I'm working on creating a game..... there are many aspects to the game, and I'm sure I'll mess up on each and every one of them. ~LOL~

What game am I attempting to create? Well..... can anyone remember a game called Qix? (See here for description: <A HREF="http://www.klov.com/Q/Qix.html">http://www.klov.com/Q/Qix.html</a> )That's it, but I want it in color, and a bit more modern and..... well let's just say I have some ideas, so I think that if I am able to create the basic game, I will have learned how to implement the changes I come up with.

Does that help any?

:o)

Bartender_1
By: Bartender_1 Date: 07/07/2003 03:11:00 English  Type : Comment
No further action on this thread, so time to close. Thanks all.

:o)

Bartender_1

Do register to be able to answer

EContact
browser fav
page generated in 1020.407920 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page