|
|
|
@ -29,26 +29,7 @@ namespace Models.Rules
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public bool IsCellAdjacent(Cell choosenCell, Cell targetCell)
|
|
|
|
|
//{
|
|
|
|
|
// if (Math.Abs(choosenCell.X - targetCell.X) > 1 || Math.Abs(choosenCell.Y - targetCell.Y) > 1)
|
|
|
|
|
// return false;
|
|
|
|
|
// if (Math.Abs(choosenCell.X - targetCell.X) > 1 && Math.Abs(choosenCell.Y - targetCell.Y) > 1)
|
|
|
|
|
// return false;
|
|
|
|
|
// if (choosenCell.X == 0 && targetCell.X == 4)
|
|
|
|
|
// return false;
|
|
|
|
|
// if (choosenCell.Y == 0 && targetCell.Y == 4)
|
|
|
|
|
// return false;
|
|
|
|
|
// if (choosenCell.X == 4 && targetCell.X == 0)
|
|
|
|
|
// return false;
|
|
|
|
|
// if (choosenCell.Y == 4 && targetCell.Y == 0)
|
|
|
|
|
// return false;
|
|
|
|
|
// if (choosenCell.X == targetCell.X && choosenCell.Y == targetCell.Y)
|
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
|
|
// return true;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsCellAdjacent(Cell choosenCell, Cell targetCell)
|
|
|
|
|
{
|
|
|
|
@ -85,24 +66,6 @@ namespace Models.Rules
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//public bool NearCellIsValid(Cell choosenCell, List<Cell> cells)
|
|
|
|
|
//{
|
|
|
|
|
// if (choosenCell == null || cells == null) return false;
|
|
|
|
|
|
|
|
|
|
// IEnumerable<Cell> PlayedCellsQuery =
|
|
|
|
|
// from cell in cells
|
|
|
|
|
// where cell.Value != null
|
|
|
|
|
// select cell;
|
|
|
|
|
|
|
|
|
|
// foreach (var cell in PlayedCellsQuery)
|
|
|
|
|
// {
|
|
|
|
|
// if(!IsCellAdjacent(choosenCell, cell)) continue;
|
|
|
|
|
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// return false;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public bool NearCellIsValid(Cell choosenCell, List<Cell> cells)
|
|
|
|
|
{
|
|
|
|
@ -145,8 +108,6 @@ namespace Models.Rules
|
|
|
|
|
{
|
|
|
|
|
NewZoneIsCreated(chosenCell, cells, map);
|
|
|
|
|
}
|
|
|
|
|
//return true; // Il y a une cellule adjacente avec la même valeur donc une zone est créée si elle n'est pas déjà existante
|
|
|
|
|
// Si il return true, tout c'est bien passer
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|