You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
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;
|
|
}
|
|
} |