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. See input() for usage.

  • dtype (callable(), optional) – Function for parsing user input into a final value. The function must take one str argument and return a result. The builtin functions int, float, and str 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:

object or None