summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-05-21 00:45:30 +0200
committeremkael <emkael@tlen.pl>2019-05-21 00:45:30 +0200
commit8fe69503d0afb4316a14768af0a312177f0ea2c7 (patch)
treef4af572cea9a3a1b45bd2c8c4f1a3584c94272f8
parent2465d4bf0bdd689ad05d4910cb72a5387353a786 (diff)
Dealer and vulnerability calculation methods
-rw-r--r--dealconvert/dto.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/dealconvert/dto.py b/dealconvert/dto.py
index e51f052..37585d8 100644
--- a/dealconvert/dto.py
+++ b/dealconvert/dto.py
@@ -20,3 +20,20 @@ class Deal(object):
[[],[],[],[]],
[[],[],[],[]]]
self.vulnerable = {'NS': False, 'EW': False}
+
+ def get_dealer(self, board_no):
+ return (board_no - 1) % 4
+
+ def get_vulnerability(self, board_no):
+ board_no = board_no % 16
+ vuln = {'NS': [False,
+ False, True, False, True,
+ True, False, True, False,
+ False, True, False, True,
+ True, False, True],
+ 'EW': [True,
+ False, False, True, True,
+ False, True, True, False,
+ True, True, False, False,
+ True, False, False]}
+ return { pair: vuln[pair][board_no] for pair in vuln }