Posts mit dem Label level werden angezeigt. Alle Posts anzeigen
Posts mit dem Label level werden angezeigt. Alle Posts anzeigen

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.