コード例 #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);
        }
コード例 #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();
        }
コード例 #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);
        }
コード例 #4
0
 public RoutedMovePlayedEventArgs(RoutedEvent routedEvent, object source, GoBoardPoint pos, Stone stoneColor)
     : base(routedEvent, source)
 {
     Position   = pos;
     StoneColor = stoneColor;
 }
コード例 #5
0
 public GoBoardAnnotation(GoBoardAnnotationType type, GoBoardPoint position, string text)
 {
     m_Type = type;
     m_Position = position;
     m_Text = text;
 }
コード例 #6
0
        public GoBoardAnnotation(GoBoardAnnotationType type, GoBoardPoint position)
            : this(type, position, "")
        {

        }
コード例 #7
0
 public RoutedMovePlayedEventArgs(RoutedEvent routedEvent, object source, GoBoardPoint pos, Stone stoneColor)
     : base(routedEvent, source)
 {
     Position = pos;
     StoneColor = stoneColor;
 }
コード例 #8
0
ファイル: GoBoardPainter.cs プロジェクト: MinhDat/My_Gomoku
 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;
 }
コード例 #9
0
ファイル: GoBoardPainter.cs プロジェクト: MinhDat/My_Gomoku
 public GoBoardPoint PlayerVsCOM()
 {
     GoBoardPoint gp = new GoBoardPoint(m_BoardSize / 2 - 1, m_BoardSize / 2 - 1);
     if (m_StoneList.Count != 0)
     { 
         gp = findPoint();
     }
     return gp;
 }
コード例 #10
0
ファイル: GoBoardPainter.cs プロジェクト: MinhDat/My_Gomoku
        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();
        }
コード例 #11
0
 public GoBoardAnnotation(GoBoardAnnotationType type, GoBoardPoint position, string text)
 {
     m_Type     = type;
     m_Position = position;
     m_Text     = text;
 }
コード例 #12
0
 public GoBoardAnnotation(GoBoardAnnotationType type, GoBoardPoint position)
     : this(type, position, "")
 {
 }