當前位置: 首頁>>代碼示例>>C#>>正文


C# AI.getTile方法代碼示例

本文整理匯總了C#中AI.getTile方法的典型用法代碼示例。如果您正苦於以下問題:C# AI.getTile方法的具體用法?C# AI.getTile怎麽用?C# AI.getTile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AI的用法示例。


在下文中一共展示了AI.getTile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: init

        public static void init(AI ai)
        {
            MaxX = ai.mapWidth();
            MaxY = ai.mapHeight();

            OurReef = new BitArray(AI.tiles.Length);
            TheirReef = new BitArray(AI.tiles.Length);
            NeutralReef = new BitArray(AI.tiles.Length);

            FishMap = new BitArray(AI.tiles.Length);
            OurFishMap = new BitArray(AI.tiles.Length);
            TheirFishMap = new BitArray(AI.tiles.Length);

            WallMap = new BitArray(AI.tiles.Length);

            TrashMap = new BitArray(AI.tiles.Length);
            OurTrashMap = new BitArray(AI.tiles.Length);
            TheirTrashMap = new BitArray(AI.tiles.Length);

            CoveMap = new BitArray(AI.tiles.Length);
            OurCoveMap = new BitArray(AI.tiles.Length);
            TheirCoveMap = new BitArray(AI.tiles.Length);

            OurStarfishMap = new BitArray(AI.tiles.Length);
            OurSpongesMap = new BitArray(AI.tiles.Length);
            OurAngelfishesMap = new BitArray(AI.tiles.Length);
            OurSnailsMap = new BitArray(AI.tiles.Length);
            OurUrchinsMap = new BitArray(AI.tiles.Length);
            OurOctopiMap = new BitArray(AI.tiles.Length);
            OurTomcodsMap = new BitArray(AI.tiles.Length);
            OurSharksMap = new BitArray(AI.tiles.Length);
            OurCuttlefishesMap = new BitArray(AI.tiles.Length);
            OurShrimpsMap = new BitArray(AI.tiles.Length);
            OurEelsMap = new BitArray(AI.tiles.Length);
            OurJellyfishMap = new BitArray(AI.tiles.Length);

            TheirStarfishMap = new BitArray(AI.tiles.Length);
            TheirSpongesMap = new BitArray(AI.tiles.Length);
            TheirAngelfishesMap = new BitArray(AI.tiles.Length);
            TheirSnailsMap = new BitArray(AI.tiles.Length);
            TheirUrchinsMap = new BitArray(AI.tiles.Length);
            TheirOctopiMap = new BitArray(AI.tiles.Length);
            TheirTomcodsMap = new BitArray(AI.tiles.Length);
            TheirSharksMap = new BitArray(AI.tiles.Length);
            TheirCuttlefishesMap = new BitArray(AI.tiles.Length);
            TheirShrimpsMap = new BitArray(AI.tiles.Length);
            TheirEelsMap = new BitArray(AI.tiles.Length);
            TheirJellyfishMap = new BitArray(AI.tiles.Length);

            OurDeepestReef = new BitArray(AI.tiles.Length);
            TheirDeepestReef = new BitArray(AI.tiles.Length);

            //Fill Reef Maps
            foreach (var tile in BaseAI.tiles)
            {
                if (tile.Damages == ai.playerID())
                {
                    OurReef[GetOffset(tile.X, tile.Y)] = true;
                }
                else if (tile.Damages == 1 - ai.playerID())
                {
                    TheirReef[GetOffset(tile.X, tile.Y)] = true;
                }
                else
                {
                    NeutralReef[GetOffset(tile.X, tile.Y)] = true;
                }
            }
            if (ai.getTile(MaxX-1, 0).Damages == ai.playerID())
            {
                foreach (Tile t in BaseAI.tiles)
                {
                    if (t.X == MaxX - 1 || t.X == MaxX - 2)
                    {
                        OurDeepestReef[GetOffset(t.X, t.Y)] = true;
                    }
                    else if (t.X == 0 || t.X == 1)
                    {
                        TheirDeepestReef[GetOffset(t.X, t.Y)] = true;
                    }
                }
            }
            else
            {
                foreach (Tile t in BaseAI.tiles)
                {
                    if (t.X == MaxX - 1 || t.X == MaxX - 2)
                    {
                        TheirDeepestReef[GetOffset(t.X, t.Y)] = true;
                    }
                    else if (t.X == 0 || t.X == 1)
                    {
                        OurDeepestReef[GetOffset(t.X, t.Y)] = true;
                    }
                }
            }

            //BaseAI.fishes.ToList().ForEach(fish => FishMap.Set(GetOffset(fish.X, fish.Y), true));

            //fill fish maps
//.........這裏部分代碼省略.........
開發者ID:austingantner,項目名稱:MegaMinerAI11-Reef,代碼行數:101,代碼來源:Bb.cs


注:本文中的AI.getTile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。