Ejemplo n.º 1
0
        public static List <ChessContainer> getArrivableGrid(Chess c)
        {
            List <ChessContainer> res_list    = new List <ChessContainer>();
            List <ChessContainer> search_list = new List <ChessContainer>();

            search_list.Add(c.container);
            search_list = getAroundGrid(c.attribute.Spd, search_list);
            foreach (var item in search_list)
            {
                if (item.my_chess == null && GameRule.judgePassable(c, item))
                {
                    res_list.Add(item);
                }
            }
            return(res_list);
        }
        void DistDFS_Explored(int now_pos, int nowdis)
        {
            foreach (var item in Main.Inst.dGetChessContainer)
            {
                ChessContainer cc = item(Main.Inst.chess_grids[now_pos]);

                if (cc == null)
                {
                    continue;
                }
                if (chess_grids_dist[cc.number] == -1)
                {
                    continue;
                }
                if (nowdis < chess_grids_dist[cc.number] || chess_grids_dist[cc.number] == 0)
                {
                    if (GameRule.judgePassable(Main.Inst.moving_chess, cc))
                    {
                        chess_grids_dist[cc.number] = nowdis;
                        if (nowdis > max_grid_dis)
                        {
                            max_grid_dis = nowdis;
                        }
                    }
                    else
                    {
                        chess_grids_dist[cc.number] = -1;
                    }
                    if (chess_grids_dist[cc.number] != -1)
                    {
                        DistDFS_Explored(cc.number, chess_grids_dist[cc.number] + 1);
                    }
                }
            }
            return;
        }