Ejemplo n.º 1
0
        public override Move move(IField field, int teamId, int remainTurn)
        {
            List <Move> availableMoveList = new List <Move>();

            //可能なMoveをピックアップ
            while (availableMoveList.Count == 0)
            {
                //team1なら下、team0なら上方向を優先するため、その反対を一定確率で除外する。
                Way removeWay =  mRand.NextDouble() < 0.3 ? Way.Center :
                                teamId == 0 ? Way.Down : Way.Up;

                for (int y = 0; y < IField.cFieldHeight; y++)
                {
                    for (int x = 0; x < IField.cFieldWidth; x++)
                    {
                        foreach (Way w in WayUtil.way4)
                        {
                            if (w == removeWay)
                            {
                                continue;
                            }

                            if (field.canMove(teamId, new TPoint(x, y), TPoint.add(new taiyo.TPoint(x, y), TPoint.fromWay(w))))
                            {
                                availableMoveList.Add(new Move(new TPoint(x, y), w));
                            }
                        }
                    }
                }
            }


            return(availableMoveList[mRand.Next() % availableMoveList.Count]);
        }
Ejemplo n.º 2
0
 public TPoint toPos()
 {
     return(TPoint.add(pos, TPoint.fromWay(way)));
 }