protected bool MarkBulb(DataCell cell)
 {
     if (FeatureCell(cell))
     {
         int feature = cell.Feature(3, 2, FeatureCell);
         if (feature == 63)
         {
             cell.Marks.Add(Keys.Role, Values.BulbBegin);
             cell.RightCell().Marks.Add(Keys.Role, Values.Bulb);
             cell.DownCell().Marks.Add(Keys.Role, Values.Bulb);
             cell.DownCell().RightCell().Marks.Add(Keys.Role, Values.Bulb);
             cell.DownCell().DownCell().Marks.Add(Keys.Role, Values.Bulb);
             cell.DownCell().DownCell().RightCell().Marks.Add(Keys.Role, Values.Bulb);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
        } //MarkEyeLines

        protected bool MarkUmbrella(DataCell cell)
        {
            if (FeatureCell(cell))
            {
                int feature = cell.Feature(3, 3, FeatureCell);
                if (feature == 191 || feature == 255 || feature == 447 || feature == 511)
                {
                    cell.Marks.Add(Keys.Role, Values.UmbrellaBegin);
                    cell.RightCell().Marks.Add(Keys.Role, Values.Umbrella);
                    cell.RightCell().RightCell().Marks.Add(Keys.Role, Values.Umbrella);
                    cell.DownCell().Marks.Add(Keys.Role, Values.Umbrella);
                    cell.DownCell().RightCell().Marks.Add(Keys.Role, Values.Umbrella);
                    cell.DownCell().RightCell().RightCell().Marks.Add(Keys.Role, Values.Umbrella);
                    cell.DownCell().DownCell().RightCell().Marks.Add(Keys.Role, Values.Umbrella);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
 protected bool MarkCas3(DataCell cell)
 {
     if (FeatureCell(cell))
     {
         int feature = cell.Feature(3, 1, FeatureCell);
         if (feature == 7)
         {
             cell.Marks.Add(Keys.Role, Values.Cas3Begin);
             cell.DownCell().Marks.Add(Keys.Role, Values.Cas3);
             cell.DownCell().DownCell().Marks.Add(Keys.Role, Values.Cas3);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
 protected bool MarkHeart(DataCell cell)
 {
     if (FeatureCell(cell))
     {
         int feature = cell.Feature(2, 2, FeatureCell);
         if (feature == 15)
         {
             cell.Marks.Add(Keys.Role, Values.HeartBegin);
             cell.RightCell().Marks.Add(Keys.Role, Values.Heart);
             cell.DownCell().Marks.Add(Keys.Role, Values.Heart);
             cell.DownCell().RightCell().Marks.Add(Keys.Role, Values.Heart);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
 protected bool MarkPointer(DataCell cell)
 {
     if (FeatureCell(cell))
     {
         int feature = cell.Feature(2, 1, FeatureCell);
         if (feature == 3)
         {
             cell.Marks.Add(Keys.Role, Values.PointerBegin);
             cell.DownCell().Marks.Add(Keys.Role, Values.Pointer);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
        //Protected Methods
        protected bool MarkEyeWhites(DataCell cell)
        {
            Random rand = new Random(DateTime.Now.Millisecond);

            if (cell.IsEye() && cell.Color == CellColor.WHITE)
            {
                cell.Marks.Add(Keys.Role, Values.YellowCircle);

                if (cell.UpCell().Color != cell.DownCell().Color)
                {
                    double rand_value = rand.NextDouble();
                    if (rand_value > 0.5)
                    {
                        cell.Marks[Keys.Role] += Values.RedDashedCircle;
                    }
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #7
0
        //protected
        /// <summary>
        /// Mark All BLACK Cells,
        /// Left is the bar left head,
        /// Up is the bar up head,
        /// Marked is the bar's body,
        /// Single is the not in bar.
        /// Unmarked cells is the WHITE cell.
        /// </summary>
        protected void updateCellMarks()
        {
            Random rand_length = new Random();
            bool   markable    = true;

            foreach (DataCell cell in Matrix.CellMatrix)
            {
                //reset markable
                markable = true;

                if (!cell.IsEye() &&
                    !cell.Marks.ContainsKey(Keys.Role) &&
                    cell.Color == CellColor.BLACK)
                {
                    //Random Bar Length
                    int bar_length_index = rand_length.Next(2);
                    int bar_length       = barLengths[bar_length_index];

                    DataCell currCell = cell;
                    //Judge if could horizontal draw bar
                    for (int i = 0; i < bar_length; i++)
                    {
                        if (currCell == null || currCell.IsEye() || currCell.Color != cell.Color || currCell.Marks.ContainsKey(Keys.Role))
                        {
                            markable = false;
                            break;
                        }
                        currCell = currCell.RightCell();
                    }
                    if (markable)
                    {
                        //mark horizontal bar
                        cell.Marks.Add(Keys.Role, Values.Left);
                        cell.Marks.Add(Keys.Count, bar_length.ToString());
                        currCell = cell.RightCell();
                        for (int i = 0; i < bar_length - 1; i++)
                        {
                            currCell.Marks.Add(Keys.Role, Values.Marked);
                            currCell = currCell.RightCell();
                        }
                    }
                    else
                    {
                        markable = true;
                        currCell = cell;
                        for (int i = 0; i < bar_length; i++)
                        {
                            if (currCell == null || currCell.IsEye() || currCell.Color != cell.Color || currCell.Marks.ContainsKey(Keys.Role))
                            {
                                markable = false;
                                break;
                            }
                            currCell = currCell.DownCell();
                        }
                        if (markable)
                        {
                            cell.Marks.Add(Keys.Role, Values.Up);
                            cell.Marks.Add(Keys.Count, bar_length.ToString());
                            currCell = cell.DownCell();
                            for (int i = 0; i < bar_length - 1; i++)
                            {
                                currCell.Marks.Add(Keys.Role, Values.Marked);
                                currCell = currCell.DownCell();
                            }
                        }
                        else
                        {
                            cell.Marks.Add(Keys.Role, Values.Single);
                        }
                    }
                }
            }
        }