@mathmaster74 as I mentioned, since events are stored in a hash, you are forced to loop the check for each block regardless of when you stop. Stopping earlier because you are not going to check a certain shape does not reduce complexity and, in the worst case scenario, it does not reduce the number of checks either (as the adjacent one could be the last block you check). I have already said this twice, but VX Ace does not store events in a multi-dimensional array, you cannot access events using their coordinates, you can only perform a linear check, and compare the coordinates of the event you found to the coordinates you need.
On a side note, a staircase shape is a shape that does not contain 3 boxes of the same color aligned in the same row, they are just adjacent, and that is why I mentioned continuing to check in a certain direction, without changing it. And theories about 7 blocks or more are not useful in this situation, we already know that the maximum amount of possible blocks of the same color is 6. And, btw, in your post, you mentioned an L shape made of 3 blocks, that is not exactly what the OP asked for, as there are not 3 blocks in a line. Anyway, since this is not relevant to the topic, I am going to stop it here, we have already cleared up any misunderstanding.
@Feraleth the implementation takes quite a long time to be written, on top of it, there are two different ways to implement it: one that uses less memory, while being slower; the other that uses more memory, while being faster. Without knowing which one you want to use, I cannot help you here. I am not going to write a code that might prove to be useless later.
That said, depending on how much memory your game uses, I would recommend using the fast implementation and use up a bit more memory. This implementation takes a bit more time to be initialized because it requires you to create a multi-dimensional array for the whole map to be able to access events in
T = O(1) based on their coordinates. Doing so means that you have to create a virtual copy of your map (like storing the map in your memory twice), but not doing it means using the default VX Ace way of handling events, resulting in a very ugly algorithm with a complexity of
T = O(N^2). There are not so many blocks in your puzzle, but 16 * 16 = 256, and 256 is not exactly a small number of checks. Not to mention that you have to check everything more than twice, which increases that to at least 768 checks.
However, if your game already uses a lot of memory, you might want to go for this ugly method. After all it only happens once when a block is moved, it does not happen continuously.