Exemple #1
0
        bool hasPlaceAtEnd(int pos, Cell[] vector, DescriptorData descriptor)
        {
            var posBefore = pos + 1;

            if (posBefore < vector.Length && vector[posBefore].Value == TCell.F)
            {
                return(false);
            }

            for (int d = pos; d > pos - descriptor.Value; d--)
            {
                if (vector[d].Value == TCell.X)
                {
                    return(false);
                }
            }

            var posAfter = pos - descriptor.Value;

            if (posAfter >= 0 && vector[posAfter].Value == TCell.F)
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        bool hasPlaceAtStart(int pos, Cell[] vector, DescriptorData descriptor)
        {
            var posBefore = pos - 1;

            if (posBefore >= 0 && vector[posBefore].Value == TCell.F)
            {
                return(false);
            }

            for (int d = pos; d < pos + descriptor.Value; d++)
            {
                if (vector[d].Value == TCell.X)
                {
                    return(false);
                }
            }

            var posAfter = pos + descriptor.Value;

            if (posAfter < vector.Length && vector[posAfter].Value == TCell.F)
            {
                return(false);
            }

            return(true);
        }