Merge règles chemin de corde
continuous-integration/drone/push Build is failing Details

pull/64/head
Rémi LAVERGNE 12 months ago
commit 3dfd11a8c2

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Models.Events; using Models.Events;
using Models.Rules; using Models.Rules;
@ -76,13 +77,39 @@ namespace Models.Game
} }
} }
/* public void AddToRopePath(Cell playerChoice, List<List<Cell>> ropePaths,Cell adjacente)
public void AddToRopePath(Cell cell)
{ {
if (GameRules.IsRopePath(cell, ropePaths)) return;
}
*/
List<List<Cell>> possiblePaths;
// {adjacentes} ne doit pas etre egale a {playerChoice}
if (adjacente.Value == playerChoice.Value) return;
// {adjacentes} doit etre croissant ou decroissant
if ((adjacente.Value - playerChoice.Value > 1) || (adjacente.Value - playerChoice.Value < -1)) return;
// Un nombre ne peut appartenir qu'a un seul chemin de corde
foreach (List<Cell> paths in ropePaths)
{
foreach (var cells in paths)
{
if (adjacente.X == cells.X && adjacente.Y == adjacente.Y)
{
possiblePaths.Add(paths);
}
}
}
// Si {ropePaths} est vide, il faut alors creer un chemin de corde entre {playerChoice}
if (ropePaths.Count == 0)
{
}
}
public void InitializeGame() public void InitializeGame()
{ {
@ -107,5 +134,6 @@ namespace Models.Game
await Task.Delay(1000); // 1 seconde await Task.Delay(1000); // 1 seconde
} }
} }
} }
} }

@ -20,6 +20,11 @@ namespace Models.Rules
return true; return true;
} }
public bool ropePathCellIsValid (Cell choosenCell, Cell targetCell)
{
if (Math.Abs(choosenCell.Value - targetCell.Value )
}
public bool NearCellIsValid(Cell choosenCell, List<Cell> cells) public bool NearCellIsValid(Cell choosenCell, List<Cell> cells)
{ {
if (choosenCell == null || cells == null) return false; if (choosenCell == null || cells == null) return false;

Loading…
Cancel
Save