Пример #1
0
 public bool IsFieldFree(Position position)
 {
     if (Humans.Find(e => e.Col == position.Column && e.Row == position.Row) != null)
     {
         return(false);
     }
     return(true);
 }
Пример #2
0
        /// <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);
        }