Module: Sc2

Defined in:
lib/sc2ai.rb,
lib/sc2ai/paths.rb,
lib/sc2ai/ports.rb,
lib/sc2ai/player.rb,
lib/sc2ai/cli/cli.rb,
lib/sc2ai/cli/new.rb,
lib/sc2ai/version.rb,
lib/sc2ai/api/data.rb,
lib/sc2ai/connection.rb,
lib/sc2ai/player/geo.rb,
lib/sc2ai/unit_group.rb,
lib/sc2ai/player/debug.rb,
lib/sc2ai/player/units.rb,
lib/sc2ai/cli/ladderzip.rb,
lib/sc2ai/configuration.rb,
lib/sc2ai/player/actions.rb,
lib/sc2ai/local_play/match.rb,
lib/sc2ai/local_play/client.rb,
lib/sc2ai/player/game_state.rb,
lib/sc2ai/unit_group/geo_ext.rb,
lib/sc2ai/connection/requests.rb,
lib/sc2ai/local_play/map_file.rb,
lib/sc2ai/player/previous_state.rb,
lib/sc2ai/unit_group/action_ext.rb,
lib/sc2ai/unit_group/filter_ext.rb,
lib/sc2ai/local_play/client_manager.rb,
lib/sc2ai/connection/status_listener.rb,
lib/sc2ai/protocol/extensions/position.rb,
lib/sc2ai/connection/connection_listener.rb,
lib/sc2ai/local_play/client/configurable_options.rb

Overview

Facilitates StarCraft 2 AI

Defined Under Namespace

Modules: Position Classes: Cli, Client, ClientManager, Configuration, Connection, Data, Error, MapFile, Match, Paths, Player, PortConfig, Ports, UnitGroup

Constant Summary collapse

VERSION =

gem version

Returns:

  • (String)
"0.3.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.config {|@config| ... } ⇒ Sc2::Configuration

Instantiate the Configuration singleton or return it. Remember that the instance has attribute readers so that we can access the configured values

Yields:

Returns:



61
62
63
64
65
# File 'lib/sc2ai.rb', line 61

def config
  @config ||= Configuration.new
  yield @config if block_given?
  @config
end

.loggerLogger

Returns a logger instance or a new $stdout logger if undefined.

Returns:

  • (Logger)

    a logger instance or a new $stdout logger if undefined



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/sc2ai.rb', line 74

def logger
  return @logger if @logger

  require "logger"

  @logger = Logger.new($stdout)
  @logger.level = :debug
  @logger.datetime_format = "%H:%M:%S.%6N"

  @logger
end

Class Method Details

.ladder?Boolean

Returns whether we are on the ladder or not

Returns:

  • (Boolean)


88
89
90
# File 'lib/sc2ai.rb', line 88

def ladder?
  @is_live ||= ENV.has_key?("AIARENA")
end