Problem with Scratch CA script
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Problem with Scratch CA script
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?
https://scratch.mit.edu/projects/207360033/#editor
But it doesn't work! What's wrong with this script?
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
Re: Problem with Scratch CA script
Interesting stuff...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?
The first problem I found is that you need to set the pen colour before updating the grid at the end.
LifeViewer https://lazyslug.com/lifeviewer
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
Idkrowett wrote:Interesting stuff...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?
The first problem I found is that you need to set the pen colour before updating the grid at the end.
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
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
- BlinkerSpawn
- Posts: 1992
- Joined: November 8th, 2014, 8:48 pm
- Location: Getting a snacker from R-Bee's
Re: Problem with Scratch CA script
I believe it's wrapping horizontally and vertically but not both at once for corner cases.
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
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!
https://scratch.mit.edu/projects/207474227/
But it doesn't work either! For example, the loaf dies when it's on the edge. Help!
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
Re: Problem with Scratch CA script
Additionally, the corners of the box break when you try a B0 rule.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!
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
What I did do wrong?77topaz wrote:Additionally, the corners of the box break when you try a B0 rule.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!
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
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...
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...
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
Re: Problem with Scratch CA script
Now, instead of just breaking at the corners for B0 rules, it breaks all along the edges.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...
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
This is normal. It's a closed grid.77topaz wrote:Now, instead of just breaking at the corners for B0 rules, it breaks all along the edges.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...
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
Re: Problem with Scratch CA script
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"?gameoflifemaniac wrote:This is normal. It's a closed grid.
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
What do you mean? They do!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"?
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
Re: Problem with Scratch CA script
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.gameoflifemaniac wrote:What do you mean? They do!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"?
Last edited by 77topaz on March 3rd, 2018, 6:41 pm, edited 1 time in total.
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
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),77topaz wrote: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.gameoflifemaniac wrote: What do you mean? They do!
it would behave just as in the script.
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
-
- Posts: 1175
- Joined: June 14th, 2014, 5:03 pm
- Contact:
Re: Problem with Scratch CA script
Well, what do you want to do?
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
In what sense?fluffykitty wrote:Well, what do you want to do?
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
Btw, here's the complete script.
https://scratch.mit.edu/projects/209098001/
https://scratch.mit.edu/projects/209098001/
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
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!
Last edited by gameoflifemaniac on March 23rd, 2018, 1:45 pm, edited 1 time in total.
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!
- BlinkerSpawn
- Posts: 1992
- Joined: November 8th, 2014, 8:48 pm
- Location: Getting a snacker from R-Bee's
Re: Problem with Scratch CA script
Your script should be inserting a '$' at the end of each row to indicate a new row.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!
- gameoflifemaniac
- Posts: 1242
- Joined: January 22nd, 2017, 11:17 am
- Location: There too
Re: Problem with Scratch CA script
I mean, read my post once again, because I edited it.BlinkerSpawn wrote:Your script should be inserting a '$' at the end of each row to indicate a new row.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!
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/
I was so socially awkward in the past and it will haunt me for the rest of my life.
Code: Select all
b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!