November 08, 2011 Re: AI Challenge - Ants | ||||
---|---|---|---|---|
| ||||
Posted in reply to maarten van damme | Am 08.11.2011, 21:04 Uhr, schrieb maarten van damme <maartenvd1994@gmail.com>: > I have stolen an isvisible method from the c# bot > > bool isVisible(Loc loc){ > Loc[] offsets; > int squares = cast(int)floor(sqrt(_viewradius2)); > for (int r = -1 * squares; r <= squares; ++r){ > for (int c = -1 * squares; c <= squares; ++c){ > int square = r * r + c * c; > if (square < _viewradius2){ > Loc newLoc = {r,c}; > offsets~=newLoc; > } > } > } > foreach (ant;_myAnts) > { > foreach (offset;offsets) > { > if ((ant.col + offset.col) == loc.col && > (ant.row + offset.row) == loc.row) > { > return true; > } > } > } > return false; > } Nice theft, although 'offsets' should really be a field of the Ants class and not recomputed on every invocation. > But I have also lost interest because of a couple of shortcommings, the > hell it is to debug that thing and when it finally compiles fine on 2 > machines it gives a cryptic error about glue.c (that had something to do > with rdmd) I tend to use a 'general purpose' Makefile for building, that I symlink into new projects and wait for a bigger, better build tool. Then I use the 'debug' target as the build command in DDT (Eclipse) and have an 'External Launcher' that runs gdb with the executable. The flags look like this: -w -unittest -debug -gc -L--export-dynamic. Still I mostly use writeln for debugging algorithms and in/out contracts to avoid bugs that are easy to catch there. As for the Ants game, you can add a flag to the engine, I think it was -I, that has it save bot input in a text file. If you feed that to your bot via stdin, the bot will behave exactly as during the game, but this time you can wrap it in a call to gdb, use a special debug build or add flags to your bot that enables more debugging output. |
November 08, 2011 Re: AI Challenge - Ants | ||||
---|---|---|---|---|
| ||||
Posted in reply to maarten van damme | maarten van damme:
> But I have also lost interest because of a couple of shortcommings, the hell it is to debug that thing and when it finally compiles fine on 2 machines it gives a cryptic error about glue.c (that had something to do with rdmd)
What is the message of this cryptic error, and are you able to reduce the code that causes it?
Bye,
bearophile
|
November 09, 2011 Re: AI Challenge - Ants | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile Attachments:
| dmd: glue.c:719: virtual void FuncDeclaration::toObjFile(int): Assertion `!vthis->csym' failed. Not able to reduce the code that causes it as it compiles fine here and it takes 10 minutes to upload new code and let it compile/play. 2011/11/8 bearophile <bearophileHUGS@lycos.com> > maarten van damme: > > > But I have also lost interest because of a couple of shortcommings, the hell it is to debug that thing and when it finally compiles fine on 2 machines it gives a cryptic error about glue.c (that had something to do with rdmd) > > What is the message of this cryptic error, and are you able to reduce the code that causes it? > > Bye, > bearophile > |
November 09, 2011 Re: AI Challenge - Ants | ||||
---|---|---|---|---|
| ||||
Posted in reply to maarten van damme | Am 09.11.2011, 18:52 Uhr, schrieb maarten van damme <maartenvd1994@gmail.com>:
> dmd: glue.c:719: virtual void FuncDeclaration::toObjFile(int):
> Assertion `!vthis->csym' failed.
>
> Not able to reduce the code that causes it as it compiles fine here and it
> takes 10 minutes to upload new code and let it compile/play.
>
> 2011/11/8 bearophile <bearophileHUGS@lycos.com>
>
>> maarten van damme:
>>
>> > But I have also lost interest because of a couple of shortcommings,
>> the
>> > hell it is to debug that thing and when it finally compiles fine on 2
>> > machines it gives a cryptic error about glue.c (that had something to
>> do
>> > with rdmd)
>>
>> What is the message of this cryptic error, and are you able to reduce the
>> code that causes it?
>>
>> Bye,
>> bearophile
>>
Try compiling all *.d source files at once with DMD 2.054 (x86_64) and -O -inline -release -noboundscheck, instead of using rdmd. That is basically what the server does. You may have triggered an unresolved and strange compiler bug unless this wouldn't happen with 2.056.
|
November 09, 2011 Re: AI Challenge - Ants | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marco Leise | Looks like issue #6395 or any of the issues linked in there: http://d.puremagic.com/issues/show_bug.cgi?id=6395 It could actually depend on the order the source files are found and appended to the command line by the server's compile script. :-/ |
Copyright © 1999-2021 by the D Language Foundation