Posts mit dem Label zero x werden angezeigt. Alle Posts anzeigen
Posts mit dem Label zero x werden angezeigt. Alle Posts anzeigen

Samstag, 2. Juni 2012

Starting 3rd Zero X Season

On July 7 2012 we start the 3rd Zero-X season. This will be the first season with
the new level "Clone War". The best agents of the 2nd season will be among the first participants.
For now this are Virgina, Say Cheese, Scorpion King and Unexist.

But don't worry as soon as you accomplish the first level "Greenfields", you get
immediately access to the next level. The conditions are still the same:
You need to participate in a least 5 tournaments and win 40 points.

Looking forward to see the first winners.

Mittwoch, 18. Januar 2012

Extended Actions in Level Clone War

In my last post I described the new introduced action split. This time I want to continue and show you two other actions, that have been extended for the new level Clone War.

Let's start with the look_around action. In level Greenfields this action gives back a view with radius 1. In level Clone War you can now pass the radius as parameter. The view with radius 2 is shown on right.
As it is a circular view, the corners are missing. For those fields you will get back nil instead of a field.

The action costs are dependent of the view radius. A view with radius 2 will cost 5 action points. The one with radius 1 still costs 2 action points and with radius 0 you will get back your own position for 0.2 action points.

new_population = old_population.split(field)
population.look_around(0) # equal to look_at(0,0)  
population.look_around    # radius 1  
population.look_around(2) # radius 2  

You can also get a single field with look_at and pass the field you want to see as parameter. But you have to make sure this field is within radius 1.

new_population = old_population.split(field)
population.look_at(1,0)  
population.look_at(field)

Also the move_to action has some small changes. The action costs for vertical and horizontal direction remain 6 action points, while moving diagonally now costs 8.5 AP.

For more information see the documentation.

Samstag, 1. Oktober 2011

Announcing Level Clone War

The second level for the programming game Zero-X is ready. I'm proud to announce the 2nd level Clone War.

The first level Greenfields introduced basic sensors and actions and showed how to control a single population. With Clone War these sensors and actions will be extended. But we also have a new action, now it is possible to split a population.

Split does two things, first it splits the population into two equal sized populations and then moves the new created population to a field of your choice. Split looks the same as move_to it takes a field or position as parameter for the new population.

new_population = old_population.split(field)
new_population = old_population.split(-1, 0)
new_population = old_population.split(x: 1, y: 1)

As we may have multiple populations now, you need to specify the population you want to apply the action:

population_a.look_around
population_b.move_to 1, 1
population_c.size
population_c.resource

As you can see the new introduced action changes quite a lot. In the next blog post I will describe how some well-known actions have been extended.

For more details see the documentation.

Dienstag, 6. September 2011

Winner of 2nd Season Greenfields

Wood Elf strikes again! The winner of the 1st Zero X season is also the winner of 2nd season.

In the 2nd season disengage was introduced and the combat damage, was changed in the favor of the attacker and therefore rewarded a more aggressive behaviour. But little has changed here as a look at the ranking list shows.

As announced at the beginning of this season: you will need an agent with at least an average of 4.0 EPS and 5 tournaments to get to next level "Clone War". Here are the top five agents, who achieved that goal:

6.62 Wood Elf
6.08 Mild Gruyere
6.08 Bulldog
5.66 Rincewind
4.24 Gruyere

The usual suspects at the top, let's have a look at the agents that have won more than one tournament:

1st places
3 Rincewind
2 Wood Elf
2 Bulldog
2 Oreiller

At first glance it looks surprising that Oreiller didn't made it for the next level with two 1st places. But taking a closer look we can see, that it didn't perform very well between the 2nd and 6th tournament. I'm sure he will join soon as well as Tentacle Cat, both are only a few points away.

In the next few blog posts I want to take a closer look at all the new features of the new level Clone War and introduce them step by step.

www.zero-x.net









Sonntag, 29. Mai 2011

Using Ruby 1.9.2 and Bundler with Zero-X

In the last few months I was working on bringing Zero-X to Rails 3. The new agent SDK reflects this changes in using now bundler.
In addition to the Rails migration, I ported Zero-X to Ruby 1.9.2. The next tournament on the 25. June 2011 will be the first running fully on 1.9.2. So make sure you're testing your agents in the future against 1.9.2.

For those not familiar with bundler and how to install Ruby 1.9.2, here some steps to get you started:
First we need Ruby 1.9.2. The easiest way to install it is by using RVM (Ruby Version Manager). You can get it by issuing this command in your shell:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
Next we need the agent SDK, which you can download form the Zero-X website.

