Small code question

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
buddpaul
Coder
Posts: 22
Joined: Thu Nov 23, 2006 5:21 pm
Location: Texas(US)

Small code question

Post by buddpaul »

Would someone be willing to help me with a tiny program?

I want to start with a blank screen and then press one random key; upon doing so, I want 5 randomnly placed white circles to appear on the screen........that's it!!!

Some code guru should be able to knock that one out in about 5 minutes..........thanks for any help!!
bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Re: Small code question

Post by bungytheworm »

buddpaul wrote:Some code guru should be able to knock that one out in about 5 minutes..........thanks for any help!!
Actually i bet 99% of members here does it in 2 minutes but in this case, i hope no one does so since this smells like homework from school.
Show us some code you have done for this program and we help you out.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

I could probably do it in 30sec or less...

This is homework, so damned obvious...

Get back to spending all ($1) your money on alcohol, then vomit in the gutter just before passing out in the same vomit pool you just threw up, only to wake up and repeat it the day after.. cause paying attention in class, sure as hell isnt your strong side.
I have left this dump.
bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm »

Z!re wrote:I could probably do it in 30sec or less...
Yes. But you are not just a normal meber. You are The Z!re :wink:
buddpaul
Coder
Posts: 22
Joined: Thu Nov 23, 2006 5:21 pm
Location: Texas(US)

reply

Post by buddpaul »

For the love of pete, guys.......I'm 37 years old and I haven't taken a programming class in over 10 years......instead of a rude tongue lashing, could I have at least a jump start, please........I've noticed there's not much help on these boards.........just a bunch of rude come-backs........

so: will you help a stranger, or no?

Here's an idea.....I know I'll have to use CIRCLE somewhere......and I'll have to assign an x,y axis and I know I'll have to determine the radius of the circle(s)..............if I knew the answer, I wouldn't ask for help.

Thanks for anything TANGIBLE you might offer instead of beating me up for being a newbie.
bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm »

One of the main purposes for this site and our existence here is to help peoples. Sadly, time to time kid's thinks we are here for doing their homework. Actually too often and to be honest, your message gave feeling of kid, whos asking us once more to do hes homework.
Anyway, ill help you out with this one, allthought im not gona give you finished code.

Choose screen mode you wana use. I recommend SCREEN 13 (320*200 pix) since it's fastest one on this case.
Now you should DIM Min, MaxX MaxY where Min is 1, MaxX = 200 and MaxY = 320.
But thats now enough. We need to DIM RandomedX and RandomedY and Counter. These three dont need any default value. Just DIM them as INTEGER's
Now we have variables with what to play with.

DIM (variables)
RANDOMIZE TIMER ' this gives a random seed to your program so it wont look same every time you run it.
SCREEN 13 ' set the screen mode.

Now, SLEEP fills purpose of your need. It stops program until some key is pressed.

Then start a FOR...NEXT loop
FOR Counter = 1 TO (how many circles you want to create)
Now we need randomed location for circle.
RandomedX = INT(RND * MaxX) + 1 ' you should now figure out how to get RandomedY location.
At this point, use CIRCLE function to draw "borders" for circle. Then PAINT it. Use ten minutes to study those two functions and you know how to handle them.
After PAINT, end FOR...NEXT loop with NEXT.
After NEXT, you might wana add another SLEEP function, what makes your program to hang on, and you can see the results.

Give yourself a try and let us know if you have a problems.
buddpaul
Coder
Posts: 22
Joined: Thu Nov 23, 2006 5:21 pm
Location: Texas(US)

answer

Post by buddpaul »

Thanks for the nice kick start.....I'll let you know how it works out.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Re: reply

Post by Z!re »

buddpaul wrote:For the love of pete, guys.......I'm 37 years old and I haven't taken a programming class in over 10 years......instead of a rude tongue lashing, could I have at least a jump start, please........I've noticed there's not much help on these boards.........just a bunch of rude come-backs........

so: will you help a stranger, or no?

Here's an idea.....I know I'll have to use CIRCLE somewhere......and I'll have to assign an x,y axis and I know I'll have to determine the radius of the circle(s)..............if I knew the answer, I wouldn't ask for help.

Thanks for anything TANGIBLE you might offer instead of beating me up for being a newbie.
I'm 21, nice to meet you. And before I continue, is your space key broken? Or you just imagine .......... means .?
As for the rude tongue-lashing, well thats an impossibility, you see this is a forum made up of written replies. No tongues involved as far as I know.

