Sample code - get SD tricks

'---VB.Net code example to get SD tricks:


Dim position, partner_position, position_to_modyfy As Integer

Dim SD_tricks() As Integer

Dim percentages() as Integer

'---structure hand must be previously declared as:

'Private Structure TYPE_HAND

'     Dim suit() As String

'End Structure

Dim Player As Object

Dim hand() As TYPE_HAND

Dim info() As Integer

Const F_MIN_HCP As Integer = 102

Const F_MAX_HCP As Integer = 103

Const C_CLUBS As Integer = 0

Const C_DIAMONDS As Integer = 1

Const C_HEARTS As Integer = 2

Const C_SPADES As Integer = 3


'Player = New EPBot32.EPBot

Player = New EPBot86.EPBot

'Player = New EPBot64.EPBot


ReDim hand(3)

For k = 0 To 3

ReDim hand(k).suit(3)

Next


position = 0 '--- (0-3)

partner_position = (position + 2) mod 4


hand(position).suit(3) = "KQ72"

hand(position).suit(2) = "K"

hand(position).suit(1) = "AT32"

hand(position).suit(0) = "AK53"


hand(partner_position).suit(3) = "J43"

hand(partner_position).suit(2) = "AJ98"

hand(partner_position).suit(1) = "Q96"

hand(partner_position).suit(0) = "942"


With Player

 '---set hand for the position 

  .new_hand(position, hand(position).suit, 0, 0)


  '---store existing info() from player = position about player = position_to_modyfy

  info() = .info_feature(position_to_modyfy)

  '---modify info()

  info(F_MIN_HCP) = 13

  info(F_MAX_HCP) = 15

  '---update info() for player = position about player = position_to_modyfy

  .info_feature(position_to_modyfy) = info()


  '---store existing info() from player = position about player = position_to_modyfy

  info() = .info_min_length(position_to_modyfy)

  '---modify info()

  info(C_CLUBS) = 2

  info(C_HEARTS) = 2

  '---update info() for player = position about player = position_to_modyfy

  .info_min_length(position_to_modyfy) = info()


'---get an arrays tricks() and percentages()

  '---if the bidding has already started, the probable number of tricks is returned using the information obtained about the opponents

SD_tricks() = .get_SD_tricks(hand(partner_position).suit(), percentages())


End With