Skip to content

Short Index and Bridge Compass Displays

Compare
Choose a tag to compare
@folkengine folkengine released this 15 Dec 03:05
· 39 commits to main since this release

Added the ability to do Bridge Compass style displays:

❯ cargo run --example  bridge
   Compiling cardpack v0.4.3 (/Users/christoph/src/github.com/ContractBridge/cardpack.rs)
    Finished dev [unoptimized + debuginfo] target(s) in 1.97s
     Running `target/debug/examples/bridge`
First, let's deal out a Bridge hand:
                NORTH
             ♠ A K J T 4 2
             ♥ T 6 4
             ♦ J 4
             ♣ 7 4

       WEST                  EAST
    ♠ 3                   ♠ Q 7 6 5
    ♥ 5                   ♥ 9 8 7 2
    ♦ K Q T 9 8 6         ♦ 5 3
    ♣ K 9 6 5 2           ♣ Q 8 3

                 SOUTH
              ♠ 9 8
              ♥ A K Q J 3
              ♦ A 7 2
              ♣ A J T



We can also take the board and convert it to a Portable Bridge Notation Deal String:
[Deal "S:98.AKQJ3.A72.AJT 3.5.KQT986.K9652 AKJT42.T64.J4.74 Q765.9872.53.Q83"]


Now, let's take a PBN Deal String and convert it into Bridge hands (packs):
[Deal "S:Q42.Q52.AQT943.Q 97.AT93.652.T743 AJT85.J76.KJ.A65 K63.K84.87.KJ982"]

Let's print it out simply:
S: Q♠ 4♠ 2♠ Q♥ 5♥ 2♥ A♦ Q♦ T♦ 9♦ 4♦ 3♦ Q♣
W: 9♠ 7♠ A♥ T♥ 9♥ 3♥ 6♦ 5♦ 2♦ T♣ 7♣ 4♣ 3♣
N: A♠ J♠ T♠ 8♠ 5♠ J♥ 7♥ 6♥ K♦ J♦ A♣ 6♣ 5♣
E: K♠ 6♠ 3♠ K♥ 8♥ 4♥ 8♦ 7♦ K♣ J♣ 9♣ 8♣ 2♣

Let's print it out in a compass format:
                NORTH
             ♠ A J T 8 5
             ♥ J 7 6
             ♦ K J
             ♣ A 6 5

       WEST              EAST
    ♠ 9 7             ♠ K 6 3
    ♥ A T 9 3         ♥ K 8 4
    ♦ 6 5 2           ♦ 8 7
    ♣ T 7 4 3         ♣ K J 9 8 2

               SOUTH
            ♠ Q 4 2
            ♥ Q 5 2
            ♦ A Q T 9 4 3
            ♣ Q