Beispiel #1
0
        public static bool moveChessInBoard(LiuheChess lc, LiuheChessBoard lcb)
        {
            int[]          pos = lcb.getPointPos(lc.x, lc.y, lc.dir);
            GridValidState gvs = getGridValidState(lcb, pos[0], pos[1]);

            if (gvs != GridValidState.VOID)
            {
                return(false);
            }
            else
            {
                LiuheChessBoard lcb2 = lcb.getCopy();
                LiuheChess      lc2  = lcb2.findChessByIdnum(lc.identityNumber);
                if (lc2 == null)
                {
                    Debug.Log("严重错误");
                    return(false);
                }
                lc2.x = pos[0];
                lc2.y = pos[1];

                GameBoardCalculateItself(lcb2);
                if (lc2.health <= 0)
                {
                    return(false);
                }

                lc.x = pos[0];
                lc.y = pos[1];
                GameBoardCalculateItself(lcb);
            }

            return(true);
        }
Beispiel #2
0
    public static LiuheChessBoard getPlacedChessBoard(PlaceMethod _PM, LiuheChessBoard lcb)
    {
        if (_PM == null)
        {
            Debug.Log("没有准备好!!");
        }
        foreach (PlaceAction pa in _PM._Actions)
        {
            switch (pa.type)
            {
            case PLACE_TYPE.NONE:
                //Debug.Log("什么也不做");
                break;

            case PLACE_TYPE.ADD:
                //Debug.Log("新增棋子!");
                lcb.addNewChessUnSafe(pa.x, pa.y, pa.direction, pa.ownner);
                break;

            case PLACE_TYPE.MOVE:
                //Debug.Log("什么也不做-->现在还没有写移动");
                break;

            default:
                break;
            }
        }

        return(lcb);
    }
Beispiel #3
0
        public static LiuheChessBoard getTryEndBoard(ChessObj co, LiuheChessBoard lcb)
        {
            LiuheChess lc = lcb.findChessByIdnum(co._ChessIdentityNumber);

            int[]          pos = lcb.getPointPos(lc.x, lc.y, lc.dir);
            GridValidState gvs = getGridValidState(lcb, pos[0], pos[1]);

            if (gvs != GridValidState.VOID)
            {
                return(null);
            }
            else
            {
                LiuheChessBoard lcb2 = lcb.getCopy();
                LiuheChess      lc2  = lcb2.findChessByIdnum(lc.identityNumber);
                if (lc2 == null)
                {
                    Debug.Log("严重错误");
                    return(null);
                }
                lc2.x = pos[0];
                lc2.y = pos[1];

                GameBoardCalculateItself(lcb2);
                return(lcb2);
            }
        }
Beispiel #4
0
        public static LiuheChessBoard getTryChessesEndBoard(List <ChessObj> coses, LiuheChessBoard lcb)
        {
            LiuheChessBoard lcb2 = lcb.getCopy();

            foreach (ChessObj co in coses)
            {
                //获取新棋子
                LiuheChess     lc  = lcb.findChessByIdnum(co._ChessIdentityNumber);
                int[]          pos = lcb.getPointPos(lc.x, lc.y, lc.dir);
                GridValidState gvs = getGridValidState(lcb, pos[0], pos[1]);

                if (gvs != GridValidState.VOID)
                {
                    return(null);
                }
                //棋子存在而且位置可用
                else
                {
                    LiuheChess lc2 = lcb2.findChessByIdnum(lc.identityNumber);
                    //移动棋子
                    if (lc2 == null)
                    {
                        //不可移动的时候严重错误
                        Debug.Log("严重错误");
                        return(null);
                    }
                    lc2.x = pos[0];
                    lc2.y = pos[1];
                }
            }

            GameBoardCalculateItself(lcb2);
            return(lcb2);
        }
Beispiel #5
0
    public static int evaluateGameBoard_MK0(LiuheChessBoard lcb)
    {
        int result = 0;

        Rules.GameBoardCalculateItself(lcb);
        List <LiuheChess> chesses = lcb.chesses;

        foreach (LiuheChess lc in chesses)
        {
            int thisone, zhengfu;
            thisone = 3;
            zhengfu = 1;
            //对于0玩家,分数是增加的,1玩家分数是减少的
            zhengfu = lc.ownner == 0 ? 1 : -1;

            thisone += lc.hasSuchBuff(BufferType.THRON) ? 3 : 0;
            thisone += lc.hasSuchBuff(BufferType.RING) ? 3 : 0;
            thisone += lc.hasSuchBuff(BufferType.SUPPORT) ? 1 : 0;
            thisone += lc.hasSuchBuff(BufferType.ATTACK) ? -1 : 0;

            if (lc.health <= 0)
            {
                thisone -= 6;
            }
            result += thisone * zhengfu;
        }

        return(result);
    }
