endplay.interact.frontends.cmd

A shell-like interface to many of the features of endplay including dealing hands and performing double-dummy analysis.

Classes:

CmdFrontend(deal[, verbose_errors])

class endplay.interact.frontends.cmd.CmdFrontend(deal: InteractiveDeal, verbose_errors=False)

Bases: Cmd

Methods:

cmdloop([intro])

Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.

do_analyse(arg)

If no arguments are provided, display the double dummy results of playing each card in the hand currently on lead.

do_board(arg)

If no argument is provided, display the board number.

do_checkpoint(arg)

Erase the undo history so that reset will take you back to this point

do_ddtable(arg)

Calculate the double dummy table for the current deal

do_display(arg)

Displays the current deal

do_exit(arg)

Exits the interaction

do_first(arg)

If no argument is provided, display the position of the player to play the first card to the current trick.

do_hcp(arg)

do_history(arg)

Print the undo history.

do_par(arg)

Calculate the par contract and score for the board using the first player as the dealer

do_pbn(arg)

Displays the current deal as a PBN string

do_play(arg)

Play the listed cards.

do_redeal(arg)

Redeal the hand to the given PBN string (or an empty string for a blank deal) Example 1: redeal Example 2: redeal N:95..A.

do_reset(arg)

Reset the deal to its original state

do_set(arg)

Set a hand to given PBN string Example: set S AQ85.532..JT92 No error checking for duplicate cards or incorrect number of cards is performed.

do_shuffle(arg)

Generate a random deal satisfying the given constraints.

do_solve(arg)

Display the double-dummy maximum number of tricks playing each card in the current player's hand can yield.

do_trump(arg)

If no argument is provided, display the trump suit of the current deal.

do_undo(arg)

Undo the previous action, if it changed the current deal

emptyline()

Called when an empty line is entered in response to the prompt.

interact()

onecmd(line)

Interpret the argument as though it had been typed in response to the prompt.

postcmd(stop, line)

Hook method executed just after a command dispatch is finished.

cmdloop(intro=None)

Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.

do_analyse(arg)

If no arguments are provided, display the double dummy results of playing each card in the hand currently on lead. If a list of cards are provided, display the double dummy results for each card as it is played

do_board(arg)

If no argument is provided, display the board number. If a number is given, set the board number to this. Set to 0 to disable the board number. Example 1: board Example 2: board 12

do_checkpoint(arg)

Erase the undo history so that reset will take you back to this point

do_ddtable(arg)

Calculate the double dummy table for the current deal

do_display(arg)

Displays the current deal

do_exit(arg)

Exits the interaction

do_first(arg)

If no argument is provided, display the position of the player to play the first card to the current trick. If a position is given, set that seat to be on lead Example 1: first Example 2: first W

do_hcp(arg)
do_history(arg)

Print the undo history. Accepts an integer with the maximum number of actions to show

do_par(arg)

Calculate the par contract and score for the board using the first player as the dealer

do_pbn(arg)

Displays the current deal as a PBN string

do_play(arg)

Play the listed cards. Example 1: play SA Example 2: play HQ S5 H2

do_redeal(arg)

Redeal the hand to the given PBN string (or an empty string for a blank deal) Example 1: redeal Example 2: redeal N:95..A. 8.5.Q. .QT5.. Q..T4.

do_reset(arg)

Reset the deal to its original state

do_set(arg)

Set a hand to given PBN string Example: set S AQ85.532..JT92 No error checking for duplicate cards or incorrect number of cards is performed.

do_shuffle(arg)

Generate a random deal satisfying the given constraints. Example 1: shuffle Example 2: shuffle hcp(north) > hcp(south)

do_solve(arg)

Display the double-dummy maximum number of tricks playing each card in the current player’s hand can yield.

do_trump(arg)

If no argument is provided, display the trump suit of the current deal. If a suit is given, set the trump suit to this. Example 1: trump Example 2: trump NT

do_undo(arg)

Undo the previous action, if it changed the current deal

emptyline()

Called when an empty line is entered in response to the prompt.

If this method is not overridden, it repeats the last nonempty command entered.

interact()
onecmd(line)

Interpret the argument as though it had been typed in response to the prompt.

This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop.

postcmd(stop, line)

Hook method executed just after a command dispatch is finished.