Discuss Scratch

_nix
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

but there's also CHANGE CRAYON BY (very slow at the moment because libraries can't yet make global variables, and so it has to figure out what your current crayon number is)
Sorry to respond to this and not the actual point of your post

I think you could use a block variable as a “cache” for the colors variable in this case? It's not really good because every time you drag out a new block, it gets its own cache (which could end up taking alot of memory), but would maybe make code run a bit faster.

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20 21, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
PullJosh
Scratcher
1000+ posts

Snap! user discussion

Your color choices are great! You even managed to nail the browns, which is quite the feat. It would awesome if we could see the colors visually inside the crayon block dropdown, but I imagine that would require a fairly significant update to Snap.

Also, just for fun, here's a quick project to demo the entire palette.
bharvey
Scratcher
1000+ posts

Snap! user discussion

_nix wrote:

I think you could use a block variable as a “cache” for the colors variable in this case? It's not really good because every time you drag out a new block, it gets its own cache (which could end up taking alot of memory), but would maybe make code run a bit faster.
Yeah, I thought about that, but it turns out the really slow part is finding out what crayon you're using now (partly because I actually solve a harder problem, finding the nearest crayon to any RGB color, and partly because I do it with higher order functions – a combine of a map of a combine of a map) and it'd be risky to use a block variable for that. But I'll experiment.

PullJosh wrote:

You even managed to nail the browns, which is quite the feat.
Thanks! Yeah, it's really unfair that brown and orange (which are the same hue) (my favorite color) get this tiny sliver of hue space, while (yucky, except for forest) green gets half the space.

While researching colors, I learned from Wikipedia that in RGB you can't actually create full spectral violet, not because they couldn't have made it work, but because of an engineering decision that it would use too much energy! I mean, of course I've known since forever that E=hν, but I never connected that with display engineering; in the big picture, the whole visible spectrum is a tiny sliver, and a low-frequency one at that.

(It turns out that Scratch doesn't like math-nu, although it's happy with regular-Greek-nu. )

Colored menus are on my wish list… When things slow down…

Last edited by bharvey (Jan. 16, 2018 18:06:12)


_nix
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

It turns out the really slow part is finding out what crayon you're using now (partly because I actually solve a harder problem, finding the nearest crayon to any RGB color, and partly because I do it with higher order functions – a combine of a map of a combine of a map) and it'd be risky to use a block variable for that. But I'll experiment.
A block variable which is a mapping from every RGB value to its crayon. That won't take up a lot of memory!

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20 21, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
bharvey
Scratcher
1000+ posts

Snap! user discussion

_nix wrote:

A block variable which is a mapping from every RGB value to its crayon.
Nah, I should not be proud and use a REPEAT loop.

bharvey
Scratcher
1000+ posts

Snap! user discussion

Okay, I changed from this:

to this:

You can try it out at http://snap.berkeley.edu/crayons2.xml.

So I had to add six variables (COLORS was there before and has the big list of 100 colors) and lost the elegance of higher order functions (although the really depressing thing is that in a case like this I'm not sure anyone will be convinced the HOF version is more elegant – but honest, that's the way I think, and it's extra effort for me to turn it into a loop). The result is that if the current color is exactly a crayon, and the crayon has a low number (grayscale or red, for example), then it's a little faster. If the color is blue or violet, it's still really slow. (Yeah, yeah, it's slower because it takes more energy. Hahaha.)

I dunno, maybe if I wrote it like this:

everyone would see how elegant it is. (The CALL block is just because we don't (yet) have internal block definitions, so I had to make it a local variable instead.)

Or maybe I'm just weird and the whole premise of BJC (namely, that normal teenagers can learn to love HOFs and recursion) is wrong.

bharvey
Scratcher
1000+ posts

Snap! user discussion

Oops I broke it… crayons2.xml is now fixed.

theLman
Scratcher
81 posts

Snap! user discussion

bharvey wrote:

Or maybe I'm just weird and the whole premise of BJC (namely, that normal teenagers can learn to love HOFs and recursion) is wrong.

I think a lot of the time with these things there may seem to be no immediate impact, but the seed has been planted.
PullJosh
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

Or maybe I'm just weird and the whole premise of BJC (namely, that normal teenagers can learn to love HOFs and recursion) is wrong.
Recursion is exciting once you know how it works. And it's easy enough to learn, as long as you're excited about it.

Last edited by PullJosh (Jan. 18, 2018 18:41:25)

bharvey
Scratcher
1000+ posts

Snap! user discussion

theLman wrote:

I think a lot of the time with these things there may seem to be no immediate impact, but the seed has been planted.
Oh yes, that's true even with college students – I keep getting emails along the lines of “I hated SICP when I was a student but now I use those ideas every day in my work.”

bharvey
Scratcher
1000+ posts

Snap! user discussion

PullJosh wrote:

Recursion is exciting once you know how it works. And it's easy enough to learn, as long as you're excited about it.
Haha. But, you lot don't count; you're not regular kids. (Not to be confused with regular expressions.)

PullJosh
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

PullJosh wrote:

Recursion is exciting once you know how it works. And it's easy enough to learn, as long as you're excited about it.
Haha. But, you lot don't count; you're not regular kids. (Not to be confused with regular expressions.)
1. Incredibly particular.
2. Difficult to understand.
3. People who know me like me, but those who don't are left confused.

The results are in: I may in fact be a regular expression.
BookOwl
Scratcher
1000+ posts

Snap! user discussion

PullJosh wrote:

bharvey wrote:

PullJosh wrote:

Recursion is exciting once you know how it works. And it's easy enough to learn, as long as you're excited about it.
Haha. But, you lot don't count; you're not regular kids. (Not to be confused with regular expressions.)
1. Incredibly particular.
2. Difficult to understand.
3. People who know me like me, but those who don't are left confused.

The results are in: I may in fact be a regular expression.
Your brain is too powerful for you to be a regular expression.
You might be a Turing Machine though.

Last edited by BookOwl (Jan. 18, 2018 22:24:54)


who needs signatures
bharvey
Scratcher
1000+ posts

Snap! user discussion


blob8108
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

I think that’s the shortest message I’ve ever seen Brian write.

I also think that y’all have forgotten which thread you’re on…

tosh · slowly becoming a grown-up adult and very confused about it
BookOwl
Scratcher
1000+ posts

Snap! user discussion

blob8108 wrote:

bharvey wrote:

I think that’s the shortest message I’ve ever seen Brian write.

I also think that y’all have forgotten which thread you’re on…
Brian started it.

who needs signatures
scratchmouse
Scratcher
70 posts

Snap! user discussion

Brian, maybe in order for everyone to see the elegance of your solution, all that is needed is just a more elegant visualization of the old solution without changing the code at all.

bharvey wrote:

Okay, I changed (snip snip)
A more visually elegant one, more horizontal-ish, that will reflect the solution's inner beauty on the outside. Here it is.

If you can't zoom in the images in forum posts, here's the link to the image that is zoomable hopefully.

The word order in the “combine with () items of ()” seemed unnatural (as in natural language) to my ears so I reversed it in the second one, but it was not as elegant as it was after the first cosmetic change :


So, probably, the second change in visualization is not something that we would necessary (it's the first time, that I succeeded to use “necessary” in such, fashionable way, that I noticed on TV lately, but didn't use it until now; so I'm so proud of this linguistic accomplishment :-P ) want. (And the link to the zoomable image.)

The first one, however, might be. What do you think?

Last edited by scratchmouse (Jan. 19, 2018 15:12:07)


˙˙˙ ˙˙ ˙Ignore˙ ˙˙ ˙˙˙

… .. ˇˇˇ ˇˇˇ ˇˇˇ ˇˇˇ .. …
::: :: … ˇˇˇ ˇˇˇ … :: :::
bharvey
Scratcher
1000+ posts

Snap! user discussion

scratchmouse wrote:

A more visually elegant one, more horizontal-ish, that will reflect the solution's inner beauty on the outside.
I think the practical difficulties of reading something that doesn't fit on the screen without scrolling would outweigh the elegance of its horizontality.

But looking at the code again, what would really make it more elegant is to use the variadicness of the list input of this version of map:


I don't know how I missed that, first time around.

mikep345678
New to Scratch
17 posts

Snap! user discussion

Are others seeing Miosoft connection errors ("could not connect to https://snap.apps.miosoft.com/SnapCloudPublic") when trying to sign in to SNAP or even open a shared project without signing on?

I haven't been able to connect, via several different machines/OSs/browsers/networks/accounts, over the last few days. I've tried from my (filtered) work network, my open home network, and my via my mobile data. I've used Chrome and FireFox on Mac, Windows and Linux machines via regular and incognito/private windows. I've cleared cookies per other threads, but the symptoms are still evident.


Thank you,
Mike
bharvey
Scratcher
1000+ posts

Snap! user discussion

mikep345678 wrote:

Are others seeing Miosoft connection errors ("could not connect to https://snap.apps.miosoft.com/SnapCloudPublic") when trying to sign in to SNAP or even open a shared project without signing on?
Yes, I didn't realize this is a days-long problem but we've had bunches of reports today. Our cloud provider says they're being flooded with requests and are investigating – I don't know if that's because of a bug, a DOS attack, or something else. I'm really sorry for the trouble this is causing everyone. Stay tuned.

Powered by DjangoBB