Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/ShrimpCryptid/Secret-Hitler-Online
/ functions
Functions
258 in github.com/ShrimpCryptid/Secret-Hitler-Online
⨍
Functions
258
◇
Types & classes
59
↓ 24 callers
Method
add
Adds the given Policy to the top of the deck. @param newPolicy the Policy to add to the deck. @modifies this @effects adds the given Policy to the dec
backend/src/main/java/game/datastructures/Deck.java:46
↓ 22 callers
Method
getState
Gets the current state of the game.SecretHitlerGame. @return a game.GameState representing the current state of the game.
backend/src/main/java/game/SecretHitlerGame.java:345
↓ 18 callers
Method
getUsername
()
backend/src/main/java/game/datastructures/Player.java:32
↓ 17 callers
Method
getPlayerList
Gets the list of active players. @return a copy of the list of Players.
backend/src/main/java/game/SecretHitlerGame.java:243
↓ 16 callers
Method
remove
Removes the Policy from the top of the deck. @throws IndexOutOfBoundsException if the deck is empty. @modifies this @effects removes the Policy from t
backend/src/main/java/game/datastructures/Deck.java:33
↓ 15 callers
Method
chooseRandomPlayerWeighted
Returns the name of a player, chosen by weighted random. Weighting is determined by suspected or known roles, and can be biased towards or away from u
backend/src/main/java/game/CpuPlayer.java:645
↓ 15 callers
Method
getCurrentPresident
()
backend/src/main/java/game/SecretHitlerGame.java:108
↓ 15 callers
Method
getIdentity
()
backend/src/main/java/game/datastructures/Player.java:47
↓ 14 callers
Method
getType
()
backend/src/main/java/game/datastructures/Policy.java:19
↓ 14 callers
Method
isAlive
()
backend/src/main/java/game/datastructures/Player.java:67
↓ 13 callers
Method
game
Returns the current game. @throws RuntimeException if called when there is no active game ({@code !this.isInGame()}). @retur
backend/src/main/java/server/util/Lobby.java:517
↓ 12 callers
Method
getPlayer
(String username)
backend/src/main/java/game/SecretHitlerGame.java:263
↓ 10 callers
Method
tryGetIndexOfPolicy
Gets the index of the first policy of a matching type, if it exists. Returns -1 otherwise.
backend/src/main/java/game/CpuPlayer.java:376
↓ 9 callers
Method
getNumFascistPolicies
Gets the count of fascist policies. @return the number of fascist policies enacted.
backend/src/main/java/game/datastructures/board/Board.java:69
↓ 8 callers
Method
getCurrentChancellor
()
backend/src/main/java/game/SecretHitlerGame.java:112
↓ 8 callers
Method
initialize
(SecretHitlerGame game)
backend/src/main/java/game/CpuPlayer.java:55
↓ 8 callers
Method
verifyIsPresident
Verifies that the user is the president. @param name String name of the user. @param lobby the Lobby that the game is in. @throws RuntimeException i
backend/src/main/java/server/SecretHitlerServer.java:727
↓ 7 callers
Method
getSize
Gets the number of Policy cards @return the size of the deck.
backend/src/main/java/game/datastructures/Deck.java:68
↓ 6 callers
Method
chancellorEnactPolicy
Enacts the Policy in the list of chancellor policy options. @param index the index of the policy in the list of legislative choices to e
backend/src/main/java/game/SecretHitlerGame.java:749
↓ 6 callers
Method
isEmpty
()
backend/src/main/java/game/datastructures/Deck.java:60
↓ 6 callers
Method
isInGame
Returns whether the Lobby is currently in a game. @return true iff the Lobby has a currently active game.
backend/src/main/java/server/util/Lobby.java:445
↓ 6 callers
Method
makePlayers
(int numPlayers)
backend/src/test/java/game/testCpuPlayer.java:23
↓ 6 callers
Method
updateReputation
(String name, int repModifier)
backend/src/main/java/game/CpuPlayer.java:99
↓ 5 callers
Method
concludePresidentialActions
Called when the president's actions are over. @modifies this @effects advances the state to {@code POST_LEGISLATIVE}.
backend/src/main/java/game/SecretHitlerGame.java:577
↓ 5 callers
Method
getPlayerOfIdentity
(SecretHitlerGame game, Identity id)
backend/src/test/java/game/testCpuPlayer.java:31
↓ 5 callers
Method
hasPlayer
Checks if the game has a player with the given username. @param username the String username of the player to search for. @return true iff the player
backend/src/main/java/game/SecretHitlerGame.java:226
↓ 5 callers
Method
isFascist
@return true if the player is fascist or hitler.
backend/src/main/java/game/datastructures/Player.java:76
↓ 5 callers
Method
isFascistInDanger
(SecretHitlerGame game)
backend/src/main/java/game/CpuPlayer.java:186
↓ 5 callers
Method
updateAllUsers
Sends a message to every connected user with the current game state. @effects a message containing a JSONObject representing the state of the
backend/src/main/java/server/util/Lobby.java:293
↓ 4 callers
Method
act
Allows CpuPlayers to take an action, potentially updating the game state. @return Returns true if the CPU took an action that updated the game state.
backend/src/main/java/game/CpuPlayer.java:152
↓ 4 callers
Method
canHitlerWinByElection
(SecretHitlerGame game)
backend/src/main/java/game/CpuPlayer.java:194
↓ 4 callers
Method
getClassName
* Darkens the text, images, and background if disabled and highlights the player. * @return {String} If {@code this.props.disabled} is true, the
frontend/src/player/Player.js:80
↓ 4 callers
Method
getIndexWithDefault
* Gets the value at an index of an array, defaulting if the value is too large or small. * @param array the array to get data from. * @param
frontend/src/custom-alert/RoleAlert.js:79
↓ 4 callers
Method
getPlayerOrder
* Returns an array representing the player order. Removes the player if this.props.includeUser is false.
frontend/src/player/PlayerDisplay.js:127
↓ 4 callers
Method
hasUser
Returns whether the given user (websocket connection) is in this lobby @param context the Websocket context of a user. @return true iff the {@code co
backend/src/main/java/server/util/Lobby.java:104
↓ 4 callers
Method
isHitler
()
backend/src/main/java/game/datastructures/Player.java:59
↓ 4 callers
Method
presidentialVeto
Handles the president's response to an initiated veto. @param response is the president's vote (true = veto accepted, false = veto de
backend/src/main/java/game/SecretHitlerGame.java:803
↓ 4 callers
Method
removeDeadPlayersAndSelf
(List<Player> playerList)
backend/src/main/java/game/CpuPlayer.java:213
↓ 4 callers
Method
shuffle
Shuffles the deck. @effects Randomizes the ordering of the policy cards in this Deck.
backend/src/main/java/game/datastructures/Deck.java:76
↓ 4 callers
Method
voteWithProbability
(SecretHitlerGame game, float yesProbability)
backend/src/main/java/game/CpuPlayer.java:271
↓ 3 callers
Method
canAddUserDuringGame
Checks if a user can be added back to the lobby while a game is running. @param name the name of the user to add. @return true if the user can be add
backend/src/main/java/server/util/Lobby.java:139
↓ 3 callers
Method
chancellorVeto
Marks the chancellor as having vetoed the current policy agenda. @throws IllegalStateException if called when the state is not
backend/src/main/java/game/SecretHitlerGame.java:772
↓ 3 callers
Method
convertPolicyListToStringArray
Converts a list of policies into a string array. @param list the list of policies. @return a string array with the same length as the list, where each
backend/src/main/java/server/util/GameToJSONConverter.java:108
↓ 3 callers
Method
didElectionTrackerAdvance
()
backend/src/main/java/game/SecretHitlerGame.java:148
↓ 3 callers
Method
didVetoOccurThisTurn
()
backend/src/main/java/game/SecretHitlerGame.java:152
↓ 3 callers
Method
getChancellorLegislativeChoices
Gets the legislative choices available for the Chancellor. @throws IllegalStateException if called when the state is not
backend/src/main/java/game/SecretHitlerGame.java:721
↓ 3 callers
Method
getDrawSize
()
backend/src/main/java/game/SecretHitlerGame.java:128
↓ 3 callers
Method
getLastEnactedType
Gets the type of the last enacted policy. @throws NullPointerException if no policy has been enacted yet. @return the Policy.Type of the last policy e
backend/src/main/java/game/datastructures/board/Board.java:57
↓ 3 callers
Method
getNumFascistPolicies
()
backend/src/main/java/game/SecretHitlerGame.java:140
↓ 3 callers
Method
getNumLiberalPolicies
Gets the count of liberal policies. @return the number of liberal policies enacted.
backend/src/main/java/game/datastructures/board/Board.java:78
↓ 3 callers
Method
getPlayerHTML
* Gets the HTML tags for the players in the provided indices. * @param start {int} the starting index, inclusive. * @param end {int} the end
frontend/src/player/PlayerDisplay.js:149
↓ 3 callers
Method
hasBeenInvestigated
()
backend/src/main/java/game/datastructures/Player.java:71
↓ 3 callers
Method
hasUserWithName
Returns true if the lobby has a user with a given username. @param name the username to check the Lobby for. @return true iff the username {@code nam
backend/src/main/java/server/util/Lobby.java:126
↓ 3 callers
Method
indexOfPlayer
Gets the index of a player in the list. @param username the username to search for. @return the index of the given player in the list. Returns -1 if
backend/src/main/java/game/SecretHitlerGame.java:254
↓ 3 callers
Method
isFull
Checks whether the lobby is full. @return Returns true if the number of players in the lobby is {@literal >= } {@code SecretHitlerGame.MAX_PL
backend/src/main/java/server/util/Lobby.java:150
↓ 3 callers
Method
nominateChancellor
Selects the chancellor for the current legislation. @param username username of the chancellor to elect. @throws IllegalStateException if the stat
backend/src/main/java/game/SecretHitlerGame.java:431
↓ 3 callers
Method
peek
Peeks at a Policy in the deck. @param index the index of the Policy in the deck, where {@code index} = 0 is the top of the deck. @throws IndexOutOfBou
backend/src/main/java/game/datastructures/Deck.java:56
↓ 3 callers
Method
removeInactiveLobbies
Checks for and removes any lobbies that have timed out. @effects For each lobby in the {@code codeToLobby} map, checks if the lobby has time
backend/src/main/java/server/SecretHitlerServer.java:173
↓ 3 callers
Method
setIdentity
Sets the player's identity. @param id the Identity of the player. @throws IllegalArgumentException if {@code id} is null @modifies this @effects sets
backend/src/main/java/game/datastructures/Player.java:43
↓ 3 callers
Method
shuffleDiscardIntoDraw
Adds the discard deck to the draw deck and shuffles. @modifies this @effects Empties the discard pile into the draw pile and shuffles.
backend/src/main/java/game/SecretHitlerGame.java:394
↓ 3 callers
Method
trySetUserIcon
Attempts to set the player's icon to the given iconID and returns whether it was set. @param iconID the ID of the new icon to give the player. @param
backend/src/main/java/server/util/Lobby.java:415
↓ 2 callers
Method
advanceElectionTracker
Advances the election tracker and enacts a policy if needed. @modifies this @effects If the tracker < 2, advances the tracker by 1. If the t
backend/src/main/java/game/SecretHitlerGame.java:549
↓ 2 callers
Method
capitalizeFirstOnly
* Capitalizes only the first character of the given text. * @param {String} text the text to capitalize. * @return {String} text where only
frontend/src/player/Player.js:58
↓ 2 callers
Method
electNextPresident
Sets the next president through the Election power. @param username the username of the player to become president next. @throws IllegalStateExceptio
backend/src/main/java/game/SecretHitlerGame.java:992
↓ 2 callers
Method
enactPolicy
Enacts the given policy. @param policy the Policy to enact. @throws IllegalStateException if the liberals or fascists have already won.
backend/src/main/java/game/datastructures/board/Board.java:39
↓ 2 callers
Method
endPeek
Ends the {@code PRESIDENTIAL_POWER_PEEK} state. @throws IllegalStateException if called when state is not {@code PRESID
backend/src/main/java/game/SecretHitlerGame.java:902
↓ 2 callers
Method
endPresidentialTerm
Called to end the current's president term. @throws IllegalStateException if the state is not {@code POST_LEGISLATIVE}. @modifies this @effects advan
backend/src/main/java/game/SecretHitlerGame.java:596
↓ 2 callers
Method
executePlayer
Executes a given player. @param username the username of the player to execute. @throws IllegalStateException if called when state is not
backend/src/main/java/game/SecretHitlerGame.java:956
↓ 2 callers
Method
generateCode
Generates a random code. @return a String code, with length specified by {@code this.CODE_LENGTH} and characters randomly chosen from
backend/src/main/java/server/SecretHitlerServer.java:460
↓ 2 callers
Method
getActivatedPower
Gets the presidential power (if any) that was activated by the last policy. @requires a policy has already been enacted. @return If no presidential po
backend/src/main/java/game/datastructures/board/Board.java:116
↓ 2 callers
Method
getClass
()
frontend/src/status-bar/StatusBar.js:30
↓ 2 callers
Method
getDatabaseConnection
Attempts to get a connection to the PostGres database. @return null if no connection could be made. otherwise, returns a {@code java.sql.Conn
backend/src/main/java/server/SecretHitlerServer.java:207
↓ 2 callers
Method
getDiscardSize
()
backend/src/main/java/game/SecretHitlerGame.java:132
↓ 2 callers
Method
getLastChancellor
()
backend/src/main/java/game/SecretHitlerGame.java:120
↓ 2 callers
Method
getLastEnactedPolicy
()
backend/src/main/java/game/SecretHitlerGame.java:124
↓ 2 callers
Method
getLastPresident
()
backend/src/main/java/game/SecretHitlerGame.java:116
↓ 2 callers
Method
getLivingPlayerCount
()
backend/src/main/java/game/SecretHitlerGame.java:406
↓ 2 callers
Method
getNameWithYouTag
* Returns the name of the player, with an optional " (you)" tag if {@code this.props.isUser.}
frontend/src/player/Player.js:128
↓ 2 callers
Method
getNextActivePlayer
Finds the next active, living player in order. @param player the player to find the next active player from. @return the username of the next player
backend/src/main/java/game/SecretHitlerGame.java:632
↓ 2 callers
Method
getPeek
Gets the preview of the top 3 cards of the deck during the {@code PRESIDENTIAL_POWER_PEEK} state. @throws IllegalStateException if called when state
backend/src/main/java/game/SecretHitlerGame.java:882
↓ 2 callers
Method
getPlayerReputationWithIdentity
Gets the player reputation, setting to min/max value if identity is known.
backend/src/main/java/game/CpuPlayer.java:280
↓ 2 callers
Method
getPresidentLegislativeChoices
Gets the legislative choices available for the President. @throws IllegalStateException if called when the state is not
backend/src/main/java/game/SecretHitlerGame.java:679
↓ 2 callers
Method
getRoleID
* Determine the role ID of the player. * @return the number of players with the same role that appear before the player. Otherwise, defaults to 0
frontend/src/custom-alert/RoleAlert.js:91
↓ 2 callers
Method
getRound
Gets the current round number. The round is incremented whenever it's a new president's turn, starting at 1 at the start of the game.
backend/src/main/java/game/SecretHitlerGame.java:356
↓ 2 callers
Method
hasGameFinished
Returns whether the game has reached an ending victory state.
backend/src/main/java/game/SecretHitlerGame.java:381
↓ 2 callers
Method
investigatePlayer
Investigates the party identity of a given player. @param username the username of the player to investigate. @throws IllegalStateException if cal
backend/src/main/java/game/SecretHitlerGame.java:919
↓ 2 callers
Method
isFascistVictory
Determines whether the fascist party won by policy count. @return true if the number of Fascist Policies {@literal >=} {@code FASCIST_POLICIES_TO_WIN}
backend/src/main/java/game/datastructures/board/Board.java:96
↓ 2 callers
Method
isLiberalVictory
Determines whether the liberal party won by policy count. @return true if the number of Liberal Policies {@literal >=} {@code LIBERAL_POLICIES_TO_WIN}
backend/src/main/java/game/datastructures/board/Board.java:87
↓ 2 callers
Method
markAsCpu
()
backend/src/main/java/game/datastructures/Player.java:51
↓ 2 callers
Method
onEnactPolicy
Called AFTER a policy has been enacted, and sets the state according to any consequences. @modifies this @effects sets the state to handle any presid
backend/src/main/java/game/SecretHitlerGame.java:832
↓ 2 callers
Method
presidentDiscardPolicy
Discards the Policy in the list of presidential policy options. @param index the index of the policy in the list of legislative choices to
backend/src/main/java/game/SecretHitlerGame.java:701
↓ 2 callers
Function
registerValidSW
(swUrl, config)
frontend/src/serviceWorker.js:57
↓ 2 callers
Method
registerVote
Registers a vote for chancellor from a given player. @param username the name of the player giving the vote. @param vote the vote of the player (
backend/src/main/java/game/SecretHitlerGame.java:484
↓ 2 callers
Method
removePlayerFromList
(String username, List<Player> playerList)
backend/src/main/java/game/CpuPlayer.java:198
↓ 2 callers
Method
resetTimeout
Resets the internal timeout for this lobby. @effects The lobby will time out in {@code TIMEOUT_DURATION_MS} ms from now.
backend/src/main/java/server/util/Lobby.java:70
↓ 2 callers
Method
storeDatabaseBackup
()
backend/src/main/java/server/SecretHitlerServer.java:293
↓ 2 callers
Method
update
Allows the CpuPlayer to update assumptions after legislation is passed. @param game
backend/src/main/java/game/CpuPlayer.java:111
↓ 2 callers
Method
updateUser
Sends a message to the specified user with the current game state. @param ctx the WsContext websocket context. @effects a message containing a JSONOb
backend/src/main/java/server/util/Lobby.java:368
↓ 2 callers
Method
verifyIsChancellor
Verifies that the user is the chancellor. @param name String name of the user. @param lobby the Lobby that the game is in. @throws RuntimeException
backend/src/main/java/server/SecretHitlerServer.java:740
↓ 1 callers
Method
addUser
Adds a user (websocket connection) to the lobby. @param context the websocket connection context. @param name the name of the player to be added.
backend/src/main/java/server/util/Lobby.java:170
next →
1–100 of 258, ranked by callers