示例#1
0
    /*** Tile Traversal ***/

    /// <summary>
    /// Build list of legal moves from current tile
    /// </summary>
    /// <param name="startTile">Starting tile</param>
    /// <param name="lstValidTiles">List to hold the valid tiles we can move to (Belongs to a penguin)</param>
    ///
    public void FindValidTiles(GameTile startTile, List <GameTile> lstValidTiles)
    {
        lstValidTiles.Clear();                              // Ensure list is empty

        foreach (GameTile tile in startTile.AllPaths(this)) // AllPaths() traverses a "search tree" for valid moves
        {
            if (tile != null)
            {
                lstValidTiles.Add(tile);                 // Add to list -- Exclude nulls returned at end of a path
            }
        }

        EnableValidTiles(lstValidTiles);   // Highlight only the tiles we can move to
    }
示例#2
0
    ///
    /// (Just get the total number of fish -- Don't need to store the tiles themselves)
    ///
    public int TallyLegalTiles(string sIDTileOrigin)
    {
        int totalNumFish = 0;

        GameTile startTile = m_refTM.tileTable[sIDTileOrigin];   // Get starting tile from ID

        // Traverse all legal paths and place tiles in list
        //
        foreach (ITileTraverse tile in startTile.AllPaths(m_refTM))
        {
            totalNumFish += tile.numFish;
        }

        return(totalNumFish);  // Return total number of fish on tiles -- List of tiles themselves stored in workTable
    }
示例#3
0
    ///
    public int FetchLegalTiles(string sIDTileOrigin, List <VTile> workTable)
    {
        int totalNumFish = 0;

        workTable.Clear();

        GameTile startTile = m_refTM.tileTable[sIDTileOrigin];   // Get starting tile from ID

        // Traverse all legal paths and place tiles in list
        //
        foreach (ITileTraverse tile in startTile.AllPaths(m_refTM))
        {
            workTable.Add(tileTable[tile.tileID]);   // Get VTile that corresponds to GameTile

            totalNumFish += tile.numFish;
        }

        return(totalNumFish);  // Return total number of fish on tiles -- List of tiles themselves stored in workTable
    }