<commit_before>#!/usr/bin/env python

import websocket, json

server = "ws://localhost:8001"

print "What is your name?"
name = raw_input()

ws = websocket.create_connection(server)

ws.send(json.dumps({"type" : "start",  "id" : name}))

print "Waiting for game to start"

ncols = 7
nrows = 6

def print_board(board):
    for i in range(nrows):
        row = str(nrows - i - 1) + "|"
        for j in range(ncols):
            k = j * nrows + (nrows - i - 1)
            row += ".12"[board[k]]
        print row
    print "-" * (ncols + 2)
    print "".join([" |"] + [str(i) for i in range(ncols)])

while 1:
    state = json.loads(ws.recv())
    if state["type"] == "end":
        print "Game has ended"
        break
    elif state["type"] == "disconnected":
        print "Other player has disconnected"
        break<commit_msg>inter-game loop for test client<commit_after>#!/usr/bin/env python

import websocket, json

server = "ws://localhost:8001"

print "What is your name?"
name = raw_input()

ws = websocket.create_connection(server)

def start_game():
    ws.send(json.dumps({"type" : "start",  "id" : name}))
    print "Waiting for game to start"

ncols = 7
nrows = 6

def print_board(board):
    for i in range(nrows):
        row = str(nrows - i - 1) + "|"
        for j in range(ncols):
            k = j * nrows + (nrows - i - 1)
            row += ".12"[board[k]]
        print row
    print "-" * (ncols + 2)
    print "".join([" |"] + [str(i) for i in range(ncols)])


start_game()
while 1:
    state = json.loads(ws.recv())
    if state["type"] == "end":
        print "Game has ended"
        print "Press any key to start another round"
        raw_input()
        start_game()
    elif state["type"] == "disconnected":
        print "Other player has disconnected"
        print "Press any key to start another round"
        raw_input()
        start_game()
{'fraction_non_alphanumeric': 0.15311004784688995, 'fraction_numerical': 0.012759170653907496, 'mean_word_length': 2.4280510018214936, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6090577', 'n_tokens_mistral': 665, 'n_tokens_neox': 640, 'n_words': 194}