Sha256: ad13d48ed57c7f3a4d4966ef667a523b2ab04506ef2ae02ca142fbaa8962477c

Contents?: true

Size: 806 Bytes

Versions: 11

Compression:

Stored size: 806 Bytes

Contents

# encoding: UTF-8
require_relative 'board'
require_relative 'client_interface'
require_relative 'network'

# Klasse zum Starten einer neue Verbindung zum Spielserver und Verarbeiten der Nachrichten des Servers.
class Runner
  include Logging

  def initialize(host, port, client, reservation = nil)
    logger.info 'Software Challenge 2019'
    logger.info 'Ruby Client'
    logger.info "Host: #{host}"
    logger.info "Port: #{port}"

    board = Board.new
    @network = Network.new(host, port, board, client, reservation)
  end

  def start
    @network.connect
    unless @network.connected
      logger.error 'Not connected'
      return
    end

    while @network.connected
      @network.processMessages
      sleep(0.01)
    end

    logger.info 'Program end...'
    @network.disconnect
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
software_challenge_client-20.2.4 lib/software_challenge_client/runner.rb
software_challenge_client-20.2.3 lib/software_challenge_client/runner.rb
software_challenge_client-20.2.2 lib/software_challenge_client/runner.rb
software_challenge_client-20.2.1 lib/software_challenge_client/runner.rb
software_challenge_client-20.2.0 lib/software_challenge_client/runner.rb
software_challenge_client-19.1.0 lib/software_challenge_client/runner.rb
software_challenge_client-19.0.4 lib/software_challenge_client/runner.rb
software_challenge_client-19.0.3 lib/software_challenge_client/runner.rb
software_challenge_client-19.0.2 lib/software_challenge_client/runner.rb
software_challenge_client-19.0.1 lib/software_challenge_client/runner.rb
software_challenge_client-19.0.0 lib/software_challenge_client/runner.rb