Sha256: 7e9e2fbe525da89587612c92d5ef9c90cd152c9ea03e48e6849e4b6865c0914f

Contents?: true

Size: 836 Bytes

Versions: 4

Compression:

Stored size: 836 Bytes

Contents

# encoding: UTF-8
# frozen_string_literal: true
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 2022'
    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

4 entries across 4 versions & 1 rubygems

Version Path
software_challenge_client-22.1.0.1 lib/software_challenge_client/runner.rb
software_challenge_client-22.1.0 lib/software_challenge_client/runner.rb
software_challenge_client-22.0.3 lib/software_challenge_client/runner.rb
software_challenge_client-22.0.2 lib/software_challenge_client/runner.rb