math - Is there a mathematical formula to determine how many diagonal sequences are there in a Tic-Tac-Toe game? C# -
i'm building tic-tac-toe game project c#. teacher asked me create array while size max number of diagonal sequences possible in specific board size (not 3x3). problem now, teacher gave me wrong formula , won't calculate right. example, in 3x3 board, there should 2 possible diagonal sequences, formula calculates 1.
this formula: (rows-sequence+1)*(cols-sequence+1).
which means: (3-3+1)*(3-3+1) = 1
if knows correct formula, i'll grateful!
think this. how many ways there place seq * seq
square within row * col
rectangle. teacher gave answer. there 2 diagonals in square, number of call diagonals in row * col
matrix 2 times value teachers function.
Comments
Post a Comment