Beispiel #6
0
        //确定这个地方能否下子
        public static GridValidState getGridValidState(LiuheChessBoard board, int xx, int yy)
        {
            int boardSize = board.boardSize;

            //完全越界的情况
            if ((xx < 0 && xx < -boardSize) ||
                (xx > 0 && xx > boardSize) ||
                (yy < 0 && yy < -boardSize) ||
                (yy > 0 && yy > boardSize))
            {
                return(GridValidState.OUTRANGE);
            }
            //两个尖角越界的情况
            if (xx > 0)
            {
                if (yy < xx - boardSize)
                {
                    return(GridValidState.INVALID);
                }
            }
            else if (xx < 0)
            {
                if (yy > boardSize + xx)
                {
                    return(GridValidState.INVALID);
                }
            }

            if (board.findChessByPosition(xx, yy) != null)
            {
                return(GridValidState.USING);
            }

            return(GridValidState.VOID);
        }
Beispiel #7
0
        public LiuheChessBoard getWahsedOutChessBoardCopy()
        {
            LiuheChessBoard lcb = _GameBoard.getCopy();

            washOut(lcb);
            updateChessBoard(lcb);

            return(lcb);
        }
Beispiel #8
0
 private void setupGameManager()
 {
     _GameBoard  = null;
     _BoardLevel = 0;
     _PlayerNum  = 0;
     _State      = GAME_STATE.READY;
     _Players    = new List <LiuhePlayer>();
     _AI_Type    = 0;
 }
Beispiel #9
0
 public static void Log(Display db, LiuheChessBoard lcb)
 {
     foreach (ChessObj co in db._ChessList)
     {
         foreach (LiuheChess lc in lcb.chesses)
         {
         }
     }
 }
Beispiel #10
0
        public static bool moveChessInBoardUnsafe(LiuheChess lc, LiuheChessBoard lcb)
        {
            int[] pos = lcb.getPointPos(lc.x, lc.y, lc.dir);

            lc.x = pos[0];
            lc.y = pos[1];
            GameBoardCalculateItself(lcb);
            return(true);
        }
Beispiel #11
0
        public static void cleanAttacks(LiuheChessBoard lcb)
        {
            washChessBoard(lcb);

            lcb.skills  = new List <SpecialChessLink>();
            lcb.deads   = new List <SpecialChessLink>();
            lcb.attacks = new List <SpecialChessLink>();

            foreach (LiuheChess lc in lcb.chesses)
            {
                lc.buffers = new List <BufferEffect>();
            }
        }
Beispiel #12
0
        //递归函数
        private static int getNextLength(LiuheChess origin, LiuheChess thisC, LiuheChessBoard boardRef, int depth, List <RingInfo> rfs)
        {
            //当递归回到了头的时候-->返回长度
            if (thisC == origin)
            {
                rfs.Add(new RingInfo(thisC, depth + 1));
                return(depth + 1);
            }

            if (depth > 10)
            {
                Debug.Log("环过长");
                return(-1);
            }


            //对于所有五种方向进行判断(除了自己指向的方向)
            for (int i = 0; i < 6; i++)
            {
                if (thisC.dir == i)
                {
                    continue;
                }

                //获得现在这个方向的棋子
                LiuheChess nc = boardRef.findChessInDir(thisC.x, thisC.y, i);
                if (nc != null && nc.ownner == thisC.ownner)
                {
                    //如果非空则找这个棋子指向的对象
                    LiuheChess nc2 = boardRef.findChessInDir(nc.x, nc.y, nc.dir);

                    //如果这个棋子指向自己
                    if (nc2 == thisC)
                    {
                        //对这个方向进行搜索
                        int result;
                        result = getNextLength(origin, nc, boardRef, depth + 1, rfs);
                        //递归回来的结果如果是可用的
                        if (result > 0)
                        {
                            rfs.Add(new RingInfo(thisC, result));
                            return(result);
                        }
                        //否则继续找其他方向
                    }
                }
            }
            //如果这里所有方向都不行,则返回不可用的-1
            return(-1);
        }
