Hello!
I’m making a version of Connect-4. You need to have 4 tiles that are in a line. This line can be diagonal, horizontal or vertical.
I’ve represented this as a 6x7 (6 rows, 7 columns) 2d array.
For checking if a line has been made horizontally or vertically, it’s relatively straightforward. You simply add a column or row count that contains the number of tiles on that line.
However, for the diagonal count, it gets much harder. Does anyone know a way to do this?