<commit_before>require 'json'

# An instance of this class is created by ServerPort whenever an
# incoming connection is accepted.

class ServerConnection

  def initialize(game, server, id, remote_addr)
    @game, @server, @id, @remote_addr = game, server, id, remote_addr
    puts "ServerConnection: New connection #{id} from #{remote_addr}"
  end

  def answer_handshake(handshake)
    # Copy this array since it's about to change
    other_players = @game.get_all_players.dup

    player_name = handshake['player_name']
    @player = @game.add_player(self, player_name)

    response = {
      'you_are' => @player,
      'world' => {
        :width => @game.world_width,
        :height => @game.world_height,
        :delta_t => @game.delta_t,
        :substeps => @game.substeps,
      },
      'add_players' => other_players,
      'add_stars' => @game.get_all_stars
    }
    puts "#{@player} logs in from #{@remote_addr}:#{@remote_port}"<commit_msg>No remote port with ENet<commit_after>require 'json'

# An instance of this class is created by ServerPort whenever an
# incoming connection is accepted.

class ServerConnection

  def initialize(game, server, id, remote_addr)
    @game, @server, @id, @remote_addr = game, server, id, remote_addr
    puts "ServerConnection: New connection #{id} from #{remote_addr}"
  end

  def answer_handshake(handshake)
    # Copy this array since it's about to change
    other_players = @game.get_all_players.dup

    player_name = handshake['player_name']
    @player = @game.add_player(self, player_name)

    response = {
      'you_are' => @player,
      'world' => {
        :width => @game.world_width,
        :height => @game.world_height,
        :delta_t => @game.delta_t,
        :substeps => @game.substeps,
      },
      'add_players' => other_players,
      'add_stars' => @game.get_all_stars
    }
    puts "#{@player} logs in from #{@remote_addr}"
{'fraction_non_alphanumeric': 0.12179822268687925, 'fraction_numerical': 0.0, 'mean_word_length': 3.359908883826879, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '4361348', 'n_tokens_mistral': 622, 'n_tokens_neox': 612, 'n_words': 161}