cicada.interactive module
Functionality for user interaction.
- cicada.interactive.secret_input(*, communicator, src, prompt=None, dtype=<class 'float'>, timeout=300)[source]
Prompt one user for a secret.
Note
Although this function only prompts one player for input, it is a collective operation that must be called by all players that are members of communicator.
- Parameters:
communicator (
Communicator
, required) – Used to coordinate among players.src (
int
, required) – Rank of the player who will be prompted for a secret.prompt (
str
, optional) – Override the default interactive prompt. Seeinput()
for usage.dtype (
callable()
, optional) – Function for parsing user input into a final value. The function must take onestr
argument and return a result. The builtin functionsint
,float
, andstr
are useful examples.timeout (
numbers.Number
, optional) – Maximum time to wait for user input, in seconds. Defaults to 300 seconds.
- Returns:
value – For player src: the secret input. For all other players:
None
.- Return type: