[Home]Sin Varg

Robo Home | Changes | Preferences | AllPages

I'm a new Robocoder, good programmer but bad english speaker ;)

Profile

I'm a german Robocoder since Nov 2006, born 1983. I started programming very early with an age of about 7 years. But only later with about 12 years I wrote nice graphical programs and little games in AmigaBasic? but my coding style was bad ;) As I was 16 I learned Turbo Pascal, loved it. It was the first time I learned how to write bigger programs and I liked to write libraries. Assembler helped me to optimize my libraries.

2000 I learned C++. C++ was and is the best language for me to write efficient programs. This was the first time I learned how easy and powerful pointers are. I like to write classes, data structures and thinking about algorithm and efficiency. Suddenly nothing that would be impressive for someone in my age at that time.

2004 I startet to study Informatik. My knowledge about Java and mathematics grew rapidly there. I learned Java, which allows very easy programming. But I am missing templates and efficient programming.

How I found Robocode

In Oct 2006 I searched free games and found: DarwinBots? a "programming game", never heared that before. The years before I asked myself: 'If I would write a game, where a "player" must write an AI which plays the game, would ever someone in the world play this game? It would be fine, if there would be a game, where AIs fight each other in a competition.' And then I found DarwinBots?, a programming game. DarwinBots? itself wasn't good (written in Visual Basic), but an easy language and good interface. I tried to write Bots but the game always crashed with my special Bots ;)

But important was, I found the words: "programming game" and searched for them. Finally I got some sites where programming games were listed, looked at many programming games and... most of them wasn't really good or the community was dead.

I looked at Robocode ( community alive ), Robocode open source ( good ). Robocode itself is easy to use, easy to write own bots... but before I can start to write a Bot I must know everything in detail and found out, that Robocode itself isn't written good but uses nice tricks to learn from.
I'm thinking about writing a better programming game, there are many points that I could do better.
It's not easy to unterstand what exacty happens in Robocode and how it works for a newbie. But my decision is, to try to write at least one really good Robot.

What I would do better

I would offer a simple interface for a Robot which allows to get all inputs, let the Bot work with the data and return an output on every tick/cycle/step. To make it easy to write simple bots, I would offer classes that extends or use this interface, preprocesses the inputs and let the Bot simulate events which depends on the inputs. This extended Robots would offer some methods for easy movement, too. I figured out some easy IO and internal states of Robocode-Robots for a simplification, I listed them in SimpleRobot.

Status

I wrote a little tool that shows me, where a Robot can move to from current tick until n ticks in the future. That will help to create a good Robot.

My first Robot is going to be a pure 1vs1 Robot, the next will be a melee and then perhaps I try to write Robots for team vs team battles, but I didn't find a competition for melee fight of teams ( size of 5000 x 5000 would allow it ).


Welcome to the RoboWiki! If you're interested, there's been a discussion about Robocode 2 on the Robocode page lately, it sounds like you have some solid ideas about programming games in general. -- Voidious

Wilkommen. I think your suggestion of a team melee (like 10 teams fighting each other) is the first time I've heard the idea. That would take a long time to process, but it sure would be fun to watch. -- Martin
Edit: I suggest that you use the AdvancedRobot rather than Robot as the basis for your competitive bots. The primary difference is that Robots only process one instruction per turn, whereas AdvancedRobots? can process multiple instructions per turn. It is beneficial to be able to turn your radar, gun, and tank, move forward or backward, and fire all in the same turn. Robots have to pick one. It is not unheard of to write an interface for queueing up your turn's instructions. I have a class in Ugluk that acts as a bean for retrieving state and storing instructions. I also have some methods for consistent logic such as isGunCool(), areAnyOpponentsLeft(), isTankDisabled(). -- Martin

