Z
Z
Zimaell2020-12-29 11:37:56
Unity
Zimaell, 2020-12-29 11:37:56

How to correctly check the possible combinations of the game 3 in a row?

I did a check for possible combinations, but it's too cumbersome, namely, I check like this - first I check if there are possible cells with prefabs on the right +1 +2 + 3, if there are, then I check the values ​​​​of the cells 0 +2 +3, that is, that if the cell is moved to the right, if all these cells have the same values ​​(that is, the same colors, for example), then plus the combination, then I check the same if the same to the right, but the cells are to the right and above, to the right and below, well, to the left, then the same manipulations if there is a shift up, down, left, this is all checked for each cell after the appearance of new colors (that is, after which colors have matched and been destroyed) ...
I understand that this scheme is extremely cumbersome, inconvenient, and generally looks quite crazy, though and working...
Can you tell me how to check this kind of combinations?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2020-12-29
@Zimaell

Well, firstly - get away from prefabs and store the model separately.
Secondly - the most banal - to check with patterns. A typical task is to find if there is a pattern in an array.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question