Sha256: b8b0220814b66af8ebc3111781989e1e7e1bac4df6f3f0657bc9dc8af2674008

Contents?: true

Size: 684 Bytes

Versions: 2

Compression:

Stored size: 684 Bytes

Contents

require "sc2ai"

class <%= @classname %> < Sc2::Player::Bot

  def configure
    @realtime = false # Step-mode vs Bot, Realtime vs Humans
    @step_size = 1 # Gives 22.4ms, typically compete at 2 (44.8ms) or 4 (179.2ms).
    @enable_feature_layer = false; # Enables ui_ and spatial_ actions. Advanced, and has performance cost.
  end

  def on_step
    if game_loop == 0
      enemy_start_pos = game_info.start_raw.start_locations.first
      units.workers.attack(target: enemy_start_pos)
    end

    # If your attack fails, "good game" and exit
    if units.workers.size.zero?
      action_chat("gg", channel: Api::ActionChat::Channel::Broadcast)
      leave_game
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sc2ai-0.0.3 lib/templates/new/my_bot.rb.tt
sc2ai-0.0.2 lib/templates/new/my_bot.rb.tt