Search in sources :

Example 1 with SwissPairingSimple

use of mage.game.tournament.pairing.SwissPairingSimple in project mage by magefree.

the class TournamentSwiss method createRoundSwiss.

protected Round createRoundSwiss() {
    List<TournamentPlayer> roundPlayers = getActivePlayers();
    boolean isLastRound = (rounds.size() + 1 == getNumberRounds());
    Round round = null;
    if (options.matchOptions.getNumSeats() == 2) {
        RoundPairings roundPairings;
        if (roundPlayers.size() <= 16) {
            SwissPairingMinimalWeightMatching swissPairing = new SwissPairingMinimalWeightMatching(roundPlayers, rounds, isLastRound);
            roundPairings = swissPairing.getRoundPairings();
        } else {
            SwissPairingSimple swissPairing = new SwissPairingSimple(roundPlayers, rounds);
            roundPairings = swissPairing.getRoundPairings();
        }
        round = new Round(rounds.size() + 1, this);
        rounds.add(round);
        for (TournamentPairing pairing : roundPairings.getPairings()) {
            round.addPairing(pairing);
        }
        for (TournamentPlayer playerBye : roundPairings.getPlayerByes()) {
            // player free round - add to bye players of this round
            round.getPlayerByes().add(playerBye);
            if (isLastRound) {
                playerBye.setState(TournamentPlayerState.FINISHED);
            } else {
                playerBye.setState(TournamentPlayerState.WAITING);
            }
            playerBye.setStateInfo("Round Bye");
            updateResults();
        }
    }
    return round;
}
Also used : RoundPairings(mage.game.tournament.pairing.RoundPairings) SwissPairingSimple(mage.game.tournament.pairing.SwissPairingSimple) SwissPairingMinimalWeightMatching(mage.game.tournament.pairing.SwissPairingMinimalWeightMatching)

Example 2 with SwissPairingSimple

use of mage.game.tournament.pairing.SwissPairingSimple in project mage by magefree.

the class TournamentSwiss method createMultiplayerRound.

public MultiplayerRound createMultiplayerRound() {
    List<TournamentPlayer> roundPlayers = getActivePlayers();
    boolean isLastRound = (rounds.size() + 1 == getNumberRounds());
    MultiplayerRound round = null;
    if (options.matchOptions.getNumSeats() > 2) {
        options.matchOptions.setAttackOption(MultiplayerAttackOption.MULTIPLE);
        RoundPairings roundPairings;
        if (roundPlayers.size() <= 16) {
            SwissPairingMinimalWeightMatching swissPairing = new SwissPairingMinimalWeightMatching(roundPlayers, rounds, isLastRound);
            roundPairings = swissPairing.getRoundPairings();
        } else {
            SwissPairingSimple swissPairing = new SwissPairingSimple(roundPlayers, rounds);
            roundPairings = swissPairing.getRoundPairings();
        }
        round = new MultiplayerRound(rounds.size() + 1, this, options.matchOptions.getNumSeats());
        for (TournamentPairing pairing : roundPairings.getPairings()) {
            round.addPairing(pairing);
        }
    }
    return round;
}
Also used : RoundPairings(mage.game.tournament.pairing.RoundPairings) SwissPairingSimple(mage.game.tournament.pairing.SwissPairingSimple) SwissPairingMinimalWeightMatching(mage.game.tournament.pairing.SwissPairingMinimalWeightMatching)

Aggregations

RoundPairings (mage.game.tournament.pairing.RoundPairings)2 SwissPairingMinimalWeightMatching (mage.game.tournament.pairing.SwissPairingMinimalWeightMatching)2 SwissPairingSimple (mage.game.tournament.pairing.SwissPairingSimple)2