Unpack the SDK and change to that directory. You will now be asked to examine the .rvmrc file. This file tells RVM to use a specific Ruby Version within this directory. In our case the file contains:
rvm use 1.9.2
After controlling the file, type "yes". Now RVM is looking for Ruby 1.9.2 and if it doesn't exists, it will prompt you a warning and the instruction how to install it.
rvm install 1.9.2

Next we need bundler. As we installed RVM for the current user, we don't need to use sudo to install gems.
gem install bundler
Bundler can now install all necessary gems and check their dependcies.
bundle
You are set and ready to go:
bundle exec rake
or
bundle exec autotest
Enjoy!

Donnerstag, 18. November 2010

Combat Damage in Season 2

The combat damage in ZeroX has been quite high. Until now the combat damage has been divided inversely proportional to the population size, both agents suffered the same combat damage.
With season 2 this will change in favor of the bigger adversary. The combat damage for the smaller will remain the same. But the damage for the bigger will also be inversely proportional to the population sizes. Let's compare the two algorithms with a seek and destroy sequence with:

  Season 1 Season 2
step   Agent 1 Agent 2 Agent 1 Agent 2
1 population 1000 1500 1000 1500
combat damage 600 600 600 400
2 population 400 900 400 1100
combat damage 276 276 293 107
3 population 124 624 106 993
combat damage 103 103 96 11
4 population 21 521 10 982
combat damage 20 20 10 1
5 population 1 501 0 981

As in season 1 both adversary were classified excat the same, therefore they suffered the same damage. The bigger one could never take advantage of his population superiority. This will now be considered.

Mittwoch, 10. November 2010

Secure your steps, how to disengage from a move action

Update: This feature has been removed in with the beginning of the 3rd season. Instead use look_at for agents in level Clone War.

In Zero X the simulation and all agents are running continuously. That's one big difference to other programming games, that usually are round based. The consequence is, that in the time between an agent inspects his environment with a look_around and the action he takes, with a move_to for example, the environment can change.
For example a field is free, when he makes the look_around, but has been occupied in the meanwhile by another agent, when he moves. This would result in a unintended attack against this other agent.

Although this case is rare, as a look_around and a move_to are very close. But this time gape can grow bigger as the analysis of the environment takes more time. In general agents have to deal with this kind of insecurity about their perception. This one of the many challenges in this game.

But in order to handle better this kind of insecurity, starting with season 2, move_to can now take a block.
move_to(x,y) {|target| ... }
The argument passed to the block is another view of the target field at the exact time of the movement. This gives the agent the chance to check the preconditions of his action. If they are not fulfilled anymore, he can now disengage from the move action.

move_to(x,y) do |target|
  unless target.has_no_population?
     disengage 'field is not free anymore!'
  end
end
Disengage can take a message, that will then be displayed in your reports. The action is canceled and the agent remains on his starting field. But disengage comes not for free. A move_to would cost 6 action points, disengage from this action still costs 3 action points.

Disengage can only be used within an action block like the one in move_to.

Donnerstag, 26. August 2010

The End of Season 1

The 10th tournament ended actually with two winners, Bulldog and Rincewind. Both made 6.8 points, Bulldog is only ranked first, because he has a better overall ranking.

After 10 tournaments, it's time to look back. The first tournament began with 9 agents, by now the agents have doubled. They not only have become more, no they also have become better. FireLion the winner of the first two tournaments, looked in the beginning very promising, but in the meanwhile has been displaced to the 10th rank. Others have come with a better strategy.

After total 46 games, the ranking list can grouped in three parts:
There's the 5plus group, agents that have an average of more than 5 points. Means they don't only survive in most of the games, the also achieve better ranks. WoodElf, Bulldog, Gruyere, Oreiller, Mild Gruyere and Rincewind are in this group.
The second group are agents that survive sometimes, they have an average of 3 to 4 points. And then there's the last group that have less than 3 points, meaning they don't survive very often.

But remember this tournaments are not only about winning or loosing, in fact I don't see any loosing in contributing an agent. It's about to figure out which strategy works better then another.

After 10 tournaments we make a break and end the first season. We will continue the tournaments in October, the exact date will be announced.

Congratulations to everybody and see you soon for the second season!

Samstag, 31. Juli 2010

Attacked Events

In Zero X some events are directly reported to the agents. They can read them, during their think method with next_event or iterate over them with each_event. The event will be removed as soon as it has been read.
event = next_event
event.class    # => AttackedEvent
event.attacker # => '003' agent code name
event.damage   # => 132
If an agent is attacked by another agent, the victim receives an attacked event. The event includes the code name of the attacker and the damage suffered.

Here an example with an iterator:
each_event do |event|
  if event.instance_of? AttackedEvent
    puts "attacked by #{event.attacker} and suffered #{event.damage}"
  end
end
In your tests you can fire the attacked event by using has_been_attacked_by. The method takes the codename of the attacker and an optional damage parameter.
it "should behave different if it has been attacked" do
  @agent.has_been_attacked_by '003'
  @agent.think
  ...
end
The new test methods are available with SDK Version 0.9.7.
Download the new SDK V0.9.7

See the documentation.

Donnerstag, 22. Juli 2010

Bulldog wins 9th tournament

Bulldog won the 9th tournament with 8.0 points. He won 2 games, made one second place and a third place.
Wood Elf, the high flyer of the last tournament, made this time only 4.6 points and was placed at rank 6, still holding the first rank in the total ranking.
Newcomer Mild Gruyere won 1 game and is placed 4th in the tournament ranking.

I'm still experimenting with the runtime velocity of the simulation. This time the simulation run even slower, the action cost to time unit ratio was 1/15. Like this the resource reached their maximum at the end of each game. I think will keep the action costs in this range for the next tournament.
class Agency < Tournament::Agency
  level 'Greenfields'
  agents_per_game 22
  games_per_agent 1
  game_duration 300 # sec
  time_unit 45 # sec
  action_cost_time_unit_ratio 1.0 / 15.0
  build_options 'Greenfields::World' => { :size => 8 },
                'Greenfields::Resource' => { :size => 4000..16000 },
                'Greenfields::Population' => { :size => 40..160 }
end
Ranking of the 9th tournament.

Montag, 5. Juli 2010

High-Flyer

Incredible! Wood Elf makes the perfect tournament with 10 points! This means she won all 5 games in the tournament. Having a look at the rankings of Wood Elf, we see that, in the 4 tournaments she participated, she won 3 of them and made a second place in the other. This is clear an outstanding performance.
She now leads the overall ranking with 7.85 points, leaving the second placed Gruyere with 5.69 points behind.

The world size for this tournament has now been increased by one to eight. And the simulation run even slower, one time unit now took 30 seconds.
Here the whole configuration for the last tournament:
module Greenfields

  class Agency < Tournament::Agency
    level 'Greenfields'
    agents_per_game 22
    games_per_agent 5
    game_duration 1800 # sec
    time_unit 30 # sec
    action_cost_time_unit_ratio 1.0 / 10.0
    build_options 'Greenfields::World' => { :size => 8 },
                  'Greenfields::Resource' => { :size => 4000..16000 },
                  'Greenfields::Population' => { :size => 40..160 }
  end

end

Ranking of the 8th tournament.

Sonntag, 20. Juni 2010

The 5th and 6th Tournament

For the last two tournaments there were 5 games each and 16 agents, who participated.
We had an amazing newcomer "Wood Elf", who left with 7.8 EPS all other behind. In the 5th tournament Wood Elf won 2 games, made a second and a third place. But she also takes the first place in the overall ranking. FireLion falls back to the third place.

In the 6th tournament, Gruyere strikes for the second time. One game won, 3 times a second place and one third place, gives him excellent 8 EPS. Gruyere takes now the second place in the overall ranking. Will he become number one in the tournaments to come or can Wood Elf defend her position?

As in the last post announced the simulation runned slower for the last two tournaments. The action cost to time unit ratio has been set to 1/4. Also the world size has been increased and has now a size of 7. Here the complete configuration for the last tournament:
module Greenfields

  class Agency < Tournament::Agency
    level 'Greenfields'
    agents_per_game 16
    games_per_agent 5
    game_duration 1800 # sec
    time_unit 12 # sec
    action_cost_time_unit_ratio 1.0 / 4.0
    build_options 'Greenfields::World' => { :size => 7 },
                  'Greenfields::Resource' => { :size => 4000..16000 },
                  'Greenfields::Population' => { :size => 40..160 }

  end

end
Checkout the the ranking.

Dienstag, 25. Mai 2010

Decoupling action costs from time units

The first tournaments showed, that the resources grow too fast. Fields with no population reach soon the maximum of their capacity and when an agent fights another agent, it can recover from the combat damage in no time.
As SayCheese pointed out, at the time the game is stopped, the winner is more or less random, as all survived populations are more or less at their maximum. Actually there's no real fight for the best remaining resources.

To bring some more challenge in the game, the simulation should run a little bit slower, while the agents still have the same time for their actions. Therefor the action costs will be decoupled from the time units in the simulation. Action costs are now a fraction of a time unit. A look_around doesn't take 2 time units anymore, but 2 action costs.
For the next tournament an action cost will be a quarter of a time unit. Means the simulation will run 4 times slower until now. In consequence the resources and the populations will grow 4 times slower.

Dienstag, 11. Mai 2010

Surprise in the 4th tournament

The 4th tournament comes with a surprising winner: The Good, a demo agent.

