Discuss Scratch

PullJosh
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

So who's making the compiler that recreates your project using as few unique blocks as possible?
helloandgoodbye9
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

PullJosh wrote:

So who's making the compiler that recreates your project using as few unique blocks as possible?
No me!
Also, you need custom blocks for no screen refresh.

Last edited by kaj (Tomorrow 25:61:61) ͪͪͪͪͪͪͪͪͪͪ ͣͣͣͣ ͯͯͯͯYes, its above the line)
adespotist
New to Scratch
95 posts

Fewest amount of blocks technically needed to use Scratch

PullJosh wrote:

So who's making the compiler that recreates your project using as few unique blocks as possible?
Maybe after I finish my library https://github.com/adespotist/sb2 it will be easier to do stuff like that.

Last edited by adespotist (April 27, 2016 00:20:50)


Our words are backed with NUCLEAR WEAPONS!
Jonathan50
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

Tymewalk wrote:

Here's my list:

forever - repeat (99999999999999999...)
go to x:() y:() - set x to (), set y to ()
move () steps - lot of code I can't post here but definitely possible
change [v] by () - set [v] to (thing) + ()
() * () - use () + () repeatedly
if then else:
set [else v] to [0]
if <thing> then
set [else v] to [1]
end
if <(else :: variables) = [0]> then
...
end

Probably a bunch more, too. Interesting…
Repeat (99999999999999999) would end sometime. You need
repeat until <[1] = [0]>

end

Not yet a Knight of the Mu Calculus.
Jonathan50
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

Hm…
I know this isn't Scratch but Snap!, but all the blocks required to do everything a Turing machine can do are
({} ▶ :: grey ring)
(call ({} ▶ :: grey ring) ▶ :: control)

Not yet a Knight of the Mu Calculus.
MegaApuTurkUltra
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

scratchisthebest wrote:

MegaApuTurkUltra wrote:

In that case
(x position)
(y position)
(direction)
Variables?

You can get rid of “not” because of this:

if <condition::sensing> then

else
do stuff :: sound
end

You can get rid of the “X of Y” sensing block because of variables as well.

“timer” can be done with “days since 2000”, minus an offset, and rounded to three decimal places.

I think “rest for x beats” can be done with just “wait x secs” as well (or vice versa if you're crazy)
1. removed. () of () works on yourself
2. I got rid of “or” and “>” so you kinda need “not”
3. You need the () of () for sensing other sprites' variables. No workaround for that
4. removed timer reporter, kept “reset timer” for the timer hat
5. removed

Last edited by MegaApuTurkUltra (April 27, 2016 00:41:57)


$(".box-head")[0].textContent = "committing AT crimes since $whenever"
Jonathan50
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

NickyNouse wrote:

Forever and repeat () would both be out, the only thing you technically need is repeat until
the subtract block is gone, you can do ((x)+((-1) * (x)))
likewise, a good portion of the functions in the ([ v] of ()) operator block can be achieved with if-else and a lot of basic arithmetic blocks
custom blocks are probably out, everything you can do with a custom block can be achieved with a broadcast one way or another
Can't custom blocks take variables out?
set [x v] to [1]
set [y v] to [2]
set [z v] to [3]
say ((x) + ((y) + (z)))
becomes
my block (1) (2) (3)
define my block (x) (y) (z)
say ((x) + ((y) + (z)))
Mutation shouldn't be necessary, but it's doable with no extra blocks:
set [x v] to [1]
set [y v] to [2]
set [z v] to [3]
say ((x) + ((y) + (z)))
set [z v] to [4]
say ((x) + ((y) + (z)))
becomes
my block 1 (1) (2) (3)
define my block 1 (x) (y) (z)
say ((x) + ((y) + (z)))
my block 2 (x) (y) (4)
define my block 2 (x) (y) (z)
say ((x) + ((y) + (z)))

Not yet a Knight of the Mu Calculus.
MegaApuTurkUltra
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

Jonathan50 wrote:

NickyNouse wrote:

Forever and repeat () would both be out, the only thing you technically need is repeat until
the subtract block is gone, you can do ((x)+((-1) * (x)))
likewise, a good portion of the functions in the ([ v] of ()) operator block can be achieved with if-else and a lot of basic arithmetic blocks
custom blocks are probably out, everything you can do with a custom block can be achieved with a broadcast one way or another
Can't custom blocks take variables out?
set [x v] to [1]
set [y v] to [2]
set [z v] to [3]
say ((x) + ((y) + (z)))
becomes
my block (1) (2) (3)
define my block (x) (y) (z)
say ((x) + ((y) + (z)))
Mutation shouldn't be necessary, but it's doable with no extra blocks:
set [x v] to [1]
set [y v] to [2]
set [z v] to [3]
say ((x) + ((y) + (z)))
set [z v] to [4]
say ((x) + ((y) + (z)))
becomes
my block 1 (1) (2) (3)
define my block 1 (x) (y) (z)
say ((x) + ((y) + (z)))
my block 2 (x) (y) (4)
define my block 2 (x) (y) (z)
say ((x) + ((y) + (z)))
1. @NickyNouse: custom blocks can run in the same frame, broadcasts cannot. That's why custom blocks need to be kept
2. @Jonathan50: we need variables for long term storage though. Like, you set something and come back to it later. You can't just use a custom block with a forever loop or something; that would break, especially with stop [other scripts in sprite v]

Last edited by MegaApuTurkUltra (April 27, 2016 00:49:44)


$(".box-head")[0].textContent = "committing AT crimes since $whenever"
NickyNouse
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

Jonathan50 wrote:

Can't custom blocks take variables out?
Ah yes, the old pass-everything paradigm. I can see that falling apart if you ever need multiple scripts or sprites to access the same variable at the same time.
MegaApuTurkUltra
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

I took out () - ()

The rationale behind keeping * and / is precision. Unless someone wants to implement IEEE-compatible float procedures in Scratch, * and / are staying

I'm also keeping clones because I'm not sure how you'd recreate the whole copies of sprite-only variables thing without them.

Last edited by MegaApuTurkUltra (April 27, 2016 00:58:13)


$(".box-head")[0].textContent = "committing AT crimes since $whenever"
Jonathan50
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

NickyNouse wrote:

Jonathan50 wrote:

Can't custom blocks take variables out?
Ah yes, the old pass-everything paradigm. I can see that falling apart if you ever need multiple scripts or sprites to access the same variable at the same time.

MegaApuTurkUltra wrote:

I took out () - ()

The rationale behind keeping * and / is precision. Unless someone wants to implement IEEE-compatible float procedures in Scratch, * and / are staying
I thought the aim was Turing-equivalence, not Scratch-equivalence (i.e. able to do everything Scratch can do, including say/think/costumes/backdrops/sounds).

Implementing a new threading system from scratch is possible in any Turing-equivalent language though.

Not yet a Knight of the Mu Calculus.
Jonathan50
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

MegaApuTurkUltra wrote:

2. @Jonathan50: we need variables for long term storage though. Like, you set something and come back to it later. You can't just use a custom block with a forever loop or something; that would break, especially with stop [other scripts in sprite v]
If you're concerned about multiple threads, you could make your own threading system…
I don't see the problem with a forever block though.

Not yet a Knight of the Mu Calculus.
Jonathan50
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

Jonathan50 wrote:

MegaApuTurkUltra wrote:

2. @Jonathan50: we need variables for long term storage though. Like, you set something and come back to it later. You can't just use a custom block with a forever loop or something; that would break, especially with stop [other scripts in sprite v]
If you're concerned about multiple threads, you could make your own threading system…
I don't see the problem with a forever block though.
Oh, if you want to count up, like
define forever say (s)
set [i v] to [1]
repeat until <[0] = [1]>
say (join (i) (join [: ] (s)))
change [i v] by (1)
end
Just translate it to recursion:
define forever say (s)
forever say helper (s) [1]
define forever say helper (s) (i)
say (join (i) (join [: ] (s)))
forever say helper (s) ((i) + (1))

Not yet a Knight of the Mu Calculus.
Jonathan50
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

Actually, custom blocks take both variables and all loops out.

Repeat until is unnecessary:
repeat until <condition>
say [hi] for (2) secs
end
becomes
custom block <condition>
define custom block (bool)
if (bool) then // using if/then/else instead of not
else
say [hi] for (2) secs
custom block <condition>
end

Repeat too:
repeat (10)
say [hi] for (2) secs
end
becomes
custom block (10)
define custom block (n)
if <(n) > [0]>
say [hi]
custom block ((n) + (-1)) // that's equal to n - 1
end

Last edited by Jonathan50 (April 27, 2016 01:15:27)


Not yet a Knight of the Mu Calculus.
PullJosh
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

MegaApuTurkUltra wrote:

I'm also keeping clones because I'm not sure how you'd recreate the whole copies of sprite-only variables thing without them.
You can do it with lists. (I've done it before.)
DrKat123
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

we can workaround the multiplication and division block


i'm just too lazy to do it

Moving from Scratch? Don't learn C or Java, try Snap!
it haz OOP
DrKat McKatFace
First of all I'm 100% human and humans does not have a cat face
and second, the Boaty McBoatFace/Parsey McParseFace madness has just begun

λ
Sharp, my new Scratch mod
Is my post/siggy worthy for an internet?
MegaApuTurkUltra
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

Jonathan50 wrote:

I thought the aim was Turing-equivalence, not Scratch-equivalence (i.e. able to do everything Scratch can do, including say/think/costumes/backdrops/sounds).

scratchisthebest wrote:

how many blocks could be removed before Scratch becomes unusable, not Turing-complete, or impossible to recreate certain projects with it?

If you want to create a separate set of minimal blocks for just Turing completeness parallel to my set for Scratch completeness, go ahead though.

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
MegaApuTurkUltra
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

PullJosh wrote:

MegaApuTurkUltra wrote:

I'm also keeping clones because I'm not sure how you'd recreate the whole copies of sprite-only variables thing without them.
You can do it with lists. (I've done it before.)
Ok, took clones out

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
Tymewalk
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

Jonathan50 wrote:

Tymewalk wrote:

Here's my list:

forever - repeat (99999999999999999...)
go to x:() y:() - set x to (), set y to ()
move () steps - lot of code I can't post here but definitely possible
change [v] by () - set [v] to (thing) + ()
() * () - use () + () repeatedly
if then else:
set [else v] to [0]
if <thing> then
set [else v] to [1]
end
if <(else :: variables) = [0]> then
...
end

Probably a bunch more, too. Interesting…
Repeat (99999999999999999) would end sometime. You need
repeat until <[1] = [0]>

end
In that case ditch forever and repeat.
repeat until <(counter) = [5]>
...
change [counter v] by (1)
end

bold thing - italic thing - underlined thing - strikethrough thing
Jonathan50
Scratcher
1000+ posts

Fewest amount of blocks technically needed to use Scratch

Take out variables and all loops…?

Not yet a Knight of the Mu Calculus.

Powered by DjangoBB