Index of multiple items

test encode script pic

untitled script pic 253

RIght, I was going to complain at @qw23 about making it inefficient by scanning the list n times, but it turns out @avi_shor's version does that too. So, avi_shor, qw23's right, learn to love MAP instead of using FOR loops, and, both of you, try to write it making only one pass through the (data) list. It took me a lot of messy debugging, and I finally came up with this disaster:


... but I'm sure you can do better.

honestly I usually code for like arduino so this is new to me. I didnt know about map

Well, that's why you're here! Higher order functions are a big part of what we offer. :~)

you seem to know a lot. wanna convert my google sheets code to snap

Thanks, but no thanks!

I feel like I should point out that he is one of the developers of Snap!.

ik

i can maybe

have fun

Simplicity counts, too.

I keep winning. The AI is messing up, because I always win.

lol. in connect 4 the first player automatically wins

Not what I meant.
I meant my strategy keeps working & I can make the AI stop by doing multiple spots in one turn.

your stratagy guaranties a win then. Playing a perfect game wins and also to the second statement the answer is simple - dont cheat

Well, even not cheating wins. Plus, you can place stuff in "mid-air", when that's not how actual "Connect 4" works.

placing mid air is cheating. and still in connect 4 if the first player knows what they are doing they automatically win

Well, why not make it so that your placement automatically moves down to the bottom?

I still don't know how to use map and I've been here for years O_O