I bet that in some class you have played this with a classmate. Complete lines of 5 balls before your adversary does so, you can do it in diagonal too.