Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 need help in making snow with "*"
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
weweii




PostPosted: Thu Jan 06, 2005 4:13 pm   Post subject: need help in making snow with "*"

we have to do a winter scene, but i don't know how to do the snow with the " * ".

Please help!!!! anyone??
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Thu Jan 06, 2005 4:31 pm   Post subject: (No subject)

So, does that mean that you're making a snow scene using ASCII? If so, locatexy might be of help. So would an array or two.
weweii




PostPosted: Thu Jan 06, 2005 6:43 pm   Post subject: (No subject)

thank you for your solution! but i still don't really understand, can you please post the whole program here, so that i can see it?

thx alot!
Cervantes




PostPosted: Thu Jan 06, 2005 7:00 pm   Post subject: (No subject)

weweii wrote:
can you please post the whole program here, so that i can see it?

No. I won't do your homework for you. Even if it's not homework and is purely for out-of-school-educational purposes, I still won't do it for you.
I can, however, help you. Tell me, do you understand arrays? Are you adept at using for loops in conjunction with arrays? Do you understand records?
weweii




PostPosted: Fri Jan 07, 2005 5:11 pm   Post subject: (No subject)

Cervantes wrote:
weweii wrote:
can you please post the whole program here, so that i can see it?

No. I won't do your homework for you. Even if it's not homework and is purely for out-of-school-educational purposes, I still won't do it for you.
I can, however, help you. Tell me, do you understand arrays? Are you adept at using for loops in conjunction with arrays? Do you understand records?


i don't~~~ i just took computer science this year.. Embarassed
Cervantes




PostPosted: Fri Jan 07, 2005 5:32 pm   Post subject: (No subject)

Unless you can come up with a simpler way to portray the image of snow, using ASCII characters, I suggest you start reading up on arrays.
There have been a few snow programs posted on compsci.ca, though they use graphics, not ASCII. Using locatexy, (and some sorting to make it so that the characters on each line are drawn left to right, not in a random order), you could pretty easily transpose a graphics scene into an ASCII scene. Try searching for them.
TheZsterBunny




PostPosted: Fri Jan 07, 2005 6:01 pm   Post subject: (No subject)

weiwei,

by now, you should know the locate(x,y), put, and randint commands.

just use them creatively

randomly locate stars on the screen. its not that difficult. think!

-Z
weweii




PostPosted: Sat Jan 08, 2005 5:56 pm   Post subject: (No subject)

hooray ! I got it! but.. another problem came to me....
i already drawed the objects that will not be moving , but they are covered by the snow flakes scene. so i can only see the snowflakes with the blue background~~~ Crying or Very sad
really appreciated for people who helped me and for people who will. Very Happy
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sat Jan 08, 2005 6:21 pm   Post subject: (No subject)

weweii wrote:

i already drawed the objects that will not be moving , but they are covered by the snow flakes scene. so i can only see the snowflakes with the blue background~~~ Crying or Very sad

huh? umm... are you drawing static objects with ASCII? Or with graphics? Either way, redraw them each time through the loop.
weweii




PostPosted: Sun Jan 09, 2005 5:25 pm   Post subject: (No subject)

i think i 'll have to do it in ascii. but can someone please give me an example of randint?
Cervantes




PostPosted: Sun Jan 09, 2005 6:22 pm   Post subject: (No subject)

That's up to Zster, because I'll be damned if snow moves randomly.
TheZsterBunny




PostPosted: Sun Jan 09, 2005 7:14 pm   Post subject: (No subject)

lol


weiwei, you have ferrara as your compsci teacher?

coz then all you have to do is draw astericies ('*'s) randomly on the screen to simulate snow.

now, my personal favourite way to get random numbers is this.
code:

x := Rand.Int(lo,hi)

the one you probably know is
code:

randint(x,lo,hi)

and thats okay too. make sure that x is an integer tho'

I prefer the upper one because you don't necessairly need to keep a variable for that number, conveniant when you're only going to use it once.

-Z
weweii




PostPosted: Sun Jan 09, 2005 10:31 pm   Post subject: (No subject)

finished!!!! finally.......
thank you guys alot for helping me out on these "not-very-challenging" problems!
Hikaru79




PostPosted: Sun Jan 09, 2005 11:58 pm   Post subject: (No subject)

weweii wrote:
finished!!!! finally.......
thank you guys alot for helping me out on these "not-very-challenging" problems!


I think a lot of confusion was spawned by you saying "drawing snow with '*'", because it's an ASCII character, an operator (4 * 3) and a static value (myString (*-3)). I just hope we haven't led you to making an ASCII program when that's not what you intended ^ ^:;
TheZsterBunny




PostPosted: Mon Jan 10, 2005 8:22 pm   Post subject: (No subject)

for the hell of it, here's some code.

code:

colorback (blue)
cls
colorback (white)
loop
    colorback (white)
    locate (Rand.Int (1, maxrow), Rand.Int (1, maxcol))
    put "*" ..
    colorback (blue)
    locate (Rand.Int (1, maxrow), Rand.Int (1, maxcol))
    put " " ..
    exit when hasch
end loop



-Z

p.s. hikaru, your siggie is damaged. url tags out of whack. ^_^
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: