Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Fewest amount of blocks technically needed to use 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
No me! So who's making the compiler that recreates your project using as few unique blocks as possible?
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
Maybe after I finish So who's making the compiler that recreates your project using as few unique blocks as possible? 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
Repeat (99999999999999999) would end sometime. You need 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 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
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
1. removed. () of () works on yourselfVariables? In that case(x position)
(y position)
(direction)
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)
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
Can't custom blocks take variables out? 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
set [x v] to [1]becomes
set [y v] to [2]
set [z v] to [3]
say ((x) + ((y) + (z)))
my block (1) (2) (3)Mutation shouldn't be necessary, but it's doable with no extra blocks:
define my block (x) (y) (z)
say ((x) + ((y) + (z)))
set [x v] to [1]becomes
set [y v] to [2]
set [z v] to [3]
say ((x) + ((y) + (z)))
set [z v] to [4]
say ((x) + ((y) + (z)))
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
1. @NickyNouse: custom blocks can run in the same frame, broadcasts cannot. That's why custom blocks need to be keptCan't custom blocks take variables out? 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 anotherset [x v] to [1]becomes
set [y v] to [2]
set [z v] to [3]
say ((x) + ((y) + (z)))my block (1) (2) (3)Mutation shouldn't be necessary, but it's doable with no extra blocks:
define my block (x) (y) (z)
say ((x) + ((y) + (z)))set [x v] to [1]becomes
set [y v] to [2]
set [z v] to [3]
say ((x) + ((y) + (z)))
set [z v] to [4]
say ((x) + ((y) + (z)))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)))
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
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. Can't custom blocks take variables out?
- 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.
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
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. Can't custom blocks take variables out?
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). I took out () - ()
The rationale behind keeping * and / is precision. Unless someone wants to implement IEEE-compatible float procedures in Scratch, * and / are staying
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
If you're concerned about multiple threads, you could make your own threading system… 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]
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
Oh, if you want to count up, likeIf you're concerned about multiple threads, you could make your own threading system… 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]
I don't see the problem with a forever block though.
define forever say (s)Just translate it to recursion:
set [i v] to [1]
repeat until <[0] = [1]>
say (join (i) (join [: ] (s)))
change [i v] by (1)
end
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 too:
Repeat until is unnecessary:
repeat until <condition>becomes
say [hi] for (2) secs
end
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)becomes
say [hi] for (2) secs
end
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
You can do it with lists. (I've done it before.) I'm also keeping clones because I'm not sure how you'd recreate the whole copies of sprite-only variables thing without them.
- 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
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
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).
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. how many blocks could be removed before Scratch becomes unusable, not Turing-complete, or
$(".box-head")[0].textContent = "committing AT crimes since $whenever"
- MegaApuTurkUltra
- Scratcher
1000+ posts
Fewest amount of blocks technically needed to use Scratch
Ok, took clones outYou can do it with lists. (I've done it before.) I'm also keeping clones because I'm not sure how you'd recreate the whole copies of sprite-only variables thing without them.
$(".box-head")[0].textContent = "committing AT crimes since $whenever"
- Tymewalk
- Scratcher
1000+ posts
Fewest amount of blocks technically needed to use Scratch
In that case ditch forever and repeat.Repeat (99999999999999999) would end sometime. You need 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 until <[1] = [0]>
end
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.
- Discussion Forums
- » Advanced Topics
- » Fewest amount of blocks technically needed to use Scratch