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


C# Board.getTile方法代碼示例

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


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

示例1: getPossibleMoves

        ////////////// Get Possible Moves//////////////////
        public static List<Move> getPossibleMoves(Player player, Board b)
        {
            List<Move> Moves = new List<Move>(); //initialize empty moves.

            for(int i = 0; i < b.startTiles.Length + b.gameTiles.Length - 1; i++) //for/while #of start tiles and # of game tiles
            {
                List<Player> tile = b.getTile(i);       //gets tiles of current player's peices are currently lading on
                if(tile.Count > 0 && tile[tile.Count-1] == player)
                {
                    int dist = tile.Count;
                    if (i < b.startTiles.Length)
                    {
                        if(dist < 4)
                            Moves.Add(new Move(i, dist - 1 + b.startTiles.Length));
                        Moves.Add(new Move(i, dist + 2 + b.startTiles.Length));
                    }
                    else
                    {
                        if (i < 3 + b.startTiles.Length && i + dist > 2 + b.startTiles.Length)
                            dist += 3;
                        Moves.Add(new Move(i, Math.Min(i + dist, b.startTiles.Length + b.gameTiles.Length - 1)));
                    }
                }
            }

            return Moves;
        }
開發者ID:ds0nt,項目名稱:group-15-3,代碼行數:28,代碼來源:AICalc.cs

示例2: Random

        public static Random rand = new Random(); //please don't define extra but just use this !!

        #endregion Fields

        #region Methods

        //simpler version of Distance. doesn't handle invalied moves.
        ///////////////////////////Calculate the distance.//////////////////////////////
        ///you can use this ONLY AFTER you'd got the possible moves. this won't work for any random moves.
        ///this will only work for the moves that had start and end points.
        public static int distance(Move m, Board b)
        {
            int dist=0;
            //let's get the starting points height
            dist = b.getTile(m.start).Count;

            return dist;
        }
開發者ID:ds0nt,項目名稱:group-15-3,代碼行數:18,代碼來源:AICalc.cs

示例3: numberFinished

 //////////////count how many finished
 public static int numberFinished(Player p, Board b)
 {
     int countFinished = 0;
     List<Player> tile = b.getTile(29);
     for (int i = 0; i < tile.Count; i++)
     {
         if (tile[i] == LotusGame.get().players[LotusGame.get().currentPlayer])
         {
             countFinished++;
         }
     }
     return countFinished;
 }
開發者ID:ds0nt,項目名稱:group-15-3,代碼行數:14,代碼來源:AICalc.cs

示例4: coverOpponent

 public void coverOpponent(Player p, Board b)
 {
     List<Move> moves = AICalc.getPossibleMoves(p, b); // using AI calc to get the possible moves.
     bool covered = false;
     for (int i = 0; i < moves.Count; i++)
     {
         List<Player> tileStack= b.getTile(moves[i].end);
         if (tileStack.Count != 0 && tileStack[tileStack.Count - 1] != LotusGame.get().players[LotusGame.get().currentPlayer])
         {
             LotusGame.get().ScheduleEvent(new GameEvent.RegionClick(moves[i].start), 0.1f);
             LotusGame.get().ScheduleEvent(new GameEvent.RegionClick(moves[i].end), 0.2f);
             covered = true;
             break;
         }
     }
     if (covered == false)
         moveRandom(p, b);
     //dist = b.getTile(m.start).Count;
 }
開發者ID:ds0nt,項目名稱:group-15-3,代碼行數:19,代碼來源:AIMoves.cs


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