private int GetOppositeX(Clue clue) { int length = clue.Length; int x = clue.X; int y = clue.Y; Direction direction = clue.Direction; switch (direction) { case Direction.East: case Direction.NorthEast: case Direction.SouthEast: return(x + length - 1); default: return(x); } }
private List <Clue> ExtractOppositeClues(List <Clue> targetClues) { List <Clue> clues = new List <Clue>(); targetClues.ForEach(targetClue => { List <int> clueCharacters = new List <int>(); clueCharacters.AddRange(targetClue.Characters); clueCharacters.Reverse(); Direction direction = GetOppositeDirection(targetClue.Direction); int x = GetOppositeX(targetClue); int y = GetOppositeY(targetClue); Clue clue = new Clue(Guid.NewGuid(), clueCharacters, direction, x, y); targetClue.Opposite = clue; clue.Opposite = targetClue; clues.Add(clue); }); return(clues); }