public void VisitNextHouse(char direction) { House nextHouse = null; switch (direction) { case '^': nextHouse = new House(CurrentHouse.X, CurrentHouse.Y + 1); break; case 'v': nextHouse = new House(CurrentHouse.X, CurrentHouse.Y - 1); break; case '<': nextHouse = new House(CurrentHouse.X - 1, CurrentHouse.Y); break; case '>': nextHouse = new House(CurrentHouse.X + 1, CurrentHouse.Y); break; } if (!Houses.Any(h => h.X == nextHouse.X && h.Y == nextHouse.Y)) { Houses.Add(nextHouse); } CurrentHouse = nextHouse; }
public int GetNewNumber() { var max = 1; if (Houses.Any()) { max += Houses.Max(w => w.Nr); } return(max); }
public bool Contains(string player) { return(Houses.Any(x => x.PlayerName == player)); }