Agent_25

Pitbull

  • 18.0average EPS
  • 18.0last EPS
Total Ranking
Ranking 1
Tournaments
Tournament 3
Level
Clone_war
Clone War

Tournaments

Tournament

Date: 8 Oct. 2012

  • 7agents
  • 5games
Winner
Agent_25 18.0
Agent
Agent_25 18.0
Tournament Rank
Ranking 1
Tournament

Date: 26 Aug. 2012

  • 7agents
  • 5games
Winner
Agent_25 18.4
Agent
Agent_25 18.4
Tournament Rank
Ranking 1
Tournament

Date: 7 Jul. 2012

  • 7agents
  • 5games
Winner
Agent_24 18.8
Agent
Agent_25 17.6
Tournament Rank
Ranking 2

Source

Licence
Source Code
  1. module ScorpionKing  
  2.   
  3.   class Pitbull < Tournament::Agent  
  4.   
  5.     attr_accessor :enemies:prey  
  6.   
  7.     def after_start  
  8.       @enemies = []  
  9.       @enemy_size = 2.0/3.0  
  10.     end  
  11.   
  12.     def think  
  13.       each_population do |population|  
  14.         @current = population  
  15.         begin  
  16.           been_attacked?  
  17.           @view = @current.look_around  
  18.           if field = hunted_prey || found_enemy  
  19.             hunting = true  
  20.             @current.move_to field  
  21.           elsif field = no_enemie  
  22.             hunting = false  
  23.             @current.split field  
  24.           else field = best_resource  
  25.             hunting = false  
  26.             @current.move_to field  
  27.           end  
  28.         end while(hunting)  
  29.       end  
  30.     end  
  31.   
  32.     def no_enemie  
  33.       if @view.all?{|f| f.has_no_population? || !@enemies.include?(f.agent) }  
  34.         best_resource  
  35.       end  
  36.     end  
  37.   
  38.     # goes the the biggest free resource  
  39.     def best_resource  
  40.       @view.select{|f| f.has_no_population? || myfield?(f) }.max_by{|f| f.resource}  
  41.     end  
  42.   
  43.     def found_enemy  
  44.       if found_on_field = @view.select do |f|  
  45.           f.has_population? && @enemies.include?(f.agent) && @current.size * @enemy_size > f.population  
  46.         end.min_by do |f|  
  47.           f.population  
  48.         end  
  49.         @prey = found_on_field.agent  
  50.         info "found enemy #{@prey}, hunt begins"  
  51.         found_on_field  
  52.       end  
  53.     end  
  54.   
  55.     def hunted_prey  
  56.       if @prey  
  57.         if hunted_prey = @view.find do|f|  
  58.             f.has_population? && f.agent == @prey && @current.size * @enemy_size > f.population  
  59.           end  
  60.           info "hunting down #{hunted_prey.agent}"  
  61.           hunted_prey  
  62.         else  
  63.           info "prey #{prey} lost or too big"  
  64.           nil  
  65.         end  
  66.       end  
  67.     end  
  68.   
  69.     def been_attacked?  
  70.       each_event do |event|  
  71.         if event.instance_of? AttackedEvent  
  72.           unless @enemies.include? event.attacker  
  73.             @enemies << event.attacker  
  74.             info "keep in mind enemy #{event.attacker}"  
  75.           end  
  76.         end  
  77.       end  
  78.     end  
  79.   
  80.     def myfield? field  
  81.       field.x == 0 && field.y == 0  
  82.     end  
  83.   
  84.   end  
  85.   
  86. end  

Administrator

Change Agent State

on state accepted
Back to agent list