summaryrefslogtreecommitdiff
path: root/rozklady/get-tc-boards.py
blob: 637a95c2223d1a01117bd562ba64c29b997825ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import json, sys

for fpath in sys.argv[1:]:
    jsfile = json.load(open(fpath))
    print('[Board "%d"]' %  (jsfile['ScoringGroups'][0]['Distribution']['_numberAsPlayed']))
    board = []
    for hand in ['N', 'E', 'S', 'W']:
        board.append('%s.%s.%s.%s' % (
            jsfile['ScoringGroups'][0]['Distribution']['_handRecord']['Hand'+hand]['Spades'],
            jsfile['ScoringGroups'][0]['Distribution']['_handRecord']['Hand'+hand]['Hearts'],
            jsfile['ScoringGroups'][0]['Distribution']['_handRecord']['Hand'+hand]['Diamonds'],
            jsfile['ScoringGroups'][0]['Distribution']['_handRecord']['Hand'+hand]['Clubs']
        ))
    print('[Deal "N:%s"]' % (' '.join(board).replace('10', 'T')))
    print('')