Package toDesk.src.tournament.formats
Class DElim
java.lang.Object
toDesk.src.tournament.formats.DElim
- Since:
- 4/01/2024 purpose: This class simulates a double elimination bracket. Each match contains 2 players, and every player starts on the upper bracket. Winners advance through the upper bracket, and losers are sent to the lower bracket.
- Version:
- 1.0
- Author:
- Calvin Ocampo
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassPurpose: This class represents an individual match. -
Method Summary
Modifier and TypeMethodDescriptionvoidadvancePlayer(int matchIndex, PlayerEntry winner) Advances a player through the bracket by sending the winning player to the next available match in the list and the losing player to the lower bracket OR eliminating themvoidcreateUpperBracket(ArrayList<PlayerEntry> playerEntries) Creates the upper bracketvoidPrints the lower bracket.voidPrints the upper bracket.static DElimvoidupdateMatchScore(int matchIndex, int player1Score, int player2Score) Updates the score of a match object
-
Method Details
-
getInstance
-
createUpperBracket
Creates the upper bracket- Parameters:
playerEntries- is an existing list of players
-
updateMatchScore
public void updateMatchScore(int matchIndex, int player1Score, int player2Score) Updates the score of a match object- Parameters:
matchIndex- the index of a match in the bracketplayer1Score- is the score of the 1st playerplayer2Score- is the score of the 2nd player
-
advancePlayer
Advances a player through the bracket by sending the winning player to the next available match in the list and the losing player to the lower bracket OR eliminating them- Parameters:
matchIndex- is the index of the match to be modifiedwinner- is the player who won the match
-
displayUpperBracket
public void displayUpperBracket()Prints the upper bracket. -
displayLowerBracket
public void displayLowerBracket()Prints the lower bracket.
-