Discuss Scratch

MartinBraendli2
Scratcher
100+ posts

[ATC#1] Rule 110

I declare this the first “Advanced Topics Challenge”. The Winner is allowed to carry this beautiful trophy in his/her signature:


- He/She can either create the next ATC or name someone to do so.
- Challenges can be anything from riddles, puzzles, code golf etc. The challenge doesn't have to be related to Scratch, but it should target the average AT-Reader. I think, the challenge should be something involving logic and crown a winner by objective means. However, the winner of a challenge has total freedom on the rules of it.
- Each challenge has a maximum time frame of one month (shorter time frames are advised).
- If the winner is decided by the first correct submission, then it would be fair to announce the challenge in advance, e.g. 24h before, in the thread of the previous challenge


I'll leave these here for quick access on upcoming challenges (thanks to PullJosh)






ATC#1:
Update: PullJosh solved the puzzle. Congratulations!


Make a Rule 110 program, that tells you, when a certain pattern appears first. This is simple, but the rules make it a bit tricky:
1. When the green flag is pressed, the user can enter a string, a starting pattern of "X" and "_" (underscore) into a ask&wait dialogue.
2. After that, the user can enter another pattern composed of X and underscore.
3. The program must then tell the user (again via ask&wait), on what line/iteration the 2nd pattern appears first.
4. No variables and lists are allowed (not even built in variables, except "answer")
5. No boolean blocks.
6. No hacked blocks.
EDIT: Changed in “5.” “operators” to “blocks”.
You are now allowed to brainstorm in this thread, even if it spoils part of the challenge.

Explanation:
1. The character “X” corresponds to 1, the character “_” corresponds to 0.
2. The program only must be able to search for patterns starting and ending with X.
3. Line 1 corresponds to the input.
4. No system-variables means, you cant use any of the blocks, that have a checkbox left of them in the blocks menu.
EDIT:
([volume v] of [Stage  v])
isn't allowed either (it accesses built in variables).
5. No boolean operators means, you can't use any of the blocks that have 6 corners. Combining rules 5 & 6 means, that you also can't use the “if”, “if/else”, “wait until” and “repeat until” blocks.
6. No hacking means, that you have to be able to recreate that program in the original scratch editor, without importing or using blocks from the backpack.


The following table can help you to test your program (testname, input pattern, search pattern, expected output):
Test1:
X
X
1
Test2:
X
XX_X
4
Test3:
X_X
X_X_X
9
Test4:
XXX_XXX
X_X
1
Test5
X__X
XXXXXXXX
19
Test6:
XXX___XXX
X__XX__X
25
Test7:
X_XX__XXX___X
XXX_XX_X_X
27

Last edited by MartinBraendli2 (July 6, 2016 00:48:57)

jokebookservice1
Scratcher
1000+ posts

[ATC#1] Rule 110

Oh, I see how one might do this without Booleans. I'll work on this later
joefarebrother
Scratcher
500+ posts

[ATC#1] Rule 110

Is the
([ v] of [  v])
block allowed to access variables? It doesn't have a checkbox next to it
IcyCoder
Scratcher
1000+ posts

[ATC#1] Rule 110

joefarebrother wrote:

Is the
([ v] of [  v])
block allowed to access variables? It doesn't have a checkbox next to it
smart
MartinBraendli2
Scratcher
100+ posts

[ATC#1] Rule 110

joefarebrother wrote:

Is the
([ v] of [  v])
block allowed to access variables? It doesn't have a checkbox next to it
Oh, forgot about this one. Nope, this block isn't allowed either (it accesses built in variables). I will edit the rule explanation to make this clear.
jokebookservice1
Scratcher
1000+ posts

[ATC#1] Rule 110

Very.
MartinBraendli2
Scratcher
100+ posts

[ATC#1] Rule 110

Just to be clear: This is a puzzle for coders, not for lawyers. The goal is not to find legal loop holes, but to program with a limited selection of blocks.
And to avoid the question: A parameter (for example of a custom block) is NOT a variable, and therefore allowed.
jokebookservice1
Scratcher
1000+ posts

[ATC#1] Rule 110

Me thinking out loud: <spoiler>Tail-calling on broadcasts to simulate conditionals, and recursion to iterate through a string</spoiler>
MartinBraendli2
Scratcher
100+ posts

[ATC#1] Rule 110

MartinBraendli2 wrote:

Just to be clear: This is a puzzle for coders, not for lawyers. The goal is not to find legal loop holes, but to program with a limited selection of blocks.
And to avoid the question: A parameter (for example of a custom block) is NOT a variable, and therefore allowed.

The rules are the ones in described first, the explanation is just there for clarification. So if you manage somehow that the
<[5] > [2 ]>
block doesn't have 6 corners anymore, its still not allowed (Rules > Explanation). Its still a boolean operator, even without 6 corners.
jokebookservice1
Scratcher
1000+ posts

[ATC#1] Rule 110

EDIT: Nevermind

Last edited by jokebookservice1 (July 2, 2016 12:42:46)

MartinBraendli2
Scratcher
100+ posts

[ATC#1] Rule 110

jokebookservice1 wrote:

Me thinking out loud: <spoiler>Tail-calling on broadcasts to simulate conditionals, and recursion to iterate through a string</spoiler>
<spoiler>
I don't see how broadcasts could be of any use. I only use them to create different “theads” or to “communicate” with other sprites
</spoiler>
jokebookservice1
Scratcher
1000+ posts

[ATC#1] Rule 110

MartinBraendli2 wrote:

jokebookservice1 wrote:

Me thinking out loud: <spoiler>Tail-calling on broadcasts to simulate conditionals, and recursion to iterate through a string</spoiler>
<spoiler>
I don't see how broadcasts could be of any use. I only use them to create different “theads” or to “communicate” with other sprites
</spoiler>
<spoiler>

broadcast(letter something of answer)

when I recieve X
do stuff

when I recieve _
do stuff

</spoiler>
EDIT: Forgot the closing HTML spoiler tag

Last edited by jokebookservice1 (July 2, 2016 19:38:03)

MartinBraendli2
Scratcher
100+ posts

[ATC#1] Rule 110

Is anyone trying to solve this?
BookOwl
Scratcher
1000+ posts

[ATC#1] Rule 110

I'll try.
How are edges handled?

Last edited by BookOwl (July 4, 2016 17:58:50)

MartinBraendli2
Scratcher
100+ posts

[ATC#1] Rule 110

BookOwl wrote:

I'll try.
How are edges handled?
What do you mean by “edges”? The program must be able to (theoretically) handle rows of infinite width, so you cant put a limit on that (for example limiting your program to 100 cells per row).
Or do you mean something different?

Last edited by MartinBraendli2 (July 4, 2016 20:12:06)

BookOwl
Scratcher
1000+ posts

[ATC#1] Rule 110

I meant how do I handle the first and last cells?
MartinBraendli2
Scratcher
100+ posts

[ATC#1] Rule 110

Every row starts and ends with X, so on the next row, you always start with r(__X), which is an additional X, and end with either r(XX_) or r(_X_), which both gets X. You don't need to go further, because r(X__) will give you _.

So if you start with X (or 1), you get
     X  start
XX r(__X),r(_X_)
XXX r(__X),r(_XX),r(XX_)
XX_X r(__X),r(_XX),r(XXX),r(XX_)
XXXXX r(__X),r(_XX),r(XX_),r(X_X),r(_X_)
XX___X r(__X),r(_XX),r(XXX),r(XXX),r(XXX),r(XX_)
MartinBraendli2
Scratcher
100+ posts

[ATC#1] Rule 110

I declare this the first “Advanced Topics Challenge” (Original post got updated). I hope this catches on, there are currently too many challenges at once (IMO)
helloandgoodbye9
Scratcher
1000+ posts

[ATC#1] Rule 110

MartinBraendli2 wrote:

I declare this the first “Advanced Topics Challenge” (Original post got updated). I hope this catches on, there are currently too many challenges at once (IMO)
There are already lots of AT challenges, so Im not sure if you can call it the first.
joefarebrother
Scratcher
500+ posts

[ATC#1] Rule 110

I have an idea in terms of recursion to emulate variables, but that's just going to explode the stack, as Scratch isn't tail call optimised

Powered by DjangoBB