Esempio n. 1
0
        public GoBoardPoint PlayerVsCOM()
        {
            GoBoardPoint gp = new GoBoardPoint(m_BoardSize / 2 - 1, m_BoardSize / 2 - 1);

            if (m_StoneList.Count != 0)
            {
                gp = findPoint();
            }
            return(gp);
        }
Esempio n. 2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            Point pos = e.GetPosition(this);

            if (!m_GoBoardHitBox.Contains(new Point(pos.X - m_Border, pos.Y - m_Border)))
            {
                m_MousePosition = GoBoardPoint.Empty;
                DrawMouseHoverVisual();
                return;
            }

            int x = (int)Math.Round((pos.X - m_Border) / (m_GoBoardRect.Width / m_BoardSize));
            int y = (int)Math.Round((pos.Y - m_Border) / (m_GoBoardRect.Height / m_BoardSize));

            m_MousePosition = new GoBoardPoint(x, y);
            DrawMouseHoverVisual();
        }
Esempio n. 3
0
        private GoBoardPoint findPoint()
        {
            GoBoardPoint gp      = new GoBoardPoint();
            long         markMax = 0;

            for (int i = 0; i <= m_BoardSize; i++)
            {
                for (int j = 0; j <= m_BoardSize; j++)
                {
                    if (!m_StoneList.ContainsKey(new GoBoardPoint(i, j)))
                    {
                        long markAttack = markAttack_Vertical(i, j) + markAttack_Horizontal(i, j) + markAttack_CrossRight(i, j) + markAttack_CrossLeft(i, j);
                        long markĐefend = markDefend_Vertical(i, j) + markDefend_Horizontal(i, j) + markDefend_CrossRight(i, j) + markDefend_CrossLeft(i, j);
                        long Temp       = markAttack > markĐefend ? markAttack : markĐefend;
                        if (markMax <= Temp)
                        {
                            markMax = Temp;
                            gp      = new GoBoardPoint(i, j);
                        }
                    }
                }
            }
            return(gp);
        }
Esempio n. 4
0
 public RoutedMovePlayedEventArgs(RoutedEvent routedEvent, object source, GoBoardPoint pos, Stone stoneColor)
     : base(routedEvent, source)
 {
     Position   = pos;
     StoneColor = stoneColor;
 }
Esempio n. 5
0
 public GoBoardAnnotation(GoBoardAnnotationType type, GoBoardPoint position, string text)
 {
     m_Type = type;
     m_Position = position;
     m_Text = text;
 }
Esempio n. 6
0
        public GoBoardAnnotation(GoBoardAnnotationType type, GoBoardPoint position)
            : this(type, position, "")
        {

        }
 public RoutedMovePlayedEventArgs(RoutedEvent routedEvent, object source, GoBoardPoint pos, Stone stoneColor)
     : base(routedEvent, source)
 {
     Position = pos;
     StoneColor = stoneColor;
 }
Esempio n. 8
0
 private GoBoardPoint findPoint()
 {
     GoBoardPoint gp = new GoBoardPoint();
     long markMax = 0;
     for (int i = 0; i <= m_BoardSize; i++)
     {
         for (int j = 0; j <= m_BoardSize; j++)
         {
             if (!m_StoneList.ContainsKey(new GoBoardPoint(i, j)))
             {
                 long markAttack = markAttack_Vertical(i, j) + markAttack_Horizontal(i, j) + markAttack_CrossRight(i, j) + markAttack_CrossLeft(i, j);
                 long markĐefend = markDefend_Vertical(i, j) + markDefend_Horizontal(i, j) + markDefend_CrossRight(i, j) + markDefend_CrossLeft(i, j);
                 long Temp = markAttack > markĐefend ? markAttack : markĐefend;
                 if (markMax <= Temp)
                 {
                     markMax = Temp;
                     gp = new GoBoardPoint(i, j);
                 }
             }
         }
     }
     return gp;
 }
Esempio n. 9
0
 public GoBoardPoint PlayerVsCOM()
 {
     GoBoardPoint gp = new GoBoardPoint(m_BoardSize / 2 - 1, m_BoardSize / 2 - 1);
     if (m_StoneList.Count != 0)
     { 
         gp = findPoint();
     }
     return gp;
 }
Esempio n. 10
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            Point pos = e.GetPosition(this);

            if (!m_GoBoardHitBox.Contains(new Point(pos.X - m_Border, pos.Y - m_Border)))
            {
                m_MousePosition = GoBoardPoint.Empty;
                DrawMouseHoverVisual();
                return;
            }

            int x = (int)Math.Round((pos.X - m_Border) / (m_GoBoardRect.Width / m_BoardSize));
            int y = (int)Math.Round((pos.Y - m_Border) / (m_GoBoardRect.Height / m_BoardSize));

            m_MousePosition = new GoBoardPoint(x, y);
            DrawMouseHoverVisual();
        }
Esempio n. 11
0
 public GoBoardAnnotation(GoBoardAnnotationType type, GoBoardPoint position, string text)
 {
     m_Type     = type;
     m_Position = position;
     m_Text     = text;
 }
Esempio n. 12
0
 public GoBoardAnnotation(GoBoardAnnotationType type, GoBoardPoint position)
     : this(type, position, "")
 {
 }