Code Smells de Rules.cs
continuous-integration/drone/push Build is failing Details

pull/112/head
Rémi LAVERGNE 11 months ago
parent 8b54be4818
commit 0d3c541c4b

@ -103,7 +103,7 @@ namespace Models.Interfaces
/// <param name="ropePaths">The list of rope paths.</param> /// <param name="ropePaths">The list of rope paths.</param>
/// <param name="index">The index of the rope path.</param> /// <param name="index">The index of the rope path.</param>
/// <returns>True if the adjacent cell is in the rope path; otherwise false.</returns> /// <returns>True if the adjacent cell is in the rope path; otherwise false.</returns>
public bool IsInRopePaths(Cell adjacente, List<List<Cell>> ropePaths, int index); public bool IsInRopePaths(Cell adjacente, List<List<Cell>> ropePaths, out int index);
/// <summary> /// <summary>
/// Check if the chosen cell has the same value as the rope path at the given index. /// Check if the chosen cell has the same value as the rope path at the given index.

@ -25,7 +25,7 @@ namespace Models.Rules
{ {
if (!IsCellEmpty(playerChoicePosition)) return false; if (!IsCellEmpty(playerChoicePosition)) return false;
if (playerChoicePosition.Valid == false) return false; if (!playerChoicePosition.Valid) return false;
if (EveryAdjacentCells(playerChoicePosition, cells).Count == 1) return false; if (EveryAdjacentCells(playerChoicePosition, cells).Count == 1) return false;
@ -46,14 +46,11 @@ namespace Models.Rules
public bool IsInRopePaths (Cell adjacente,List<List<Cell>> ropePaths, out int index) public bool IsInRopePaths (Cell adjacente,List<List<Cell>> ropePaths, out int index)
{ {
foreach (List<Cell> path in ropePaths) foreach (var path in ropePaths.Where(path => path.Contains(adjacente)))
{
if (path.Contains(adjacente))
{ {
index=ropePaths.IndexOf(path); index=ropePaths.IndexOf(path);
return true; return true;
} }
}
index = 0; index = 0;
return false; return false;
@ -74,7 +71,7 @@ namespace Models.Rules
IEnumerable<Cell> PlayedCellsQuery = IEnumerable<Cell> PlayedCellsQuery =
from cell in cells from cell in cells
where cell.Valid == true where cell.Valid
select cell; select cell;
foreach (var cell in PlayedCellsQuery) foreach (var cell in PlayedCellsQuery)
@ -112,8 +109,6 @@ namespace Models.Rules
} }
} }
} }
return;
} }
public bool IsValueInZones(Cell chosenCell, List<List<Cell>> zones) public bool IsValueInZones(Cell chosenCell, List<List<Cell>> zones)

Loading…
Cancel
Save