This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-07-31 13:21:30

RoyandAnna
Scratcher
Registered: 2009-07-21
Posts: 20

Scratch project becoming SENTIENT!!!!

Obviously the subject of this post is a bit tongue in cheek but I do need some help trying to recreate a famous puzzle from G.E.B. in a Scratch project. 

Here is my problem.  I have a variable that consists of a series of letters.  The number of letters this variable contains varys.  It might be only 1 letter but it might be 30 letters long. 

If the same 3 letters appear in a row within the variable, I want to be able replace these letters with 1 letter, but at the same location that the 3 letters originally appeared. 

I have figured out how to write a script that would have Scratch search the variable letter by letter determining if the same 3 letters appear in a row. 

What I can't figure out is how to replace these 3 letters with a 1 different letter but maintain the position of the remaining letters within the variable. 

Any ideas?

For those that are curious, I am trying to recreate the MU puzzle from Godel Escher Bach by Douglas Hofstadter.  I have Rule 1 and Rule 2 working perfectly, and the above question is to finish the script for Rule 3.  Obviously, the same script for Rule 3 will work for Rule 4 with a little tweaking. 

Thanks.

Offline

 

#2 2009-07-31 15:12:33

RoyandAnna
Scratcher
Registered: 2009-07-21
Posts: 20

Re: Scratch project becoming SENTIENT!!!!

No body has any ideas?

BooHooo...

Offline

 

#3 2009-07-31 15:30:13

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Scratch project becoming SENTIENT!!!!

First, create a script that puts the variable into a list of one-character values.

Now do the actions you want with the list blocks. This should be possible (replace, remove, ...)

Since you are using a list containing only one-character values, you can use the list reporter block (the one that looks like a variable) to get the string - it zill not add in any spaces.

Does that help?


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#4 2009-07-31 15:36:53

RoyandAnna
Scratcher
Registered: 2009-07-21
Posts: 20

Re: Scratch project becoming SENTIENT!!!!

JSO wrote:

First, create a script that puts the variable into a list of one-character values.

Now do the actions you want with the list blocks. This should be possible (replace, remove, ...)

Since you are using a list containing only one-character values, you can use the list reporter block (the one that looks like a variable) to get the string - it zill not add in any spaces.

Does that help?

That is a wonderful idea!!! I will need to rewrite the whole project, but that isn't that big a deal. 

Thanks for the help.

Offline

 

Board footer