I am working with a 2-D array of nullable booleans bool?[,]
. I am trying to write a method that will cycle through its elements 1 at a time starting at the top, and for each index that is null, it will return the index.
Here is what I have so far:
public ITicTacToe.Point Turn(bool player, ITicTacToe.T3Board game)
{
foreach (bool? b in grid)
{
if (b.HasValue == false)
{
}
if (b.Value == null)
{
}
}
return new Point();
}
I want to be able to set the object to true/false
depending on the bool passed in. Point
is just a class with an x,y
.
What's a great way to write this method?