And no, I wont help you, this is still obvious homework, and your attempt at making it not sound like homework failed so hard it's incredible.

Now you see, this is a rather strange, to say the least, question coming from a guy who wants to learn how to program. You see, most retards who just want their homework done do just like you. Not implying that you're a retard, you are clearly just an idiot.
In addition, if you were genuinely wanting help, and being interessted, then you'd show what you've done so far. Which you havent.
Leading to the conclusion that you dont know shit about programming, which leads the the fascinating question:
If you dont know anything about programming, why the specific request for a program?

Oh, I'm sorry, did I break your attention?

And yeah, this forum clearly sucks as we wont hand out free homework solutions. I mean, whats the point of going to school anyways! Lets just cheat our way through! All the cool kids do it, are you a cool kid buddpaul?
I have left this dump.
buddpaul
Coder
Posts: 22
Joined: Thu Nov 23, 2006 5:21 pm
Location: Texas(US)

rude replies

Post by buddpaul »

Dearest Z!re,

Yes......it's nice to meet you as well. I have loved computer technology since before you were born and it never ceases to amaze me the degree to which people believe they have a right to demean perfect strangers under the protective anonymity of the internet....case in point: your reply.

Fact: I am 37 years old. Fact: I wrote my first BASIC app. about 1 year before you were born (and God knows, haven't written many since then- - -hence my need for help).

So, it's taboo to ask for outright help on coding without posting something you've tried here......that's cool....I can roll with that.

Please, if you don't have any helpful remarks to offer me (a PERFECT STRANGER) then please keep your little robo-dweeb wise-a$$ remarks to yourself, Mr. MMORG-dork. I'm sure you cuddle up next to your computer every night in a fetal position, but I'm just a boring regular guy trying to learn a little something........and you owe me nothing......so if it's nothing or your dumb-a$$ comebacks, please provide me with nothing. :twisted:

I'm looking forward to becoming a polite, helpful member of this little community.

buddpaul
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

buddpaul, yes you are new here. However, Z!re, the famous flaming bitch, has no regard for this. If she has an opinion, there is no changing this fact. And calling Z!re a dork is like comparing Bill Gates to a pedofile... many similarities, but they are all secret.

You may want to know that Z!re is capabul of murder.
Image
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Re: rude replies

Post by sid6.7 »

buddpaul wrote:Dearest Z!re,

Yes......it's nice to meet you as well. I have loved computer technology since before you were born and it never ceases to amaze me the degree to which people believe they have a right to demean perfect strangers under the protective anonymity of the internet....case in point: your reply.

Fact: I am 37 years old. Fact: I wrote my first BASIC app. about 1 year before you were born (and God knows, haven't written many since then- - -hence my need for help).

So, it's taboo to ask for outright help on coding without posting something you've tried here......that's cool....I can roll with that.

Please, if you don't have any helpful remarks to offer me (a PERFECT STRANGER) then please keep your little robo-dweeb wise-a$$ remarks to yourself, Mr. MMORG-dork. I'm sure you cuddle up next to your computer every night in a fetal position, but I'm just a boring regular guy trying to learn a little something........and you owe me nothing......so if it's nothing or your dumb-a$$ comebacks, please provide me with nothing. :twisted:

I'm looking forward to becoming a polite, helpful member of this little community.

buddpaul

not its not its just at first it looked like a homework question from a kid
they frown on that here...as to zire...ignore her and wait for
good help from some of the nicer people around here...i'm
more of a beginner and i stick to more text based programs rather
then graphics...

but if you happne to have a qbasic book or the famous
beginning programming for dummies chapter 12 helps
alot on circles...

over at qbasicstation they have alot of helpful and friendly people
too....
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

I'll give in.

Code: Select all

RANDOMIZE TIMER

SCREEN 13

FOR I = 1 TO 8
 CIRCLE (INT(RND * 320), INT(RND * 200)), INT(RND * 20), 0
NEXT
Your job is to figure out why nothing shows up, *evil laugh*. Hint: it's in the circle command.
Image
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Re: rude replies

Post by Z!re »

buddpaul wrote:Dearest Z!re,

Yes......it's nice to meet you as well. I have loved computer technology since before you were born and it never ceases to amaze me the degree to which people believe they have a right to demean perfect strangers under the protective anonymity of the internet....case in point: your reply.

Fact: I am 37 years old. Fact: I wrote my first BASIC app. about 1 year before you were born (and God knows, haven't written many since then- - -hence my need for help).

So, it's taboo to ask for outright help on coding without posting something you've tried here......that's cool....I can roll with that.

Please, if you don't have any helpful remarks to offer me (a PERFECT STRANGER) then please keep your little robo-dweeb wise-a$$ remarks to yourself, Mr. MMORG-dork. I'm sure you cuddle up next to your computer every night in a fetal position, but I'm just a boring regular guy trying to learn a little something........and you owe me nothing......so if it's nothing or your dumb-a$$ comebacks, please provide me with nothing. :twisted:

I'm looking forward to becoming a polite, helpful member of this little community.

buddpaul
You're lucky I'm late for work.
Though, it's Mss, not Mr.
Just curious, your mum wont let you write ass?

And you didnt answer my question, are you retarded or is your space/. key broken? I am assuming you're a retard since you use space just fine from time to time, aswell as .

I wish I could cuddle up with my computer, but then I'd have to drag it up into my bed, which I'm way too lazy to do.

I'll be back later with more "robo-dweeb wise-a$$" remarks, you keep it real now buddpaul, you keep it real.
I have left this dump.
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

Alright children, both of you settle down before I whip out the spatula and start giving out the smackdowns. :P
buddpaul
Coder
Posts: 22
Joined: Thu Nov 23, 2006 5:21 pm
Location: Texas(US)

Oh, Z!re, the freak

Post by buddpaul »

......come out come out wherever you are!!!

To those of you who helped......thanks.

I'm lucky.....I love that......you're funny, fre!k.


Z!re is actually quite awesome, shes definitely my new goddess. Im going to pray to her each night before I get tucked in by my mum.
I just feel so lucky! The divine Z!re has spoken to me! Does anyone have her addres? I want to send her all my worldly possessions
This post has not been edited, and I, buddpaul, write this out of my own free will.
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

Nathan1993 wrote:I'll give in.

Code: Select all

RANDOMIZE TIMER

SCREEN 13

FOR I = 1 TO 8
 CIRCLE (INT(RND * 320), INT(RND * 200)), INT(RND * 20), 0
NEXT
Your job is to figure out why nothing shows up, *evil laugh*. Hint: it's in the circle command.
I'll give another hint - QB help is your friend. Look at the parameters, see what they do, and do some experimenting. It won't be long until you find the "error" in this program.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

It's the last 0 i the circle statement, it's the color, change it to something between 1 and 255

Also, you might want to change the size to avoid 0 sized circles:

Code: Select all

'Assignment #17
'solved by buddpaul
RANDOMIZE TIMER

SCREEN 13

DO
LOOP WHILE INKEY$ = ""

FOR I = 1 TO 5
 CIRCLE (INT(RND * 320), INT(RND * 200)), 5+INT(RND * 20), 1+INT(255*RND)
NEXT


On a sidenote, could someone help me get back into programming? I used to code a lot but lately I've forgotten it all, I just need a nudge in the right direction.
So if someone could give me the complete code and solution for a program that calculates the number of students based on three inputs then shows their average after clearing the screen.
And it should pause after it has displayed some info.
This is not homework, I just want to learn again.
My request is so specific not because it's homework but because uhm.. look, it's not homework I swear! Trust me!
And if any of you refuse to do it, I'm going to call you assholes and generally bash you for being stupid.
And if you then dont help me still, I'm going to call my mum!
I have left this dump.
bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm »

Dont you peoples have anything better to do than compete who can be the biggest and most wicked one?
"oh yeah, once again i figured something nasty say...gee i am damn awesome."
buddpaul
Coder
Posts: 22
Joined: Thu Nov 23, 2006 5:21 pm
Location: Texas(US)

Post by buddpaul »

OK, OK.....I surrender.....you've all been helpful: thank you. Let's put this topic to rest.....I will take your collective advice, work out the code and post it here.

Z!re, it looks like you almost helped me just a bit....thank you, too.....you just can't accept that I'm a grown-up and this has nothing to do with homework........OK. I'm looking forward to learning AND contributing here as well.

Thank you all again.
User avatar
BadMrBox
Veteran
Posts: 86
Joined: Tue Feb 28, 2006 12:19 pm

Post by BadMrBox »

Ms Z!re has some problems trusting people sometimes. Myself, I think this piece you asked for is quite to intelligent to be homework. Damn, thoose homework question's tends to be retarded.
Post Reply