Bug

Jump to navigation Jump to search

It seems ÉpéeistMicro has a bug somewhere in its gun code. It's throwing "ArrayIndexOutOfBounds" and "NullPointer" exceptions, especially against mirror bots.

The only change I made to the GF code was to change the constant MEA from .7 to 0.727272727272727272727273.

Any ideas?

Thanks

Sheldor16:05, 8 January 2013

Could you post stacktraces?

Jdev16:31, 8 January 2013
 

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:Talk:ÉpéeistMicro/Bug/reply (2).

 

Looks, like here you have a problem: [(int)enemyDistance / 200] Distance may be more than 800 units (sqrt(800*800 + 600*600)=1000), but you give for this dimension only 4 elements It's another problem, but i cannot find out other problems by codereview and it's too late to debugging it, sorry

Jdev18:29, 8 January 2013

I'm sorry, I don't understand what you're saying. On an 800 by 600 field, the maximum possible distance would be 764, 764 divided by 200 would be 3.82, and 3.82 cast to an int would be 3. Besides, Thorn and a few other micros use the same distance segment code and don't have a problem.

Sheldor19:20, 8 January 2013
 

On an 800x600 field, the distance between opposite corners is 1000 (forming a 3/4/5 right triangle). So I think you do need another distance segment, but I haven't looked through your code/logs enough to be sure that's the problem above.

Voidious19:44, 8 January 2013
 

Thanks! You both nailed it. In older versions I initialized the dimension to 7, I forgot to mention I had reduced it to 4 to save a byte. The reason it was losing to mirror bots was because they were in the opposite corner exactly the same time EM was.

I will give you both a mention in the credits.

Sheldor20:23, 8 January 2013
 

Do you use any version control system (git, mercurial, etc)? I recommend to use it. It will facilitate for such bugs detection.

Jdev05:16, 9 January 2013

No. How do they work?

Sheldor15:57, 9 January 2013
 

I use git for my projects. But I'm sorry to say they don't really save you from silly bugs. =)

Voidious16:35, 9 January 2013
 

They don't save from bugs, but they show all changes between versions:) VCS it's something like source code storage with support of files versions. In case of git or mercurial you can use only local repositories or link them with remote repositories in free clouds (github or bitbucket). In case of local repository, main command is commit - this command pushes current state of yours files to storage and marks it with some identifier and you can always get exact state of all files in repository with identifier. Also vcs supports versioning and if you commit files before every release, you can see all differences in code between releases. It's very useful for robocoding. Read this books: http://git-scm.com/book/ or http://hgbook.red-bean.com/read/. It's a "holywar" choise between git and mercurial, but they are pretty equal and usage of any of them is much better then usage nothing:) I use git at home and mercurial at work and cannot give suggestion - they both cool and you need to try them both to choose for yourself

Also i recommend to use some build system (i use gradle and i for sure ready to suggest to choose it) and enforce semantic versioning by them. You can see example in my new bot repository: https://github.com/aleksey-zhidkov/Violet/blob/master/build.gradle. In Violet i use follow versions:

  • Build: <major>.<minor>.<branch>.<build number> - used to for testing (in hand mode or in batch mode in Distributed_Robocode (some kind of analog of RoboRunner with remote computing support), but each batch test enforces build number increase)
  • Release: <major>.<minor> - user for releases

So my development process is:

  1. Do some changes
  2. Build them
  3. Run robocode to see them
  4. If bugs exists, then go to 1
  5. "Install" Violet - commit changes, copy build to "builds" dir and batch battles executor robots dir and incerment build number
  6. If batch testing shows APS gain, then release it: commit changes, copy build "releases" dir, increment minor version and reset build number and push version to github

By the way, robocoders, lets make page with out development processes for noobies:)

Jdev05:53, 10 January 2013

I use Maven as build system. Never tried gradle.

And I´m not currently using any version control system, but I might try git. There was one episode in the past when I lost hours trying to figure out why my bot score dropped about 30% in challenges. I could have found the bug in minutes with version control.

MN13:25, 10 January 2013

We are use ant and maven at work for enterprise project and gradual migrate to gradle, so i definitely can suggest to try gradle^) Especially because you can easy generate gradle project from maven project: http://gradle.org/docs/current/userguide/bootstrap_plugin.html

Jdev14:40, 10 January 2013