Page 1 of 1

Problem with Scratch CA script

Posted: March 2nd, 2018, 12:52 pm
by gameoflifemaniac
This was supposed to be a script that can run any B/S rule on a closed 19*19 grid.
https://scratch.mit.edu/projects/207360033/#editor
But it doesn't work! What's wrong with this script?

Re: Problem with Scratch CA script

Posted: March 2nd, 2018, 1:18 pm
by rowett
gameoflifemaniac wrote:This was supposed to be a script that can run any B/S rule on a closed 19*19 grid.
https://scratch.mit.edu/projects/207360033/#editor
But it doesn't work! What's wrong with this script?
Interesting stuff...

The first problem I found is that you need to set the pen colour before updating the grid at the end.

Re: Problem with Scratch CA script

Posted: March 2nd, 2018, 2:18 pm
by gameoflifemaniac
rowett wrote:
gameoflifemaniac wrote:This was supposed to be a script that can run any B/S rule on a closed 19*19 grid.
https://scratch.mit.edu/projects/207360033/#editor
But it doesn't work! What's wrong with this script?
Interesting stuff...

The first problem I found is that you need to set the pen colour before updating the grid at the end.
Idk
Even if I fixed this script, it would be painfully slow. This prototype was actually an attempt to fix an issue that occured in my first prototype, because that one was the SECOND. The first is much faster, because the square doesn't have to move to the neighboring cells and check if it's touching grey. Instead, it checks the value of item for example cell#+1 or cell#-20 or cell+19. But something weird happens at the edge. If you draw something, you'll find out why.
Here's the script:
https://scratch.mit.edu/projects/207380010/
But I found out how to fix that. I just have to not allow the neighbor count to increase by 1 in special cases. For example:
if item(cell#-1)of pattern = 1 and not(cell# mod 19 = 1) then
change neighbor count by 1
That means that if the cell that the square is checking is on the left edge, the cell cell#-1 (which is on the right edge one line above), won't be taken into account. But I'm too lazy to do this now :lol:

Re: Problem with Scratch CA script

Posted: March 2nd, 2018, 6:03 pm
by BlinkerSpawn
I believe it's wrapping horizontally and vertically but not both at once for corner cases.

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 2:55 am
by gameoflifemaniac
Ok, I added the neighborhood exceptions. The third prototype is here:
https://scratch.mit.edu/projects/207474227/
But it doesn't work either! For example, the loaf dies when it's on the edge. Help!

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 5:24 am
by 77topaz
gameoflifemaniac wrote:Ok, I added the neighborhood exceptions. The third prototype is here:
https://scratch.mit.edu/projects/207474227/
But it doesn't work either! For example, the loaf dies when it's on the edge. Help!
Additionally, the corners of the box break when you try a B0 rule.

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 9:37 am
by gameoflifemaniac
77topaz wrote:
gameoflifemaniac wrote:Ok, I added the neighborhood exceptions. The third prototype is here:
https://scratch.mit.edu/projects/207474227/
But it doesn't work either! For example, the loaf dies when it's on the edge. Help!
Additionally, the corners of the box break when you try a B0 rule.
What I did do wrong?

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 1:12 pm
by gameoflifemaniac
GG
I did the script!!!
https://scratch.mit.edu/projects/207527992/
It seems to work, and it's only lite because it does only one main feature: calculating the pattern. The full version will contain a population counter and a rule displayer and will be released soon. Maybe I will make the grid bigger...

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 3:56 pm
by 77topaz
gameoflifemaniac wrote:GG
I did the script!!!
https://scratch.mit.edu/projects/207527992/
It seems to work, and it's only lite because it does only one main feature: calculating the pattern. The full version will contain a population counter and a rule displayer and will be released soon. Maybe I will make the grid bigger...
Now, instead of just breaking at the corners for B0 rules, it breaks all along the edges. :P

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 5:01 pm
by gameoflifemaniac
77topaz wrote:
gameoflifemaniac wrote:GG
I did the script!!!
https://scratch.mit.edu/projects/207527992/
It seems to work, and it's only lite because it does only one main feature: calculating the pattern. The full version will contain a population counter and a rule displayer and will be released soon. Maybe I will make the grid bigger...
Now, instead of just breaking at the corners for B0 rules, it breaks all along the edges. :P
This is normal. It's a closed grid.

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 5:05 pm
by 77topaz
gameoflifemaniac wrote:This is normal. It's a closed grid.
But wouldn't it make more sense to have the edges automatically stay in the right state, as they would if the entire universe were "strobing"?

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 5:08 pm
by gameoflifemaniac
77topaz wrote: But wouldn't it make more sense to have the edges automatically stay in the right state, as they would if the entire universe were "strobing"?
What do you mean? They do!

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 5:13 pm
by 77topaz
gameoflifemaniac wrote:
77topaz wrote: But wouldn't it make more sense to have the edges automatically stay in the right state, as they would if the entire universe were "strobing"?
What do you mean? They do!
No, the cells at the edges don't act as if the entire universe were strobing. For example, try B012345678/S5. The edges in this rule should simply strobe, but they remain alive at the transition from a live background to a dead one, because the simulator treats them as if they have five live neighbours rather than eight. Thus, it is clear that this simulator treats every cell outside the box as always dead, even for B0 rules where they should strobe.

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 5:34 pm
by gameoflifemaniac
77topaz wrote:
gameoflifemaniac wrote: What do you mean? They do!
No, the cells at the edges don't act as if the entire universe were strobing. For example, try B012345678/S5. The edges in this rule should simply strobe, but they remain alive at the transition from a live background to a dead one, because the simulator treats them as if they have five live neighbours rather than eight. Thus, it is clear that this simulator treats every cell outside the box as always dead, even for B0 rules were they should strobe.
Ahh... But it runs the same as in Golly. If you run the rule R1, C0, S5..5, B0..8, NM:P19,19 (B012345678/S5:P19,19),
it would behave just as in the script.

Re: Problem with Scratch CA script

Posted: March 3rd, 2018, 5:46 pm
by fluffykitty
Well, what do you want to do?

Re: Problem with Scratch CA script

Posted: March 4th, 2018, 6:27 am
by gameoflifemaniac
fluffykitty wrote:Well, what do you want to do?
In what sense?

Re: Problem with Scratch CA script

Posted: March 4th, 2018, 8:40 am
by gameoflifemaniac
Btw, here's the complete script.
https://scratch.mit.edu/projects/209098001/

Re: Problem with Scratch CA script

Posted: March 23rd, 2018, 1:39 pm
by gameoflifemaniac
I'm working on a function that copies the pattern into RLE format. But it works only for one-cell thick patterns. For other patterns it never stops the calculation! Help!

Re: Problem with Scratch CA script

Posted: March 23rd, 2018, 1:44 pm
by BlinkerSpawn
gameoflifemaniac wrote:I'm working on a function that copies the pattern into RLE format. But it works only for one-cell thick patterns! Help!
Your script should be inserting a '$' at the end of each row to indicate a new row.

Re: Problem with Scratch CA script

Posted: March 23rd, 2018, 4:18 pm
by gameoflifemaniac
BlinkerSpawn wrote:
gameoflifemaniac wrote:I'm working on a function that copies the pattern into RLE format. But it works only for one-cell thick patterns! Help!
Your script should be inserting a '$' at the end of each row to indicate a new row.
I mean, read my post once again, because I edited it.
EDIT: I figured out how to fix it.
EDIT: Fixed!
EDIT: The link to the script is now different.
https://scratch.mit.edu/projects/213417388/