예제 #1
0
    public override bool HandHasCombination(List <Tile> tiles, HandCombination.CompletionType compType)
    {
        List <Tile> sets = Tile.ReturnGroupedTiles(tiles);

        if (sets.Count != 3)
        {
            return(false);
        }

        bool allSame = true;
        Tile tile    = sets[0];

        for (int i = 1; i < sets.Count; ++i)
        {
            Tile otherTile = sets[i];

            if (!tile.IsSame(otherTile))
            {
                allSame = false;
                break;
            }
        }

        bool valid = sets.Count == 3 && allSame;

        return(valid);
    }
예제 #2
0
    public override bool HandHasCombination(List <Tile> tiles, HandCombination.CompletionType compType)
    {
        Player player = tiles[0].Owner;

        List <Tile> sets = Tile.ReturnGroupedTiles(tiles);

        return(sets.Count == 3 && player.HasReached);
    }
예제 #3
0
    public override bool HandHasCombination(List <Tile> tiles, HandCombination.CompletionType compType)
    {
        List <Tile> sets = Tile.ReturnGroupedTiles(tiles);

        return(sets.Count == 3 &&
               sets.Exists(t => t.Type == Tile.TileType.Red) &&
               sets.Exists(t => t.Type == Tile.TileType.Blue) &&
               sets.Exists(t => t.Type == Tile.TileType.Yellow));
    }
예제 #4
0
    public override bool HandHasCombination(List <Tile> tiles, HandCombination.CompletionType compType)
    {
        List <Tile> sets = Tile.ReturnGroupedTiles(tiles);

        bool exists = sets.Exists(t => t.Type == Tile.TileType.Dragon && t.Id == this.id);

        bool valid = sets.Count == 3 && exists;

        return(valid);
    }
예제 #5
0
    public override bool HandHasCombination(List <Tile> tiles, HandCombination.CompletionType compType)
    {
        // We count discard as well for winning off of stealing, which shouldn't count as a merge.
        List <Tile> handTiles = tiles.Where(t => t.Zone.Type == Zone.ZoneType.Hand || t.Zone.Type == Zone.ZoneType.Discard).ToList();

        bool valid = (handTiles.Count == CombatSceneController.MaxPlayerHandSize);

        if (valid)
        {
            List <Tile> sets = Tile.ReturnGroupedTiles(handTiles);
            valid = (sets.Count == CombatSceneController.MaxPlayerHandSize / CombatSceneController.SetSize);
        }

        return(valid);
    }
예제 #6
0
    public override bool HandHasCombination(List <Tile> tiles, HandCombination.CompletionType compType)
    {
        List <Tile> sets = Tile.ReturnGroupedTiles(tiles);

        HashSet <int> ids = new HashSet <int>();

        foreach (Tile tile in sets)
        {
            ids.Add(tile.Id);
        }

        bool valid = sets.Count == 3 && ids.Count == 1;

        return(valid);
    }
예제 #7
0
파일: Game.cs 프로젝트: tmoritaa/Ponjan
    public List <HandCombination> ReturnValidCombinations(List <Tile> tiles, HandCombination.CompletionType compType)
    {
        List <HandCombination> validCombs = new List <HandCombination>();

        foreach (HandCombination comb in this.handCombinations)
        {
            bool valid = comb.HandHasCombination(tiles, compType);
            if (valid)
            {
                validCombs.Add(comb);
            }
        }

        return(validCombs);
    }
예제 #8
0
    public override bool HandHasCombination(List <Tile> tiles, HandCombination.CompletionType compType)
    {
        List <Tile> sets = Tile.ReturnGroupedTiles(tiles);

        int  redExists    = sets.Exists(t => t.Type == Tile.TileType.Red) ? 1 : 0;
        int  blueExists   = sets.Exists(t => t.Type == Tile.TileType.Blue) ? 1 : 0;
        int  yellowExists = sets.Exists(t => t.Type == Tile.TileType.Yellow) ? 1 : 0;
        int  whiteExists  = sets.Exists(t => t.Type == Tile.TileType.White) ? 1 : 0;
        bool dragonExists = sets.Exists(t => t.Type == Tile.TileType.Dragon);

        int numColors = redExists + blueExists + yellowExists + whiteExists;

        bool valid = sets.Count == 3 && numColors == 1 && !dragonExists;

        return(valid);
    }
예제 #9
0
    public override bool HandHasCombination(List <Tile> tiles, HandCombination.CompletionType compType)
    {
        List <Tile> sets = Tile.ReturnGroupedTiles(tiles);

        bool identicalFound = false;

        for (int i = 0; i < sets.Count; ++i)
        {
            Tile tile = sets[i];
            for (int j = 0; j < sets.Count; ++j)
            {
                if (i == j)
                {
                    continue;
                }

                Tile otherTile = sets[j];

                if (tile.IsSame(otherTile))
                {
                    identicalFound = true;
                    break;
                }
            }

            if (identicalFound)
            {
                break;
            }
        }


        bool valid = sets.Count == 3 && identicalFound;

        return(valid);
    }
예제 #10
0
 public CompleteHandDecision(Player player, Game game, HandCombination.CompletionType compType) : base(player, game)
 {
     this.compType = compType;
 }