<commit_before># -*- coding: utf8 -*-

from network import *
import json
import pygame
from pygame.locals import *


class Client(object):

    def __init__(self, player_name="Nemo"):
        self._network = Network()
        self._player_name = player_name
        self._network.bind_to_server('')
        self._acknowledgement_message = b"My name is:%s" % self._player_name
        self._server_address = None
        self._local_player_id = None

    def try_to_join_server(self, clock):
        response_message = self._network.client_listen()
        if response_message is not None and response_message[0] == 'Join me':
            self._server_address = response_message[1]
            self._network.client_send(self._acknowledgement_message, self._server_address)
            print "Joining server ", self._server_address
            while self._local_player_id is None:
                data = self._network.client_listen()
                if data is not None:
                    if data[0]['client_id'] is not None:
                        self._local_player_id = data[0]['client_id']
                        return True
        elif response_message is not None:
            print "Noob host"
            return False

        clock.tick(10)

    def wait_for_server_start_game(self):
        response_message = self._network.client_listen()
        if response_message is not None:
            if response_message[1] == self._server_address and response_message[0] == 'Start game':<commit_msg>se tpo<commit_after># -*- coding: utf8 -*-

from network import *
import json
import pygame
from pygame.locals import *
from types import *


class Client(object):

    def __init__(self, player_name="Nemo"):
        self._network = Network()
        self._player_name = player_name
        self._network.bind_to_server('')
        self._acknowledgement_message = b"My name is:%s" % self._player_name
        self._server_address = None
        self._local_player_id = None

    def try_to_join_server(self, clock):
        response_message = self._network.client_listen()
        if response_message is not None and response_message[0] == 'Join me':
            self._server_address = response_message[1]
            self._network.client_send(self._acknowledgement_message, self._server_address)
            print "Joining server ", self._server_address
            while self._local_player_id is None:
                data = self._network.client_listen()
                if data is not None:
                    if type(data[0]) is not StringType:
                        if data[0]['client_id'] is not None:
                            self._local_player_id = data[0]['client_id']
                            print data[0]['client_id']
                            return True
        elif response_message is not None:
            print "Noob host"
            return False

        clock.tick(10)

    def wait_for_server_start_game(self):
        response_message = self._network.client_listen()
        if response_message is not None:
            if response_message[1] == self._server_address and response_message[0] == 'Start game':
{'fraction_non_alphanumeric': 0.08582326764144946, 'fraction_numerical': 0.006357279084551812, 'mean_word_length': 2.2543950361944156, 'pattern_counts': {'":': 0, '<': 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': '586884', 'n_tokens_mistral': 871, 'n_tokens_neox': 837, 'n_words': 212}