What's New ( click here for news and updates )

Advanced Shark Robot Instructions October 2022

You can add special robot instructions to your hands in the Console library. Select a deal in your library and open the Robot tab. Save once you enter your instructions. 





-----

XML jargon: 

  • "Tag" -- something that starts with "<" and ends with ">".  There are three types of tags:
    •  start-tags, such as <openingBook>
    •  end-tags, such as </openingBook>
    •  empty-element tags, such as <guidedPlay currentPlayer="w" />
  • "Element" -- something that either starts with a start-tag and ends with a matching end-tag, or is simply an empty-element tag.
  • "Attribute" -- a name and a value that occur within either a start-tag or an empty-element tag.  In <guidedPlay currentPlayer="w" />, the name is "currentPlayer" and the value is "w".  A tag may have multiple attributes, but the names of all of the attributes in a single tag must be different. 

-----

Use T for Ten.

... in this reading means empty space of some attribute. Do not use when writing your instructions. 

-----

<openingBook>S2 SA SQ S4 S9 SJ C3 CJ</openingBook>

OR

<openingBook special="true">SA S3 S2 S5 SK S6 S4</openingBook>

This tag indicates to the Robot plays that should be made immediately at the beginning of the deal. The first card in the opening book is the opening lead.
There are two types of opening books.If the human is declarer, a normal opening book is used, indicated by the lack of a special="true" attribute.  For example, assuming South is declarer, in this case, the opening book gives the sequence of plays by West and East in the order that they are made, omitting any plays by North and South. Thus <openingBook>S2 SA SQ S4 S9 SJ C3 CJ</openingBook> indicates that West will lead the S2 to the first trick, and East will win the SA; East will lead the SQ to the second trick, and West will follow with the S4; East will lead the S9 to the third trick, and West will follow with the SJ; and West will lead the C3 to the fourth trick, and East will follow with the CJ.  This will all occur regardless of North's and South's plays, so the opening book can only be used for as long as North's and South's plays are irrelevant to the defense's plays. Thus there can be an odd number of plays in the opening book; in fact, if East's play to the first trick depends on North's play to the first trick, the opening book will have but a single card, such as <openingBook>CQ</openingBook>. If the human is a defender (or if we are playing a game without a dummy, such as whist), a special opening book is used, indicated by the special="true" attribute.  In this case, the opening book gives the sequence of plays for all four players in the order that they are made, including plays for the human.  The program ignores the listed plays for the human, of course, and the human can make any plays; those plays are in the XML file solely for the convenience of the XML writer.  Thus, supposing that West is the declarer, <openingBook special="true">SA S3 S2 S5 S4 S6</openingBook> indicates that North will lead the SA to the first trick, East will play the S3 to the first trick, and after South plays (possibly the S2, possibly not), West will play the S5 to the first trick.  Then North will lead the S4 to the second trick, East will play the S6 to the second trick, and that concludes the opening book.
There should be only one <openingBook>...</openingBook> element in each board.  If the human sits on declarer's left and thus is on lead at trick 1, the <openingBook/> element should obviously be omitted.

 

The <openingBook>...</openingBook> element is the only element of the that begins with a start-tag and ends with a matching end-tag.  All of the other elements are simply empty-element tags.

 -----