How could a random agent win this tournament? Does this prove, that the whole tournament is just a random game, doesn't it?! I don't think so!
Rather I think, that we reached a turning point.

In this 4th tournament 14 agents participated, most of them optimised to go for the best resource. As everyone wants the best resource, the only question remains, who gets it first. However all too often two or more agents saw the same field, that seemed to be free, and so they decided to move there. Leading in an unintentional attack against another agent, who had the same idea, but was a little bit faster moving.
This effect was aggravated by the fact, that the small 6x6 matrix was quite crowded with 14 agents. More than a third of the fields were occupied.

While everyone stumbled over each other, The Good just walked to a random free field, which was with the utmost probability better than the one he came from, but not necessarily the one with the best resources. Like this he could grow without being bothered by anybody.

Though The Good could not convince. He achieved only 5.75 points, meaning in 3 games he got only the minimum of 5 points and 8 points for a second place. As comparison Fire Lion and Gruyere won theire past tournaments with 9 points!

But for all that, we can learn a thing from this tournament. If the matrix gets too crowded, going only for the best resource may not necessarily be the best strategy, the second best may be better.

Dienstag, 27. April 2010

Gruyere wins 3rd tournament

The 3rd tournament brings a new winner. Gruyere wins 3 of 4 games and is placed 3rd in the fourth one. Last time Gruyere made only 3.25 points, this time excellent 9.

The newcomer of this tournament is Rincewind. He wins one game, one 2nd place one 3rd place. He achieved the 2nd place in the tournament and takes the 3rd place in the total ranking.

What happened to Fire Lion? In this tournament he dies in 2 games, and gets only 5 points in the other two games. Still he can defend his first place in the total ranking. But the question is now, for how long?

In this tournament a new thread scheduler came into operation. Now all agent threads are synchronized before they can execute an action like look around or move. Like this some raceconditions, that happend last time, could be avoided.

See the tournament Ranking

Dienstag, 13. April 2010

Fire Lion wins again

Fire Lion wins also the second tournament and keeps the lead. One first place, a second place and two third places out of 4 games.
But we have also two impressive newcomers, Dirty Harry on the second place and Appenzeller on the third place. Each of them have won a game. Tentacle Cat last time on the second place, is now placed fourth, even if it also won one game.

In this second tournament we had now 12 agents. The parameters were the same as in the last tournament, expect that the world size has been increased to 6.

See the tournament rankings

Montag, 12. April 2010

Zero X Präsentation

Am Mittwoch 14. April 2010 werde ich die Gelgenheit haben Zero X der Ruby on Rails Usergroup Schweiz vorstellen zu können.

Zero X ist ein Ruby Programming Game. Wie in solchen Games üblich, spielen die User nicht direkt gegeneinander. Stattdessen programmiert jeder Spieler ein Agenten Progamm, das dann gegen die anderen Agenten antritt. Die Agent in Zero X sind in eine simulierte Welt eingebettet, die kleine ökologische Systeme abbilden. Ziel ist es, dass die eigenen Agenten in diesem System überleben oder gar die anderen übertrumpfen können,

Freue mich jetzt schon auf spannende Diskussionen...

Mehr Infos unter www.zero-x.net

Montag, 29. März 2010

And the winner is ...

We had 9 agents in this first tournament, each participated to 4 games. A game took 30 min or 360 time units.

Fire Lion won 2 games and was placed second in the other two games. He clearly gains the lead! Congratulations!
See the entire ranking list here.

Here the setup parameters for the tournament:
module Greenfields

  class Agency < Tournament::Agency
    level 'Greenfields'
    agents_per_game 12
    games_per_agent 4
    game_duration 1800 # sec
    time_unit 5.0  # sec
    build_options 'Greenfields::World' => { :size => 5 },
                  'Greenfields::Resource' => { :size => 4000..16000 },
                  'Greenfields::Population' => { :size => 40..160 }
  end

end
The resources and the populations had the following properties:
resource :capacity => 100000, :birth_rate => 0.15, :death_rate => 0.05
population :birth_rate => 0.2, :death_rate => 0.05, :hunting_rate => 0.05, :needed_food => 2.0

What are your observations for this first tournament?

Samstag, 27. März 2010

First Tournament

The frist agents have gathered for the first tournament. And we are curious to see the very first winner on:


29. March 2010



See it on Zero X.

Donnerstag, 25. März 2010

Free Actions

Release 0.9.5 introduces two new actions. Both are free, means, they don't take any actions costs.

First with info you can now store messages during your agents think method. Later you can analyse them in the reports of the game reviews. All messages saved this way are private. Only the owner of the agent can see them.
info 'my secret debug info'
Second is time. Time simply returns the time units elapsed since the game has been started.
time # => time_units in floats
This is the last release before the first tournament will take place.

The documentation and the SDK have been updated.