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.
Trek-12/source/Trek-12/Models/Rules/Rules.cs

52 lines
1.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models.Game;
using Models.Interfaces;
namespace Models.Rules
{
public class Rules : IRules
{
public bool IsCellAdjacent(Cell choosenCell, Cell targetCell)
{
if (Math.Abs(choosenCell.X - targetCell.X) > 1 || Math.Abs(choosenCell.Y - targetCell.Y) > 1)
return false;
return true;
}
public bool ropePathCellIsValid (Cell choosenCell, Cell targetCell)
{
if (Math.Abs(choosenCell.Value - targetCell.Value )
}
public bool NearCellIsValid(Cell choosenCell, List<Cell> cells)
{
if (choosenCell == 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;
}
}
public bool IsZone(Cell choosen, List<Cell> cells,List<List<Cell>> zones)
{
IEnumerable<Cell> PlayedCellsQuery =
from cell in cells
where cell.Value != null
select cell;
}
}
}