Examples of <guidedPlay> tag

  • <guidedPlay currentPlayer="e" numTricks="1" numPlays="0" card="D7" />
  • <guidedPlay currentPlayer="w" numPlays="0" playerRanks="WHJT6" card="HT" />
  • <guidedPlay currentPlayer="e" numPlays="1" thisTrickSuit="0S" playerRanks="ESA2" maxPlayerRanks="WS4" card="SA" />
  • <guidedPlay currentPlayer="e" numPlays="1" thisTrickSuit="0D" maxThisTrickRank="07" maxPlayerRanks="ND632" minPlayerRanks="WDJ" maxLedLen="0" card="C6" />`
  • <guidedPlay currentPlayer="e" minNumPlays="1" minLen="3H" maxLedLen="0" card="HT" />
  • <guidedPlay currentPlayer="e" minNumPlays="1" playerLen="N4SE0H" minPlayerLen="E3C" maxLedLen="0" card="C9" />
  • <guidedPlay currentPlayer="e" numPlays="1" thisTrickSuit="0S" maxThisTrickRank="08" minPlayerRanks="WSKESQT9" card="S9" />
  • <guidedPlay currentPlayer="e" minNumPlays="1" maxLedLen="0" maxPlayerLen="E4DE0S" card="H7" />
  • <guidedPlay currentPlayer="e" numPlays="2" thisTrickSuit="0C1C" minThisTrickRank="0T" maxThisTrickRank="19" card="C7" />
  • <guidedPlay currentPlayer="e" numPlays="2" thisTrickSuit="0C1C" thisTrickRank="1K" card="CA" />

Each <guidedPlay ... /> empty-element tag describes a particular card that a player should play, and a particular set of constraints on the situations in which that player should play that card.  The player, the card, and the constraints are all expressed as attributes of the <guidedPlay ... /> empty-element tag.  These attributes are as follows.

----- 

<guidedPlay currentPlayer="w" ... />

<guidedPlay currentPlayer="e" ... />

We strongly suggest to always 'currentPlayer' attribute.  

The currentPlayer attribute, with values "n", "e", "s" (only if the human is not sitting South), and "w", constrains the situations in which the indicated card may be played to require that the given player is on play.  Generally, every <guidedPlay ... /> empty-element tag should have a currentPlayer attribute.

-----

<guidedPlay auction="1N-X-3N" ... />

The 'auction' attribute constrain the situations in which the indicated card may be played based on auction. 
Auction does not need to be complete, it could just be any fragment of an auction. In the example dealer passed and then we only provide 2nd, 3rd and 4th seat. This is useful to change the lead based on auction. 
NOTE: 
NT is represented with just N
X for double
R for re-double
P for pass
'-' is optional , it improves human readability. 

-----

<tip a="P-1N-P-2H" m="Some message" />
<alert a="P-1N-P-2H" m="Some message" />

Those tags work the same, 'alert' will add ! to the bid in the auction box. Anytime 2H bid is made by the human or the robot, and is preceded by P-1N-P the 'm' - message will be added to the chat box on the bottom left. The example will show a message If the auction goes P-1S-P-1N-P-2H or just P-1N-P-2H. 

-----

<guidedPlay ... minLedLen="1" ... />

<guidedPlay ... ledLen="2" ... />

<guidedPlay ... maxLedLen="5" ... />

<guidedPlay ...  ... />

These attributes constrain the situations in which the indicated card may be played based on the length of the current player in the led suit.  minLedLen="1" indicates that the current player has at least one card in the led suit.  ledLen="2" indicates that the current player has exactly two cards in the led suit.  maxLedLen="5" indicates that the current player has at most five cards in the led suit. maxLedLen="0" is very common (or the equivalent ledLen="0"), indicating that the player is void in the led suit.

-----

<guidedPlay ... minNumPlays="1" ... />

<guidedPlay ... numPlays="0" ... />

<guidedPlay ... maxNumPlays="2" ... />

 These attributes constrain the situations in which the indicated card may be played based on the number of plays that have been made to the current trick.  minNumPlays="1" indicates that at least one card has been played to the current trick, i.e., the current player is not on lead.  numPlays="0" indicates that no cards have been played to the current trick, i.e., the current player is on lead.  maxNumPlays="2" indicates that at most two cards have been played to the current trick, i.e., the current player is not the last to play to the trick.

 -----

<guidedPlay ... minNumTricks="3" ... />

<guidedPlay ... numTricks="1" ... />

<guidedPlay ... maxNumTricks="2" ... /> 

These attributes constrain the situations in which the indicated card may be played based on the number of tricks that have already been completed.  minNumTricks="3" indicates that at least three tricks have been completed, i.e., this is the fourth trick or later. numTricks="1" indicates that exactly one trick has been completed, i.e., this is the second trick.  maxNumTricks="2" indicates that either no tricks have been completed or one trick has been completed, i.e., this is the first trick or the second trick.

 -----

<guidedPlay ... minPlayerLen="E3C" ... />

<guidedPlay ... playerLen="N4SE0H" ... />

<guidedPlay ... maxPlayerLen="E4DE0S" ... />

These attributes constrain the situations in which the indicated card may be played based on the lengths of particular players' holdings in particular suits.  Multiple players and multiple suits may be specified in the value.  minPlayerLen="E3C" indicates that East has at least three clubs.  playerLen="N4SE0H" indicates that North has exactly four spades and East has exactly zero hearts.  maxPlayerLen="E4DE0S" indicates that East has at most four diamonds and at most zero spades.

-----

 <guidedPlay ... minPlayerRanks="WSKESQT9" ... />

<guidedPlay ... playerRanks="WHJT6" ... />

<guidedPlay ... maxPlayerRanks="ND632" ... />

These attributes constrain the situations in which the indicated card may be played based on the ranks of particular players' holdings in particular suits.  Multiple players and multiple suits may be specified in the value.  minPlayerRanks="WSKESQT9" indicates that West has a spade holding no worse than the King, and East has a spade holding no worse than the QT9.  playerRanks="WHJT6" indicates that West holds exactly the JT6 of hearts.  maxPlayerRanks="ND632" indicates that North has a diamond holding no better than the 632.

Ranks work as follows.  A indicates Ace, K King, Q Queen, and so forth, down to 2 for Two; use T for Ten.  The player's ranks in a particular suit are checked against the rank constraints.

Careful: this means, for example, that East with a singleton SA remaining satisfies minPlayerRanks="ESQT9", because Ace is greater than Queen,  Ten and Nine .

-----

 <guidedPlay ... minThisTrickRank="0T" ... />

<guidedPlay ... thisTrickRank="1K" ... />

<guidedPlay ... maxThisTrickRank="07" ... />

These attributes constrain the situations in which the indicated card may be played based on the ranks played to the current trick so far. Multiple seats may be specified in the value.  minThisTrickRank="0T" indicates that the card led to the trick was the Ten or higher. thisTrickRank="1K" indicates that the second card played to the trick was precisely the King.  maxThisTrickRank="07" indicates that the card led to the trick was the Seven or lower.  These attributes are frequently used in combination with the thisTrickSuit attribute.

-----

<guidedPlay ... thisTrickSuit="0S" ... /> 

<guidedPlay ... thisTrickSuit="0C1C" ... />

This attribute constrains the situations in which the indicated card may be played based on the suits played to the current trick so far. Multiple seats may be specified in the value.  thisTrickSuit="0S" indicates that a spade was led to the current trick. thisTrickSuit="0C1C" indicates that a club was led to the current trick, and the second card played to the current trick was also a club.  minThisTrickSuit and maxThisTrickSuit exist, but I can't imagine them ever being particularly useful (suits are, of course, clubs then diamonds then hearts then spades, in ascending order.) 

-----

<guidedPlay ... card="D7" />

This attribute indicates the card that may be played if all of the constraints specified in the other attributes have been fulfilled in the current situation.  It implicitly includes the constraint that the given player still holds that particular card.  It is perfectly fine for a card to appear in two or more different <guidedPlay ... /> empty-element tags element.

 -----

2 comments

  • Richard I agree a video, seminar, or even some real hand examples would be most welcome. I wouldn’t say it’s necessary to have high level of programming knowledge to use, as I certainly don’t, and with some email support I’ve been able to make Shark do most things I want.
    I am going to start making notes each time I figure out how to program something (e.g. if partner leads a high heart, return a spade when you get in), and when I get enough examples, maybe I’ll make a document or video for those interested if one hasn’t appeared from Shark.
    Maybe a teacher’s forum on this site would be good, for us to share ideas.

    Kevin Johnston
  • It is great you are adding controls over robot play. I give advanced lessons (sometimes very advanced), and the robots often do not give the best defense (currently, I often manually override). However, your instructions assume a high level of programming knowledge or understanding of computer language. MOst of the instructions you provide are meaningless to me.

    Perhaps you can run a training seminar or video on this sometime soon.

    Richard

    Richard A. Finberg

Leave a comment

Name .
.
Message .

Please note, comments must be approved before they are published