|
|
@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
namespace Models.Rules;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class Zones
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public bool IsZone(Cell playerChoice, List<Cell> cells)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var item in cells)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (playerChoice.Value == item.Value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsCheminDeCorde(Cell playerChoice, List<Cell> cells, List<Cell> cheminsDeCorde)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var item in cells)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (playerChoice.Value == item.Value+1 || playerChoice.Value == item.Value-1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var chemin in cheminsDeCorde)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (chemin.Equals(playerChoice))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return IsCheminDeCorde(item, cells, cheminsDeCorde);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|