Computer Science Canada

need help in making snow with "*"

Author:  weweii [ 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??

Author:  Cervantes [ Thu Jan 06, 2005 4:31 pm ]
Post 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.

Author:  weweii [ Thu Jan 06, 2005 6:43 pm ]
Post 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!

Author:  Cervantes [ Thu Jan 06, 2005 7:00 pm ]
Post 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?

Author:  weweii [ Fri Jan 07, 2005 5:11 pm ]
Post 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

Author:  Cervantes [ Fri Jan 07, 2005 5:32 pm ]
Post 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.

Author:  TheZsterBunny [ Fri Jan 07, 2005 6:01 pm ]
Post 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

Author:  weweii [ Sat Jan 08, 2005 5:56 pm ]
Post 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

Author:  Cervantes [ Sat Jan 08, 2005 6:21 pm ]
Post 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.

Author:  weweii [ Sun Jan 09, 2005 5:25 pm ]
Post subject: 

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

Author:  Cervantes [ Sun Jan 09, 2005 6:22 pm ]
Post subject: 

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

Author:  TheZsterBunny [ Sun Jan 09, 2005 7:14 pm ]
Post 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

Author:  weweii [ Sun Jan 09, 2005 10:31 pm ]
Post subject: 

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

Author:  Hikaru79 [ Sun Jan 09, 2005 11:58 pm ]
Post 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 ^ ^:;

Author:  TheZsterBunny [ Mon Jan 10, 2005 8:22 pm ]
Post 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. ^_^

Author:  Cervantes [ Mon Jan 10, 2005 8:39 pm ]
Post subject: 

Dammit Zster! That's exactly what I'm talking about! Snow isn't random!! Nor does that even look like snow! Bah...

Author:  scottyrush13 [ Mon Jan 10, 2005 10:12 pm ]
Post subject: 

im going to have to agree with cervantes here, that looks nothing like snow, because all the snow flakes should be moving in the same direction (because of wind), but puttin them random makes it look like theres 15 different wind directions because it looks like the snow is moving left and up and diagonal and everything Laughing

Author:  TheZsterBunny [ Wed Jan 12, 2005 11:54 am ]
Post subject: 

weiwei, i'm guessing, is in compsci 11 right now. we have projects coming up, and even tho compsci is the best 'use' of time out there we have science projects coming up.

-Z


: