Can I reference a Sprite's number or name?

I would like to be able to reference the name of Sprites. I am trying to make a 5x4 pentomino display that uses the text files from this site -
https://isomerdesign.com/Pentomino/
https://isomerdesign.com/Pentomino/5x4/index.html
https://isomerdesign.com/Pentomino/5x4/solutions.txt

I mean yeah it kind of works but hand typing in the number of each list element is tedious.

Perhaps I need to be using a better method of iterating through the list?

https://snap.berkeley.edu/project?username=edvogel56&projectname=Pentomino5x4

Thanks!

You can use
untitled script pic (8)
or
untitled script pic (7)
to see the sprite's name. This should help you.

please share your project.

is now shared.

Thanks

Ok two things, first don’t do this


Instead do this
image

Etc.
But what you should actually do is add another column in the pentomino list that says the costume name you want to change this to and then use switch to costume (item (4) of (item)) in the for loop.

Thanks!

I think I am going to try this instead - create a new csv file and replace all of the pentomino letters with the costume names. Another way to go would be go back in time and start with costume names that are the pentomino letters..

Thanks again.

Thanks again for all the help above with
https://snap.berkeley.edu/project?username=edvogel56&projectname=Pentomino5x4Solver1

I am now able to bring in solution files for 5x4 pentomino puzzles from Pentomino configurations and solutions

What I would like to do next is

  1. read in a file of a "manually solved" 5x4 shown as the variable Solution1 on my project stage. Rows 7-11, Cols B-E
  2. change the letter pentomino representations to the tile names
  3. write the tile names into Row2 Cols A-T

I am having difficulty understanding how to go about this. I can see that when I change Solution1 view to list view I get a list of 11 lists. The 11 lists now contain the row data of each row of my original Solutions1.csv.

I have not been able to figure out how to leverage this lovely and verbose data structure to do items 1,2,3 of "What I would like to do next is"

I have looked through the current manual and searched online for examples. Still stuck.
I loaded the Datascience library and watched some of Jens M.'s YouTube. I am interested in working closer to the fundamentals of how a beginner would learn to use lists.

Big picture - I am an after school STEM/Art educator and the kids like the puzzles and have experience programming in Scratch. I am trying to develop a a suite of mathematical activities ranging from building physical block puzzles to using computer applications like google sheets to view/record/understand data to writing programs in SNAP! to solve the puzzles.

I know it is rather a big ask to request step by step help to develop this using the SNAP! Forum.
Not finding the right talent fit on Upwork to do this. I can pay

who would ever do that


(I plan on switching to case/switch)

It’s been a while since we’ve seen edvogel56 — their last post was 3 years ago.

Wow, that's when I joined!

Anyways, I recommended using clones instead of individual sprites, but that's not what you asked for.

You could do

if <(item (((2) + (item (2 v) of (split((ask [Sprite1 v] for ((my [name V]) @addInput::gray ring) @addInput::control)) by [Sprite v])))) of (items)) = [F]> {
switch to costume [Buck Tile V]
} @addInput

Or even better

script variables (the item) set [the item V] to (item (((2) + (item (2 v) of (split((ask [Sprite1 v] for ((my [name V]) @addInput::gray ring) @addInput::control)) by [Sprite v])))) of (items)) if <(the item) = [F]> { switch to costume [Buck Tile V] } etc..

why not just use the set/get variables library, and set (if <(split (item (1) of (split (item (1) of (item)) by [ v]))by [letter v]) contains [/]> then (join input list: (all but first of (split (item (1) of (split (item (1) of (item)) by [ v]))by [letter v]))) else (item (1) of (split (item (1) of (item)) by [ v])))to <not <(split (item (1) of (split (item (1) of (item)) by [ v]))by [letter v])contains [/]>>

Hi - thanks I have it all sorted out now. I was trying to update the initial request. Thanks!

Hi — thanks, I have no clue what this does lmfao

Maybe it'll make more sense if I un-inline it.

script variables ((tag)) ((closing)) @delInput @addInput
set [tag V] to (item (1) of (split (item) by [  v]))
set [closing V] to <(item (1) of (split (tag) by [letter v])) = [/]>
if (closing) {
set [tag V] to (join input list: (all but first of (split (tag) by [letter v])))
}@addInput
set (tag) to <not (closing)>  //from the create variables library

((Hi))
script variables ((hi)) @addInput
Didn’t you already do that?

Just use 2 parentheses around the variable name.

script variables ((a)) @addInput
script variables ((a)) @addInput

You can learn more about snapblocks at https://snap-blocks.github.io/docs/syntax or How to write snapblocks

I thought so, but I wasn't sure.

(var) ((upvar)) (((upupvar))) ((((upupupvar)))) (((((upupupupvar)))))

:dog: moment

It's off-center :frowning_with_open_mouth:

(Will Snapblocks ever copy the formatting of actual Snap! blocks? I know that HTML5 canvas and CSS are different, but I'm wondering...)

Oh, it's not supposed to be off center (and I don't know why it is). I'll be fixing that in the next snapblocks update. I also noticed the issue when I wrote that reply, I just never said anything.