diff options
author | Michał Klichowicz <emkael@tlen.pl> | 2023-10-01 23:42:10 +0200 |
---|---|---|
committer | Michał Klichowicz <emkael@tlen.pl> | 2023-10-01 23:42:10 +0200 |
commit | b3f00e26049c990f06ab4b1b37345d64f0b5c2ae (patch) | |
tree | 820ce5d325e6427645d5af8b160d574b6c453b56 /src/bcdd/PBNBoard.py | |
parent | 7abe5062e8a9cbd41316090e8891fdcbc026696d (diff) |
Removing double-dummy code from bcdd PBN parsing code
Diffstat (limited to 'src/bcdd/PBNBoard.py')
-rw-r--r-- | src/bcdd/PBNBoard.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/bcdd/PBNBoard.py b/src/bcdd/PBNBoard.py index 87105f2..6e1abf6 100644 --- a/src/bcdd/PBNBoard.py +++ b/src/bcdd/PBNBoard.py @@ -1,6 +1,5 @@ import re -from .BCalcWrapper import BCalcWrapper from .Exceptions import FieldNotFoundException, DDTableInvalidException @@ -19,6 +18,9 @@ class PBNBoard(object): optimum_result_table_pattern = re.compile( r'^([NESW])\s+([CDHSN])T?\s+(\d+)$') + DENOMINATIONS = [ 'C', 'D', 'H', 'S', 'N' ] + PLAYERS = [ 'N', 'E', 'S', 'W' ] + def __init__(self, lines, line_no=None): self.line_number = line_no self._has_optimum_result_table = None @@ -98,7 +100,7 @@ class PBNBoard(object): def write_ability(self, dd_table): sb = '' for i in range(0, 4): - sb += BCalcWrapper.PLAYERS[i] + sb += PBNBoard.PLAYERS[i] sb += ':' sb += ''.join(['%X' % (j) for j in dd_table[i]])[::-1] sb += ' ' @@ -206,9 +208,9 @@ class PBNBoard(object): for j in range(0, 5): self.fields.append(PBNField( raw_data='%s %s%s %d' % ( - BCalcWrapper.PLAYERS[i], - BCalcWrapper.DENOMINATIONS[j], - 'T' if BCalcWrapper.DENOMINATIONS[j] == 'N' else '', + PBNBoard.PLAYERS[i], + PBNBoard.DENOMINATIONS[j], + 'T' if PBNBoard.DENOMINATIONS[j] == 'N' else '', dd_table[i][j]))) def save_par_contract(self, contract, jfr_only=False): |