Beispiel #13
0
        public static LiuheChessBoard washChessBoard(LiuheChessBoard lcb)
        {
            foreach (SpecialChessLink item in lcb.deads)
            {
                if (item._Type == SpecialLinkType.DEAD)
                {
                    LiuheChess lc = lcb.findChessByIdnum(item._From_Idm);
                    lcb.chesses.Remove(lc);
                }
            }
            GameBoardCalculateItself(lcb);


            return(lcb);
        }
Beispiel #14
0
        public List <SpecialChessLink> tryEndAction()
        {
            LiuheChessBoard lcb = _GameBoard.getCopy();

            Rules.Rules.GameBoardCalculateItself(lcb);

            //没有棋子被吃掉的话
            if (lcb.deads.Count == 0)
            {
                return(null);
            }
            else
            {
                return(lcb.attacks);
            }
        }
Beispiel #15
0
 public static void Log(LiuheChessBoard chessboard)
 {
     Debug.Log("现在棋盘上有" + chessboard.chesses.Count + "颗棋子");
     foreach (LiuheChess item in chessboard.chesses)
     {
         Log(item);
     }
     Debug.Log("棋盘上的特殊状态为:");
     foreach (SpecialChessLink item in chessboard.deads)
     {
         Log(item);
     }
     foreach (SpecialChessLink item in chessboard.attacks)
     {
         Log(item);
     }
 }
Beispiel #16
0
    public static int getBestResultPurge(LiuheChessBoard lcb, PlaceMethod pm, int layer, bool isAI, float purgeRate)
    {
        if (layer <= 0)
        {
            LiuheChessBoard lcbTemp = PlaceMethodGenerator.getPlacedChessBoard(pm, lcb);
            return(GameBoardEvaluator.evaluateGameBoard_MK0(lcbTemp));
        }
        else
        {
            LiuheChessBoard lcbTemp = PlaceMethodGenerator.getPlacedChessBoard(pm, lcb);

            List <PlaceMethod> pms     = PlaceMethodGenerator.getPurchedMethods(lcb, purgeRate, isAI);
            List <int>         results = new List <int>();
            foreach (PlaceMethod p in pms)
            {
                results.Add(getBestResult(lcbTemp.getCopy(), p, layer - 1, !isAI));
            }

            if (isAI)
            {
                int minvalue = results[0];
                for (int i = 1; i < results.Count; i++)
                {
                    if (results[i] < minvalue)
                    {
                        minvalue = results[i];
                    }
                }
                return(minvalue);
            }
            else
            {
                int maxvalue = results[0];
                for (int i = 1; i < results.Count; i++)
                {
                    if (results[i] > maxvalue)
                    {
                        maxvalue = results[i];
                    }
                }
                return(maxvalue);
            }
        }
    }
Beispiel #17
0
    public LiuheChessBoard isValid(LiuheChessBoard lcb)
    {
        int idm = lcb.addNewChessUnSafe(this.x, this.y, this.direction, this.ownner);

        Rules.GameBoardCalculateItself(lcb);

        LiuheChess lc = lcb.findChessByIdnum(idm);

        Assert.IsNotNull(lc, "找到了空棋子,ai下子有问题");

        if (lc.health <= 0)
        {
            return(null);
        }
        else
        {
            return(lcb);
        }
    }
Beispiel #18
0
        private static void checkRing(LiuheChessBoard boardRef, int idm, List <RingInfo> rfs)
        {
            LiuheChess l = boardRef.findChessByIdnum(idm);

            if (l == null)
            {
                Debug.Log("严重错误! 找不到的开始值!");
                return;
            }

            LiuheChess fc = boardRef.findChessInDir(l.x, l.y, l.dir);

            //l指向的不为空,fc是己方
            if (fc != null && fc.ownner == l.ownner)
            {
                getNextLength(fc, l, boardRef, 0, rfs);
            }
            return;
        }
Beispiel #19
0
        public static List <int> getUsableDirection(LiuheChessBoard lcb)
        {
            List <int> ud = new List <int>();

            for (int i = 0; i < 6; i++)
            {
                ud.Add(i);
            }

            foreach (var item in lcb.places)
            {
                if (item.placeOwnner >= 0)
                {
                    ud.Remove(item.chessDir);
                }
            }

            return(ud);
        }
