Author Topic: Snow Demo  (Read 8947 times)

0 Members and 5 Guests are viewing this topic.

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Snow Demo
« Reply #15 on: January 26, 2014, 12:19:59 pm »
Sometimes, with your version, snowflakes appear to merge with other snowflakes. And it usually ends before the entire screen is filled. Just saying.
« Last Edit: January 26, 2014, 12:22:59 pm by JWinslow23 »
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Snow Demo
« Reply #16 on: January 26, 2014, 12:27:00 pm »
Uh, yup, I forgot to add one line:
Code: [Select]
Ans→L2(Ans
This should be inserted before (or after, doesn't really matter) the line redrawing the new location of the snowflake.

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Snow Demo
« Reply #17 on: January 26, 2014, 12:34:10 pm »
Works, except for one thing...

When there is only one opening in the top spot, it freezes. I recommend you just generate a snowflake position, and if a snowflake isn't there already, then and only then can you add it as a snowflake.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Snow Demo
« Reply #18 on: January 26, 2014, 12:39:05 pm »
It shouldn't freeze... I mean, theoretically, with a perfect random number generator it can, but the probability that it hasn't found an opening after n iterations is (15/16)n.

It has always worked pretty quickly for me at finding the opening. Also, my program exits when the screen is full (or clear is pressed).

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Snow Demo
« Reply #19 on: January 26, 2014, 12:48:45 pm »
Let me explain it to you in the least complicated way I can...

The RNG makes a snowflake in two unfilled positions at the top.
Near the end, these positions become filled.
When there is only one unfilled position, it finds that position, makes a snowflake there, then checks for another unfilled position.
The problem is, there is no unfilled position.
So it keeps generating forever.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Snow Demo
« Reply #20 on: January 26, 2014, 12:53:52 pm »
It generates 2 each cycle by default.
There are 128 positions.
This will never happen :P

And in case you wanted to do a number that doesn't evenly divide into 128, this piece of the code allows exiting as soon as 128 flakes are on screen:
Code: [Select]
E+1→E
If E=128
S→B
That exits the For() loop to prevent generating any more snow flakes, then if you look at the main Repeat loop conditions:
Code: [Select]
Repeat E>=128 or getKey=45
This exits if [Clear] is pressed or E is 128 or larger. E counts how many flakes have been drawn.

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Snow Demo
« Reply #21 on: January 26, 2014, 12:57:32 pm »
Really? Cause it has. :P

Try setting 100 as rand before starting the program. You'll see what I mean.

« Last Edit: January 26, 2014, 01:11:50 pm by JWinslow23 »
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Snow Demo
« Reply #22 on: January 26, 2014, 01:09:15 pm »
That appears to be a bug with collision detection. Feel free to try to figure it out :P
Theoretically, the top spots should only be full if all the rest below are full.

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Snow Demo
« Reply #23 on: January 26, 2014, 01:12:41 pm »
And they are. :P

Really, the demo "fills" a top spot every iteration. Then, on the next iteration, it falls down.

If you wanna know how to fix it, I know.
« Last Edit: January 26, 2014, 01:14:41 pm by JWinslow23 »
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Snow Demo
« Reply #24 on: January 26, 2014, 01:39:59 pm »
[discussion in IRC]
[time passes]
Here is my program, it just does one at a time for competition and it spits out a new flake at each iteration with probability 1/2.

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Snow Demo
« Reply #25 on: January 26, 2014, 01:40:55 pm »
OK, it's settled.

Xeda and I are going to have a competition.

The rules:
We must modify our codes to be almost similar, except for mine using lists and hers using matrices. (i.e. either I generate my snowflakes one after another, or she generates hers at random times)
We must each test 3 values of rand: 0, 10, and 100.
We shall make another program in this format and run it:
Code: [Select]
startTmr -> Z
prgmOURSNOW
Disp checkTmr(Z
Whoever has a lower value for most of them is the winner.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Snow Demo
« Reply #26 on: January 26, 2014, 01:43:46 pm »
Do you generate a new snowflake with probability .5 ?

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Snow Demo
« Reply #27 on: January 26, 2014, 01:47:44 pm »
int(2rand has a .5 probability of being 1 or 0, right? So yeah.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Snow Demo
« Reply #28 on: January 26, 2014, 01:51:01 pm »
Yep, that is what I am using. By the way, I am just running through the program 3 times and timing it with the given rand seeds. (I am doing it all in one program, though)

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Snow Demo
« Reply #29 on: January 26, 2014, 01:55:51 pm »
So am I.

Here's what I got.

rand
0
50
100
Josiah
201
201
191
Xeda
477
334
353

I dunno, it's really at the mercy of the generator. And how many times you use it.
« Last Edit: January 26, 2014, 01:56:27 pm by JWinslow23 »
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?