summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichał Klichowicz <emkael@tlen.pl>2023-10-02 22:52:50 +0200
committerMichał Klichowicz <emkael@tlen.pl>2023-10-02 22:55:17 +0200
commitc16eb493bb130ad94ece708248235888c9224301 (patch)
tree258fe033eaa4becd0336576ae38ba95aa2850b76 /src
parentd930b2d1089ead6e27ff79364a474410abb0b444 (diff)
Lead card import
Diffstat (limited to 'src')
-rw-r--r--src/bcdd/PBNBoard.py5
-rw-r--r--src/main.py7
2 files changed, 11 insertions, 1 deletions
diff --git a/src/bcdd/PBNBoard.py b/src/bcdd/PBNBoard.py
index 6e1abf6..e76252d 100644
--- a/src/bcdd/PBNBoard.py
+++ b/src/bcdd/PBNBoard.py
@@ -166,6 +166,11 @@ class PBNBoard(object):
def get_auction(self):
return self.get_extended_raw_field('Auction', with_header=True)
+ def get_play_data(self):
+ if self.has_field('Play'):
+ return self.get_extended_raw_field('Play', with_header=False)
+ return None
+
def get_extended_raw_field(self, field_name, with_header=False):
field_found = False
result = []
diff --git a/src/main.py b/src/main.py
index 20b81f6..e90360b 100644
--- a/src/main.py
+++ b/src/main.py
@@ -148,11 +148,16 @@ def get_pbn_score(b):
contract = contract[0] + ' ' + contract[1:]
result = int(b.get_field('Result')) - get_digits(contract) - 6
score = int(b.get_field('Score').replace('NS ', '')) # co z pasami?
+ play_data = b.get_play_data()
+ if play_data:
+ play_data = ' '.join(play_data).split(' ')
+ if play_data:
+ lead = play_data[0].strip()
+ lead = lead[0] + ' ' + lead[1]
else: # passed-out hand
contract = contract.upper()
result = 0
score = 0
- lead = '' # wtf?
return declarer, contract, result, score, lead