Example #1
0
        public int Distance(Field to)
        {
            var upper = _fieldsGraph.Borders().Upper;

            if (to.RowIndex <= upper.RowIndex)
            {
                return(0);
            }
            if (to.RowIndex >= upper.Oposite.RowIndex)
            {
                return(upper.Oposite.RowIndex - upper.RowIndex);
            }
            return(to.RowIndex - upper.RowIndex);
        }
Example #2
0
        public int Distance(Field to)
        {
            var bottom = _fieldsGraph.Borders().Bottom;

            if (to.RowIndex <= bottom.Oposite.RowIndex)
            {
                return(bottom.RowIndex - bottom.Oposite.RowIndex);
            }
            if (to.RowIndex >= bottom.RowIndex)
            {
                return(0);
            }
            return(bottom.RowIndex - to.RowIndex);
        }