i'm coding a script which is able to player "four in a row" against a human player
it's working quite well but i'm looking for an efficient way to detect quandaries of my own
the board itself is stored in a two-dimensional array for columns and rows
little example:
( ? = field may be mine, the opponent's or even blank
x = my field,
o = opponent's field
empty field)
? ? x _
? x ? x
x ? ? x
? ? ? x
for example is a quandary since the opponent has to insert his stone into column #4
? ? x o
? x ? x
x ? ? x
? ? ? x
and now i win
? ? ? x
? ? x o
? x ? x
x ? ? x
? ? ? x
but if the board looks like
? ? ? _ x
? ? ? _ ?
? ? x _ ?
? x ? x ?
? ? ? x ?
? ? ? x ?
it's the very same quandary as before simply the diagonale is moved a little bit
how do i detect these possible quandrays most efficient?
tia