The basic idea was, that Robot is easier to use than AdvancedRobot, I didn't know that people use Robot because Robot is weak. A real AdvancedRobot does never need the blocking methods from Robot.
I experimented with CodeSize and found a way to let nearly every AdvancedRobot fit in a MicroBot. The only problem would be, that this MiniBot would run extremly inefficient and needs very much memory.
If the size is increased to MiniBot, an fitted AdvancedRobot can run more efficient and needs less memory.
I would like to translate a high competitive Robot (which may have any codesize) to a small sized MicroBot or MiniBot. I tested this only with some very simple robots. -- Sin Varg

Go ahead and attempt it on any of my bots, such as Velshea, Beowulf or Tyrra. All of those are megabots, with Velshea taking the bottom rung in size. Good luck. -- Chase-san

Thanks, I looked at your robots and have chosen the one with the best score: Tyrra. After I simplified it to convert it, I saw that the bot isn't complex - a good condition for the conversion into interpretable stringcode.
The idea of my MicroBot is, that the real program is stored in a String and the bot interprets this codestring. I wrote a MicroBot which supports nearly every event and file access, but it has only 3 commands. Theoretical everything is possible with this bot, but i think the efficiency will be very low. The interpreted version of Tyrra could use much more commands inclusive some math functions from java, because it doesn't need much events nor file support. In fact, every interpreted robot should use an own specialized interpreter-robot, which offers only the functions he really needs. This makes it difficult to write a flexible compiler, which compiles one high language code to any specialized codestring format.

Because writing an interpreted bot is not easy without compiler and the development of a compiler plus a robot that must be compiled with it would consume very much time, I should ask (where?) if this kind of robots wouldn't be forbidden, because it shifts executable code ( an own for each robot specialized format, not java byte code ) into data ( a String which don't increase codesize ). -- Sin Varg

I don't think it would be forbidden, but it might be frowned upon. --David Alves

I'm glad you feel that Tyrra isn't overly complex, when I made it she was the most complex bot I ever made. However the soon to be newest version of velshea will top it I hope. An interesting way of saving codespace, however the interpreter itself wills till take up space, but if you can fit tyrra into a micro or mini let me know. -- Chase-san


I read something about presaved data at Dookious. It wouldn't be against any rules to store the statistical data from many fights at home in static arrays at compile time (without writing it into file at runtime)? There could be stored many megabytes of data (I didn't test it), much more than only 200kb and the data file can be used to store compressed statistical data about every unknown enemy at runtime. I would prefer, that data is not allowed to be presaved - but I think there is no way to check if a bot presaves data and how much a bot presaves. Of course, if a bot has a huge class size with a relative small codesize, you can assume that it presaves data, but it could be possible that it just uses some data tables to increase performance. -- Sin Varg

One version of Dookious did pre-save data, it gained about 10-15 points for it. The only "rule" about pre-saved data is that you are not allowed to package more data than the 200kb quota; Robocode itself only checks the quota when a bot is writing out data, so you could otherwise pre-save any amount of data. But yes, you could package data into your code at compile time without breaking any rules. I'm not sure if there's a file size limit on the .jar itself anywhere, but there might be...? -- Voidious

I had an idea how to optimize the distance function with a lookup table. But tests had shown, that arrays are too slow in Java.
Really interesting was, that Math.hypot(x,y) needs nearly 30 times more time than Math.sqrt(x*x+y*y), but why?!
Another strange function: double cos = Math.cos(x); double sin = Math.sqrt(1-cos*cos); needs only 3/4 of the time which double sin = Math.sin(x) needs without calculating the cosine!
I mean, variant 1 gives me the sin and cos, variant 2 only the sin and variant 2 is slower than variant 1. That are just strange performance data that I collected today on my AMD Athlon64 3000+. The biggest surprise was, that Math.hypot is extremly slow and Math.sqrt is extremly fast.
I would like to know how fast the functions are on other machines, because I'm really confused which functions I should use now to get highest performance.

The reason Math.hypot is so slow is that it doesn't square the arguments first. The idea is to let you call Math.hypot with extremely large numbers and not get overflow. By the way, you really shouldn't use that function, not everyone is running the latest java, and that function wasn't in 5.0. --David Alves


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited November 21, 2006 23:38 EST by Martin Alan Pedersen (diff)
Search: