|
|
|
@ -12,13 +12,33 @@ namespace Models.Rules
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in cells)
|
|
|
|
|
{
|
|
|
|
|
if(playerChoice.X == item.X +1 || playerChoice.X == item.X - 1
|
|
|
|
|
|| playerChoice.Y == item.Y +1 || playerChoice.Y == item.Y -1 )
|
|
|
|
|
if(playerChoice.Pos.X == item.Pos.X +1 || playerChoice.Pos.X == item.Pos.X - 1
|
|
|
|
|
|| playerChoice.Pos.Y == item.Pos.Y +1 || playerChoice.Pos.Y == item.Pos.Y -1 )
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsCellEmpty(Cell playerChoice)
|
|
|
|
|
{
|
|
|
|
|
if (playerChoice.Value == null)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsCellValid(Cell playerChoice, List<Cell> cells)
|
|
|
|
|
{
|
|
|
|
|
if (NearCell(playerChoice, cells) && IsCellEmpty(playerChoice))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|