Beispiel #20
0
        public bool getTryMoveBoard(ChessObj co)
        {
            LiuheChessBoard lcb = Rules.Rules.getTryEndBoard(co, _GameBoard);

            if (lcb != null)
            {
                int h = lcb.findChessByIdnum(co._ChessIdentityNumber).health;
                Debug.Log(h);
                if (h <= 0)
                {
                    return(false);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #21
0
    public bool isValid(LiuheChessBoard lcb)
    {
        if (_Actions.Count == 1 && _Actions[0].type == PLACE_TYPE.NONE)
        {
            return(true);
        }

        LiuheChessBoard lcb2 = lcb.getCopy();

        foreach (PlaceAction pi in _Actions)
        {
            lcb2 = pi.isValid(lcb2);
            if (lcb2 == null)
            {
                return(false);
            }
        }

        return(true);
    }
Beispiel #22
0
        public static LiuheChessBoard getTryResult(LiuheChessBoard board, int xx, int yy, int dir, LiuhePlayer lp)
        {
            GridValidState gvs = getGridValidState(board, xx, yy);

            if (gvs != GridValidState.VOID)
            {
                LiuheLogger.Log(gvs);
                return(null);
            }
            int idm = board.addNewChess(xx, yy, dir, lp._PlayerIndex);

            if (idm < 0)
            {
                //Debug.Log("此位置存在错误!");
                return(null);
            }

            GameBoardCalculateItself(board);

            return(board);
        }
Beispiel #23
0
        public bool placeChess(LiuhePlayer player, int xx, int yy, int dir)
        {
            if (!isThisIsPlayerNow(player))
            {
                Debug.Log("当前并非此玩家的回合,无法操作");
                return(false);
            }

            LiuheChessBoard lcb = this._GameBoard.getCopy();

            if (!Rules.Rules.tryPlaceChessToGameBoard(lcb, xx, yy, dir, player))
            {
                Debug.Log("落子失败!");
                return(false);
            }

            _GameBoard.addNewChess(xx, yy, dir, player._PlayerIndex);

            updateChessBoard();

            return(true);
        }
Beispiel #24
0
        public void startGame(int level, List <PLAYER_TYPE> ps, List <PLAYER_CHARACTER> pc)
        {
            if (_State != GAME_STATE.READY)
            {
                Debug.Log("当前状态下不能开始游戏!请检查后重新设置");
                return;
            }

            _BoardLevel = level;
            _GameBoard  = new LiuheChessBoard(_BoardLevel);

            _PlayerNum = ps.Count;
            _Players   = new List <LiuhePlayer>();
            for (int i = 0; i < _PlayerNum; i++)
            {
                if (ps[i] == PLAYER_TYPE.AI)
                {
                    _Players.Add(new LiuheAIPlayer(i, pc[i]));
                }
                else if (ps[i] == PLAYER_TYPE.LOCAL)
                {
                    _Players.Add(new LiuheLocalPlayer(i, pc[i]));
                }
                else if (ps[i] == PLAYER_TYPE.NETWORK)
                {
                    _Players.Add(new LiuheNetworkPlayer(i, pc[i]));
                }
                else
                {
                    Debug.Log("不存在这样的玩家类型!请检查后重新输入!");
                }
            }

            _State     = GAME_STATE.RUNNING;
            _PlayerNow = 0;

            LiuheLogger.Log(_Players);
        }
Beispiel #25
0
    public static PlaceMethod getBestMethodMultiLayerPurge(int layer, float purge)
    {
        LiuheChessBoard    lcb     = GameManager._Main._GameBoard;
        List <PlaceMethod> pms     = PlaceMethodGenerator.getPurchedMethods(lcb, purge, true);
        List <int>         results = new List <int>();

        foreach (PlaceMethod p in pms)
        {
            results.Add(getBestResultPurge(lcb.getCopy(), p, layer - 1, false, purge));
        }
        int min      = 0;
        int minvalue = results[0];

        for (int i = 1; i < results.Count; i++)
        {
            if (results[i] < minvalue)
            {
                minvalue = results[i];
                min      = i;
            }
        }
        return(pms[min]);
    }
Beispiel #26
0
    // Update is called once per frame
    void Update()
    {
        //输出信息
        if (Input.GetButtonDown("Print"))
        {
            Debug.Log("输出信息:");
            LiuheChessBoard lb = _Manager._GameBoard;
            LiuheLogger.Log(lb);
        }
        if (Input.GetButtonDown("PrintDisplay"))
        {
            Debug.Log("输出信息:");
            LiuheLogger.Log(this);
        }

        if (_Manager._RoundNum != this._LastRound)
        {
            _LastRound  = _Manager._RoundNum;
            _RoundState = DisplayState.HAS_NOT_PLACE_CHESS;
            Debug.Log("切换了新回合");


            //切换新的指示牌出来
            if (_Manager._Players[_Manager._PlayerNow]._Type == PLAYER_TYPE.LOCAL)
            {
                tintLog2();
                _ChessLog3Transform.DOMove(_ChessLogStart.position, 0.5f);
                _ChessLog2Transform.DOMove(_ChessLogEnd.position, 0.5f);
            }
            else
            {
                tintLog2();
                _ChessLog3Transform.DOMove(_ChessLogStart.position, 0.5f);
                _ChessLog2Transform.DOMove(_ChessLogEnd.position, 0.5f);
            }
        }
    }
Beispiel #27
0
    public static PlaceMethod getMinPlaceMethod_OL()
    {
        List <PlaceMethod> pms  = PlaceMethodGenerator.getAllValidPlaceMethod(GameManager._Main._GameBoard.getCopy());
        LiuheChessBoard    lcb2 = GameManager._Main._GameBoard.getCopy();

        LiuheChessBoard lcbTemp = PlaceMethodGenerator.getPlacedChessBoard(pms[0], lcb2.getCopy());

        int minNum              = 0;
        int minValue            = GameBoardEvaluator.evaluateGameBoard_MK0(lcbTemp);
        List <PlaceMethod> _NPM = new List <PlaceMethod>();

        _NPM.Add(pms[0]);
        for (int i = 1; i < pms.Count; i++)
        {
            int temp;
            lcbTemp = PlaceMethodGenerator.getPlacedChessBoard(pms[i], lcb2.getCopy());
            temp    = GameBoardEvaluator.evaluateGameBoard_MK0(lcbTemp);

            //Debug.Log("评分为"+temp);

            if (temp < minValue)
            {
                minNum   = i;
                minValue = temp;
                _NPM     = new List <PlaceMethod>();
                _NPM.Add(pms[i]);
            }
            else if (temp == minValue)
            {
                _NPM.Add(pms[i]);
            }
        }

        int iend = (int)Random.Range(0, _NPM.Count);

        return(_NPM[iend]);
    }
Beispiel #28
0
    public static List <PlaceMethod> getPurchedMethods(LiuheChessBoard lcb, float purchRate, bool isAI)
    {
        List <PlaceMethod> pms = getAllValidPlaceMethod(lcb);
        int purchNum           = (int)(pms.Count * purchRate);

        if (purchNum == pms.Count)
        {
            purchNum--;
        }

        List <int> results = new List <int>();

        foreach (PlaceMethod p in pms)
        {
            LiuheChessBoard lcb2 = PlaceMethodGenerator.getPlacedChessBoard(p, lcb.getCopy());
            results.Add(GameBoardEvaluator.evaluateGameBoard_MK0(lcb2));
        }

        if (isAI)
        {
            //是ai,从小到大
            for (int i = 0; i < pms.Count; i++)
            {
                for (int j = i; j < pms.Count; j++)
                {
                    if (results[i] > results[j])
                    {
                        int temp = results[i];
                        results[i] = results[j];
                        results[j] = temp;
                        PlaceMethod pm = pms[i];
                        pms[i] = pms[j];
                        pms[j] = pm;
                    }
                }
            }
        }
        else
        {
            //是人,从大到小
            for (int i = 0; i < pms.Count; i++)
            {
                for (int j = i; j < pms.Count; j++)
                {
                    if (results[i] < results[j])
                    {
                        int temp = results[i];
                        results[i] = results[j];
                        results[j] = temp;
                        PlaceMethod pm = pms[i];
                        pms[i] = pms[j];
                        pms[j] = pm;
                    }
                }
            }
        }

        for (int i = 0; i < purchNum; i++)
        {
            pms.RemoveAt(pms.Count - 1);
        }

        return(pms);
    }
Beispiel #29
0
    public static List <PlaceMethod> getAllValidPlaceMethod(LiuheChessBoard lcbIn)
    {
        List <PlaceMethod> pms = new List <PlaceMethod>();

        //预制不下棋到选择里面去
        pms.Add(new PlaceMethod().setNone());

        int ownner, gridLevel;

        ownner    = GameManager._Main._PlayerNow;
        gridLevel = GameManager._Main._BoardLevel;

        LiuheChessBoard lcb  = lcbIn;
        List <int>      udrs = Rules.getUsableDirection(lcb);

        for (int i = 0; i < 2 * gridLevel - 1; i++)
        {
            //上半截
            if (i < gridLevel)
            {
                for (int j = 0; j < i + gridLevel; j++)
                {
                    int xx, yy;
                    xx = i - gridLevel + 1;
                    yy = j - gridLevel + 1;

                    GridValidState gvs = Rules.getGridValidState(lcb, xx, yy);
                    //如果此网格可以用
                    if (gvs == GridValidState.VOID)
                    {
                        for (int k = 0; k < udrs.Count; k++)
                        {
                            pms.Add(new PlaceMethod().addAction(PLACE_TYPE.ADD, xx, yy, udrs[k], ownner));
                        }
                    }
                }
            }
            //下半截
            else
            {
                for (int j = i - gridLevel + 1; j < 2 * gridLevel - 1; j++)
                {
                    int xx, yy;
                    xx = i - gridLevel + 1;
                    yy = j - gridLevel + 1;
                    GridValidState gvs = Rules.getGridValidState(lcb, xx, yy);
                    //如果此网格可以用
                    if (gvs == GridValidState.VOID)
                    {
                        for (int k = 0; k < udrs.Count; k++)
                        {
                            pms.Add(new PlaceMethod().addAction(PLACE_TYPE.ADD, xx, yy, udrs[k], ownner));
                        }
                    }
                }
            }
        }


        List <PlaceMethod> pms2 = new List <PlaceMethod>();

        foreach (PlaceMethod pm in pms)
        {
            if (pm.isValid(lcb))
            {
                pms2.Add(pm);
            }
        }

        return(pms2);
    }
Beispiel #30
0
    public static PlaceMethod getRandomPlaceMethod()
    {
        List <PlaceMethod> pms = new List <PlaceMethod>();

        //预制不下棋到选择里面去
        pms.Add(new PlaceMethod().setNone());

        int ownner, gridLevel;

        ownner    = GameManager._Main._PlayerNow;
        gridLevel = GameManager._Main._BoardLevel;

        LiuheChessBoard lcb  = GameManager._Main._GameBoard.getCopy();
        List <int>      udrs = Rules.getUsableDirection(lcb);

        for (int i = 0; i < 2 * gridLevel - 1; i++)
        {
            //上半截
            if (i < gridLevel)
            {
                for (int j = 0; j < i + gridLevel; j++)
                {
                    int xx, yy;
                    xx = i - gridLevel + 1;
                    yy = j - gridLevel + 1;

                    GridValidState gvs = Rules.getGridValidState(lcb, xx, yy);
                    //如果此网格可以用
                    if (gvs == GridValidState.VOID)
                    {
                        for (int k = 0; k < udrs.Count; k++)
                        {
                            pms.Add(new PlaceMethod().addAction(PLACE_TYPE.ADD, xx, yy, udrs[k], ownner));
                        }
                    }
                }
            }
            //下半截
            else
            {
                for (int j = i - gridLevel + 1; j < 2 * gridLevel - 1; j++)
                {
                    int xx, yy;
                    xx = i - gridLevel + 1;
                    yy = j - gridLevel + 1;
                    GridValidState gvs = Rules.getGridValidState(lcb, xx, yy);
                    //如果此网格可以用
                    if (gvs == GridValidState.VOID)
                    {
                        for (int k = 0; k < udrs.Count; k++)
                        {
                            pms.Add(new PlaceMethod().addAction(PLACE_TYPE.ADD, xx, yy, udrs[k], ownner));
                        }
                    }
                }
            }
        }


        while (pms.Count > 0)
        {
            PlaceMethod pm;
            int         rand;
            rand = (int)Random.Range(0, pms.Count);
            pm   = pms[rand];
            if (pm.isValid(lcb))
            {
                return(pm);
            }
            else
            {
                pms.Remove(pm);
            }
        }

        Debug.Log("不可能啊!");
        return(null);
    }