Reporting the calculation of two matching slots in a list

For a helper reporter block, how can you match lists together and it only reports the slot of which it matches? (i.e., you input say 3456 in one slot and the second slot is 3476. The gray reporter you created would report "1,2,4", as those are the only slots matching.)
I feel as though I'm overthinking it, but it's a pretty rough roadblock, since using lists complicates this for me a bit, as the reporter block either doesn't report, has a value of zero, or reports true/false when I wanted the numbered slots.
2021-09-29 (3)
This is an example of what I'm trying to accomplish.

Is this part of an assignment?

Here is a walk through of what we can do:

Using this script:
[scratchblocks]
(matching slots ((1::variables)::list)((2::variables)::list)::list)::hat control
warp{
script variables ((letter #)::grey)((result)::grey)::grey
set [result v] to (list @addInput::list)
set [letter # v] to [1]
for each ((item)::list) in (split (1::variables) by [letter v]::operators){
if <(letter (letter #) of (2::variables)) = (item)> then{
add (letter #) to (result)
}::control
change (letter #) by (1)
}::list
report (result)::control cap
}::grey
[/scratchblocks]

Source Code
[scratchblocks]
(matching slots ((1::variables)::list)((2::variables)::list)::list)::hat control
warp{
script variables ((letter #)::grey)((result)::grey)::grey
set [result v] to (list @</a>addInput::list)
set [letter # v] to [1]
for each ((item)::list) in (split (1::variables) by [letter v]::operators){
if <(letter (letter #) of (2::variables)) = (item)> then{
add (letter #) to (result)
}::control
change (letter #) by (1)
}::list
report (result)::control cap
}::grey
[/scratchblocks]

We can get the answer. But how does this work?

First we have the warp block, to speed things up.
Then we create temporary script variables to use later on.
Then we set the result variable to a list, so we can add items to it later on.
Then we set the letter number to 1.
Now in each item in the which contains the first slot split up by letter. So 1234 would now be 1, 2, 3, 4.
Now for each item, we check it the letter of slot 2 is equal to the letter # in slot 1.
If true, we add the ID of that letter into the result list.
Then to move on, we change the letter # variable by 1.
Then after that, we report the result!

Yes, however the only thing roadblocking me is this helper block. Everything else is fairly simple.

I just don't know if I need to tackle this with a "for item" or "for I" loop block, since the helper block has to read a list, but the input/output are text (as you can see on the example). And if that's the case, how do I get the report part of the reporter block to report a slot value instead of boolean true/false? Do I add a new variable for every slot? I feel that wastes time.

There is a slot index option of map
untitled script pic (89)
combined with a proper conditional reporter you can get an index or 0 if not matched.
Then
untitled script pic (88)

Without separator? So the simplest form of join is sufficient.

Are you implementing Mastermind? If so, you're definitely overthinking it; you don't need to know the slot numbers, but only how many there are. You can find that out with a KEEP.

here's what I came up with



may not be the best way though,

matchingSlots script pic
matchingSlots script pic (1)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.