Sha256: 3726d2863ad276d04baf3e12d801f14a5ae194674677b411196bc851d5f899db

Contents?: true

Size: 804 Bytes

Versions: 7

Compression:

Stored size: 804 Bytes

Contents

module RTanque
  class Bot
    # Some helpful constants and methods for use as mixin in {RTanque::Bot::Brain}
    module BrainHelper
      BOT_RADIUS          = Bot::RADIUS
      MAX_FIRE_POWER      = Bot::MAX_FIRE_POWER
      MIN_FIRE_POWER      = Bot::MIN_FIRE_POWER
      MAX_HEALTH          = Bot::MAX_HEALTH
      MAX_BOT_SPEED       = Bot::MAX_SPEED
      MAX_BOT_ROTATION    = Configuration.bot.turn_step
      MAX_TURRET_ROTATION = Configuration.turret.turn_step
      MAX_RADAR_ROTATION  = Configuration.radar.turn_step

      # Run block every 'num_of_ticks'
      # @param [Integer] num_of_ticks tick interval at which to execute block
      # @yield
      # @return [void]
      def at_tick_interval(num_of_ticks)
        yield if sensors.ticks % num_of_ticks == 0
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rtanque-0.1.3 lib/rtanque/bot/brain_helper.rb
colstrom-rtanque-0.1.4 lib/rtanque/bot/brain_helper.rb
colstrom-rtanque-0.1.3 lib/rtanque/bot/brain_helper.rb
rtanque-0.1.2 lib/rtanque/bot/brain_helper.rb
rtanque-0.1.1 lib/rtanque/bot/brain_helper.rb
rtanque-0.1.0 lib/rtanque/bot/brain_helper.rb
rtanque-0.0.2 lib/rtanque/bot/brain_helper.rb