Documentation
Introduction
The "wesen" are creatures living in a torus-world (donut).
Their "life" consists of moving to the food and eating it.
It's your job to program the instincts of a species which
will be in a contest with others. The sourcecode of your
species ans therefore all species are simply called "source".
Advanced features of the wesen are reproducing, attacking and talking.
The one who survives all the others is the winner.
The key to good tactics is communication.
The better your algortihms are, the more likely you'll win.
Getting started
sorry, not available yet
More specific information
Quick Reference on Wesen/source interface
Methods the interface provides you:
- id() => python object id of the wesen
- age() => the wesen's age
- energy() => the wesen's energy
- position() => the wesen's position in this format: [x,y]
- time() => the time left in this round
- hasTime("action" or ["action-1",..,"action-n"])
=> True if enough time available for action/actions
- look() => returns a lookRange object
lookRanges are dictionarys.
An entry in a lookRange always contains the key "id".
Empty lookRange happens because the looking is restricted to a certain radius.
To learn more about the lookRanges, use something like
print self.look()
- closerLook() => more detailed than look()
- Move([x,y]) => move one step into [x,y]
while seeing the actual position as [0,0] (relative coordinates)
Move([1,0]) will allways be a step to the right.
- MoveToPosition([x,y]) => move one step into [x,y]
while seeing the upper left corner as [0,0] (absolute coordinates)
Move([0,0]) will always be a step to the upper left corner.
- Talk(id, message) => Calls the "Receive" method of the wesen specified by id.
Message can be everything, from ints to dictionarys.
Pointers to anything are forbidden. Look at the rules for further information.
- Eat(id) => Eats the specified food
Only possible when the wesen stays at the same position as the food
- Reproduce() => returns the "childs" id.
use self.Talk(self.Reproduce(),"hello world")
to talk to your children after reproduction.
The energy of a wesen is divided between the child and the "mother".
- source.Attack
- source.Vomit
- source.Donate
- source.Broadcast
Methods you should write (not necessary):
- def Main(self):
- def Receive(self, message):
- def getDescriptor(self):
return "text for the gui";
- def __repr__(self):
return "text for debugger and logger";
Config options explained
This is the default scheme of config options:
[section]
option1=value
option2=value
The names of options are usually also the names used in the infoObjects in your wesenSource.
If value is (1,yes,true) it is considered as True.
If value is (0,no,false) it is considered as False.
You must not add "" to the config options.
You can get some help by using the command-line config editor (wesen c).
[general]
logfile = /home/konrad/.wesen/log
guisource = gui
enablelog = True
enablegui = 1
In the general section, you should change nothing.
If you want to disable logging permanently, set
enablelog=No
You can read the logs at the path specified in "logfile".
[world]
length = 100
Worldlength*dimensions is the size of the world.
By default it is 100, so the size is 10,000.
Bigger values slow down the gui dramatically.
[wesen]
count = 10
energy = 100
maxage = 500
sources = DrunkenSailor,Nightwatch
In the wesen section you can choose which sources to use.
Count determines how many instances of each source are made during initialization.
Energy is the starting energy of every wesen.
The lower it is, the harder it is to survive at the beginning
when no food is near a wesen.
We highly recommend to not change the sections
[Time], [Range] and [Food]
because it could destroy the game balance.
Code conventions
Please look at Guido van Rossums code conventions
If you want to be conformistic: we use FirstLetterCapitalized()
for methods (simple calls without important results) and
x=firstLetterNotCapitalized() for functions (when the result is most important).
Writing a source
sorry, not available yet
Hints
- Read the source, Luke!
- Never name any file matching the pattern *aux*
it won't work on Windows systems.
- If you don't see any GUI on startup,
you probably programmed an infinity loop.