|
|
@ -7,7 +7,10 @@ using Models.Game;
|
|
|
|
using Models.Interfaces;
|
|
|
|
using Models.Interfaces;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Models.Rules
|
|
|
|
namespace Models.Rules
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// The Rules class contains all the rules of the game. It is used to check if a move is valid or not.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public class Rules : IRules
|
|
|
|
public class Rules : IRules
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -47,23 +50,23 @@ namespace Models.Rules
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsInRopePaths (Cell adjacente,List<List<Cell>> ropePaths,int index)
|
|
|
|
public bool IsInRopePaths (Cell adjacente,List<List<Cell>> ropePaths,int index)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (List<Cell> path in ropePaths)
|
|
|
|
foreach (List<Cell> path in ropePaths)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (path.Contains(adjacente))
|
|
|
|
if (path.Contains(adjacente))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
index=ropePaths.IndexOf(path);
|
|
|
|
index=ropePaths.IndexOf(path);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool AsValue (Cell choosenCell, List<List<Cell>> ropePaths,int index)
|
|
|
|
public bool AsValue (Cell choosenCell, List<List<Cell>> ropePaths,int index)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var item in ropePaths[index])
|
|
|
|
foreach (var item in ropePaths[index])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (choosenCell.Value == item.Value) return true;
|
|
|
|
if (choosenCell.Value == item.Value) return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|