How to Compare arrays In a bingo style.

Hey there,

Im looking into a system that works similar I guess to bingo.

I have 2 arrays.

One, I have an array with chosen numbers/items etc.

And second, a slowly growing array of numbers/items.

I want to be able to trigger an event based on when the growing array has all the items that the first array needs to trigger.

Hopefully this makes sense.

Ill update with a picture In second.

Thanks for reading.

You can compare arrays with the = operator. So when they’re equal, trigger your event :slight_smile:

1 Like

Assumable it’s as simple maybe writing a single string with commas?

The problem will be they won’t be exactly equal. The growing array might have significantly more entries than chosen numbers. also, the order in which they appear will be very jumbled.

Would that matter?

Also thank you for an unbelievably fast reply, lol. I didn’t even get the image uploaded in time Xd

Then you need to run a loop over the ‘answer’ array, and check all the entries are in the growing array :slight_smile:

Are repetitions allowed? As in, can you have [2,3,3,4,4]? Do we care about having repetitions?

1 Like

All the entries are added uniquely from a data table, So although the order is randomly entered into the array depending on how you unlock stuff., there shouldn’t be any repetitions in the array.

“Check Array” requires this to pass, (Red,Blue,Green)

“Growing Array” filling up depending on unlocks (Brown,Red,Blue,Purple,Yellow,Green,etc)

Once the Growing array collects all the colours it needs to pass the check array it triggers.

Hopefully It makes sense. I cant find anything online for bingo tutorials or multi check arrays type things.

Try a Set:

image

This would BINGO! because Chosen Elements contains everything that’s inside the Growing.


“Check Array” requires this to pass, (Red,Blue,Green)

“Growing Array” filling up depending on unlocks (Brown,Red,Blue,Purple,Yellow,Green,etc)

You could probably do it with bitmasks, too:

But it might be an overkill for this.


None of the suggestions require arrays or iteration - it’s really efficient.

1 Like

Wow, I’ve 100% Got some reading to do, lol. That’s Fascinating, thank you.

I’ve been messing around with sets, which seems to be what I’m after. I can get it to trigger every time as long as they are ordered correctly inside the sets.

I created a forced environment to test it.

As soon as I shuffle or randomize the growing set. It comes back false, claiming the final entry doesn’t exist, even though absolutely nothing has changed other than shuffling the order.

Really bizarre

Sets do not have order. You do not need an array. Just add to set. Since no dupes are allowed, there’s no need for Add Unique or the like.

image

image

Should still bingo.


Wow, I’ve 100% Got some reading to do, lol.

People say that because they do not realise sets:

image

hq720

Are just forgotten kindergarten territory mental gymnastics, dismissed since we’ve been busy adulting for the last 30 or so years…


@ClockworkOcean along with Pythagoras the Ancient, yet another handy thing to Google up shamelessly :rofl:

2 Likes

OK, this is super handy, I’m saving all this.

It worked flawlessly and isn’t throwing any weirdness, Classic Life stuff, I had to dip to a job immediately as it started working xD, Always the way.

Thank you again for not only solving the issue but teaching me some new things and leaving me with research to do on my own to further understand unreal.

It’s incredibly generous, Hopefully I make something you’d want to play in the future :joy:

1 Like

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