Really the only way of doing it is loop through each cell and check if it in all directions. Of course a marginal optimisation would be to mark the ones checked so it won't do the same cell twice. That said connect 4 has so few cells in it I think you'd be hard pressed to call this a bottleneck.