Пример #1
0
        public Point SearchToPut2(Tictactoe game)
        {
            List <Point> ps  = new List <Point>();
            double       max = -100;

            for (int y = 0; y < game.Size; y++)
            {
                for (int x = 0; x < game.Size; x++)
                {
                    if (game.IsPuttable(x, y))
                    {
                        Point     p        = new Point(x, y);
                        Tictactoe newScene = new Tictactoe(game.State);
                        newScene.Put(p, mark);
                        double v = -NegMax(newScene, (Mark)(-(int)mark));

                        //Console.WriteLine("Put at (" + p.X.ToString() + ", " + p.Y.ToString() + ") is " + v.ToString());
                        if (max < v)
                        {
                            ps.Clear();
                            ps.Add(p);
                            max = v;
                        }
                        else if (max == v)
                        {
                            ps.Add(p);
                        }
                    }
                }
            }
            Random rd = new Random();

            List <string> nextSerifs = new List <string>();

            if (max > 7)
            {
                nextFace = FaceImage.GetChanceFace();
                nextSerifs.Add("ハッハー! 勝つるでござる!");
                nextSerifs.Add("これでどうでござるか?");
                nextSerifs.Add("ざるそば!!!");
            }
            else if (ps.Count == 1)
            {
                nextFace = FaceImage.GetPinchImage();
                nextSerifs.Add("ここしかないでござるな!?");
                nextSerifs.Add("むむむ……");
                nextSerifs.Add("勘弁してほしいでござる!");
            }
            else
            {
                nextFace = FaceImage.GetNormalFace();
                nextSerifs.Add("ま、この辺りでござろ");
                nextSerifs.Add("拙者ざるそばが大好きでござるよ");
                nextSerifs.Add("勝ったら借金はチャラでござる! 忘れないでくだされ");
            }
            nextSerif = nextSerifs.ElementAt(rd.Next(nextSerifs.Count));
            return(ps.ElementAt(rd.Next(ps.Count)));
        }
Пример #2
0
 public Image GetFaceImage()
 {
     return(FaceImage.GetNormalFace());
 }
Пример #3
0
 public AIPlayer(Mark mark)
 {
     this.mark      = mark;
     this.nextFace  = FaceImage.GetNormalFace();
     this.nextSerif = "";
 }