http://calcg.org/newlogo2.png Not Logged in.
Login | Register

General Discussion Board \ Game and Program Discussion \ snowing program

Click here to log in (you must be logged in to post comments).

AuthorComment
gulyman
Goliath
avatar
Posted: 17 May 2009
12:22 GMT
Total Posts: 144
I made this program and I thought it was pretty cool. It creates "snow". Coincidentally, it's been snowing this morning.

8->dim(L6
For(A,1,8
randInt(1,16)->L6(A) <assign random x-coordinates>
End
ClrHome
While 1 <start main loop>
For(A,1,8
Output(A,1," " <clear horizontal line>
Output(A,L6(A),"*" <output snow>
End
For(A,7,1,-1 <move all x-coordinates up one
L6(A)->L6(A+1) increasing their Y-coordinate>
End
randInt(1,16)->L6(1) <assign new x-coordinate to new snowflake>
End
haveacalc
Guardian
avatar
Posted: 17 May 2009
13:10 GMT
Total Posts: 1111
It looks like it would make *'s rain down from the top of the screen, given that by
Output(A,1," "
you meant
Output(A,1,"                "
Looks good! You know, if you want to turn your calc upside down, the following would work:
While 1
Disp sub(" * ",randInt(1,16),16
End


---
-quoted directly from most movies that don't exist (and some that do).
gulyman
Goliath
avatar
Posted: 17 May 2009
13:31 GMT
Total Posts: 144
Looking at how far the comments are from the code, tells me that the extra spaces were taken out of my post. Did you use a bunch of &nbsp; in your post to stop that from happening?

That's really cool, I've never used the sub( function before... I get it. It uses Disp( to push everything up so that it doesn't have to keep track of which column and what not. That's pretty slick.
Barrett
Administrator
avatar
Posted: 19 May 2009
19:34 GMT
Total Posts: 1676
You can either do that, or what he did, which was using a <pre> tag surrounding everything.

---
-Barrett A
gulyman
Goliath
avatar
Posted: 20 May 2009
20:37 GMT
Total Posts: 144
I took out one of the For( loops while I was bored in chem
9->dim(L6
For(A,1,9
randInt(1,16)->L6(A) <assign random x-coordinates>
End
While 1 <start main loop>
For(A,8,1,-1
Output(A,1," " <clear horizontal line>
Output(A,L6(A),"*" <output snow>
L6(A)->L6(A+1) <increasing their Y-coordinate>
End
randInt(1,16)->L6(1) <assign new x-coordinate to new snowflake>
End

I don't know why people don't post more source code. I think it'd be fun to read.





Portal | My Account | Register | Lost Password or Username | TOS | Disclaimer | Help | Site Search | File Archives Copyright © 2002-2019 CalcG.org