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
No body has any ideas?
BooHooo...
Offline
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?
Offline
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