public bool IsFieldFree(Position position) { if (Humans.Find(e => e.Col == position.Column && e.Row == position.Row) != null) { return(false); } return(true); }
/// <summary> /// Gets next free field in the console /// </summary> /// <returns>Row and Column in a Dictionary</returns> private Position GetFreeField() { int width = RunTimeConfig.CWidth; int height = RunTimeConfig.CHeight; for (int i = 0; i <= height; i++) // Loop through rows { for (int j = 0; j <= width; j++) // Loop through columns { if (Humans.Find(e => e.Col == j && e.Row == i) == null) { return(new Position(i, j)); } } } return(null); }