5 object collide each other?


i have two type of box one is red color one is blue color and i have a table where i throw the boxs. first chance for player that is red color and then Second played blue color and there are 64 positions on table where user can place the boxes turn by turn now whenever five same color boxes set or place in horizontal vertical diagonal that player win the game so please any one tell me which logic i can use this

Please check the attach image

Similar to a 3x3 tic tac toe game.

I think you need to forget about collisions and work with the grid positions(matrix, array).
Once a player insert a new box, you have to check immediately for a win condition: vertical, horizontal, diagonal and anti Diagonal.

Vertical: You can use 2 cursors, both starting at the position you inserted the box. 1 going up, 1 going down. You “increment” the cursors while there is a box with the same color at the position the cursor is going to. As soon as you find a difference of 5(or count 5) between the 2 cursors, that player won the game.
PS: you skip the Vertical test when the 2 cursors can not “move” anymore. Be careful with infinite loops.

Test the horizontal and diagonals in the same way.