Example #1
0
        public int[] match(AiBoard board)
        {
            var s = board.allSteps;

            if (board.board[s[0].p[0], s[0].p[1]] != 1)
            {
                return new int[] { -1, -1 }
            }
            ;
            if (s.Count > 2)
            {
                return new int[] { -1, -1 }
            }
            ;
            if (new List <int[]> {
                new int[] { 6, 7 }, new int[] { 7, 6 }, new int[] { 8, 7 }, new int[] { 7, 8 }
            }.Contains(s[1].p))
            {
                return(huayue(board));
            }
            else if (new List <int[]> {
                new int[] { 6, 6 }, new int[] { 8, 8 }, new int[] { 8, 6 }, new int[] { 6, 8 }
            }.Contains(s[1].p))
            {
                return(puyue(board));
            }
            return(new int[] { -1, -1 });
        }
Example #2
0
        private int[] puyue(AiBoard board)
        {
            var s = board.allSteps;

            if (new int[] { 6, 6 } == s[1].p)
            {
                if (s.Count == 2)
                {
                    return new int[] { 6, 8 }
                }
                ;
            }
            if (new int[] { 8, 6 } == s[1].p)
            {
                if (s.Count == 2)
                {
                    return new int[] { 6, 6 }
                }
                ;
            }
            if (new int[] { 8, 8 } == s[1].p)
            {
                if (s.Count == 2)
                {
                    return new int[] { 8, 6 }
                }
                ;
            }
            if (new int[] { 6, 8 } == s[1].p)
            {
                if (s.Count == 2)
                {
                    return new int[] { 8, 8 }
                }
                ;
            }
            return(new int[] { -1, -1 });
        }
    }
}
Example #3
0
 public void init(AiBoard _board)
 {
     board = _board;
 }
Example #4
0
 // 切换到ai
 public void start()
 {
     aiBoard = new AiBoard();
     aiBoard.init(15);
     aiNegamax = new AiNegamax();
 }