Esempio n. 1
0
        } //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);
            }
        }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 protected bool MarkWave(DataCell cell)
 {
     if (FeatureCell(cell))
     {
         int feature = cell.Feature(1, 5, FeatureCell);
         if (feature == 31)
         {
             cell.Marks.Add(Keys.Role, Values.WaveBegin);
             cell.RightCell().Marks.Add(Keys.Role, Values.Wave);
             cell.RightCell().RightCell().Marks.Add(Keys.Role, Values.Wave);
             cell.RightCell().RightCell().RightCell().Marks.Add(Keys.Role, Values.Wave);
             cell.RightCell().RightCell().RightCell().RightCell().Marks.Add(Keys.Role, Values.Wave);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Esempio n. 4
0
 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);
     }
 }
Esempio n. 5
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);
                        }
                    }
                }
            }
        }