MicroBot champ!
Congrats dude! From someone who knows how tough it is to dethrone Skilgannon... =)
Thanks!
I tried for a long time to improve the gun, but that didn't work so I ended up just copying Toorkild's new mode selection and improving anti-ram.
Now it's only a matter of waiting for Toorkild 0.4.6. :(
Wow, impressed that you managed to squeeze that in. Of course, Toorkild is now functionally equivalent at 711 bytes, the real issue is thinking of something to add =) And half of your score margin is from not being in LittleBlackBook's books... perhaps it is time for Waylander to make a comeback?
Mwa Ha Ha!
I just did something absolutely brilliant which squeezed 14 bytes from the GFT system itself, and I now have 18 bytes free, plus ~9 bytes if I get desperate. Any ideas about what I should do with that space?
Huh, it seems it wasn't so brilliant after all. Version 1.9.0 is ~0.5 APS lower than 1.8.0.
The main change was to the way the wave system gathers bearing offsets. Version 1.8.0 used the traditional, coordinate-based method, whereas version 1.9.0 sums angular velocities. I made sure to keep it as precise as I could, I even adjusted the distance by which I divide the lateral velocity to calculate angular velocities with advancing velocities (actually negative advancing velocities, you might call them "retreating velocities") to account for the opponent moving toward or away from the source location of the wave.
Is there some obscure element of Robocode physics that makes sums of angular velocities inaccurate? Or is there a bug in my code?
Don't think anything about Robocode itself should lead to an inaccuracy. Could it be a normalization bug? When normalizing angles, an individual angle is equivalent no matter how it gets normalized, but if you're summing or averaging them it can screw things up. E.g., average of {2.9, 3.0, 3.1, -3.1, -3.0, -2.9} is 0, but you'd want the result to be something more like pi.
Normalization should be irrelevant because everything is already relative.
I might be on to something though. I'm wondering if the inaccuracy is coming from the original absoluteBearing
being used to calculate LV and AV. Should it be updated with angular velocities?
You'd need to keep a list of the positions you were in and backtrace the enemy movement until the wave could originate at your location - a sort of backwards wave, as it were, otherwise you are getting the angular velocities from your current location, not from where you were when you wanted to fire. Also, are the indexes for the VCS calculated using the values from when you were firing, or when you are having the wave hit?
All segmentation is calculated when the wave is fired.
Why do you think I'm getting the angular velocities relative to EM's current location? I store the absoluteBearing
from the tick in which the wave was fired, and both e.getVelocity()
and e.getHeadingRadians()
are absolute and shouldn't be relative to anything.
Thanks
Ah, OK, looking at the source I see that you've still kept the wave structure, I thought you had completely gotten rid of it and then each tick look back to see what wave would hit now over the last N ticks of bullet flight time and retro-actively construct the wave from the conditions as they were then. What you've done isn't quite that drastic =)
As for what is different, have you tried projecting the point back into the cartesian plane and printing it to see if it is the same as the actual enemy location? How about using both types of tracking at once and seeing if they are giving the same results at wave-hit time?
Here is a sample of the console output from a match against Aristocles:
^^^ TEXT TRUNCATED ^^^ New Method - Tick: 344 - 0.1798738671449884 New Method - Tick: 344 - 0.11492236435110015 Old Method - Tick: 344 - 0.0200222808749686 Old Method - Tick: 345 - 0.028757669631511718 New Method - Tick: 346 - -0.07262909965150746 New Method - Tick: 347 - -0.02108914153291682 New Method - Tick: 347 - -0.07855921751240094 New Method - Tick: 348 - 0.11079759883864017 New Method - Tick: 349 - 0.15410365995543632 Old Method - Tick: 349 - 0.04707213676089239 New Method - Tick: 349 - -0.03545519212801271 New Method - Tick: 350 - -0.04439025619027579 Old Method - Tick: 350 - 0.059104166333727726 Old Method - Tick: 351 - 0.0722794084663434 Old Method - Tick: 352 - 0.08652496719119096 New Method - Tick: 352 - 0.03057106866829968 Old Method - Tick: 353 - 0.10176158366761712 New Method - Tick: 354 - 0.09500860956537417 New Method - Tick: 354 - -0.089627134297345 New Method - Tick: 354 - 0.12370229920343412 New Method - Tick: 354 - -0.1033551530891642 New Method - Tick: 354 - 0.11486719105328577 New Method - Tick: 354 - -0.060415810991293305 Old Method - Tick: 355 - 0.127325640542705 Old Method - Tick: 356 - 0.1457587814691239 New Method - Tick: 356 - -0.010250535520332022 Old Method - Tick: 357 - 0.16499953286505686 New Method - Tick: 358 - 0.016229385132862713 Old Method - Tick: 358 - 0.1769165577266314 New Method - Tick: 359 - 0.006531879799494966 Old Method - Tick: 359 - 0.19518533788272618 New Method - Tick: 359 - 0.24022781156742196 New Method - Tick: 359 - 0.0590306738468773 Old Method - Tick: 360 - 0.21276457577061336 Old Method - Tick: 361 - 0.22402132774203376 New Method - Tick: 362 - -0.07261499060296339 Old Method - Tick: 362 - 0.23830349497916203 New Method - Tick: 363 - 0.1559890577968009 New Method - Tick: 363 - -0.23698463075891604 Old Method - Tick: 363 - 0.24877226021380805 New Method - Tick: 364 - -0.1536049369407098 Old Method - Tick: 364 - 0.25906235594994675 New Method - Tick: 364 - -0.2912958283677003 New Method - Tick: 364 - 0.15356974015169342 Old Method - Tick: 365 - 0.26939609391689245 New Method - Tick: 365 - 0.3047807404030586 New Method - Tick: 365 - -0.3034599665822747 Old Method - Tick: 366 - 0.2794241576704979 New Method - Tick: 366 - -0.26615581658208165 Old Method - Tick: 367 - 0.2868049364186809 Old Method - Tick: 368 - 0.29005867699773225 New Method - Tick: 368 - -0.15757594215937057 Old Method - Tick: 369 - 0.2927956811103609 New Method - Tick: 370 - 0.1233645567247041 Old Method - Tick: 370 - 0.29083266538793695 Old Method - Tick: 371 - 0.2857565463174718 Old Method - Tick: 372 - 0.27695779383631947 Old Method - Tick: 373 - 0.2650845907605712 New Method - Tick: 373 - 0.27629702474007245 New Method - Tick: 373 - 0.19788379591019697 New Method - Tick: 373 - -0.014517608066964397 New Method - Tick: 374 - 0.033346046645772856 Old Method - Tick: 374 - 0.25010614540651654 New Method - Tick: 374 - -0.01020010257163133 Old Method - Tick: 375 - 0.22039759438434992 Old Method - Tick: 376 - 0.1970258039922601 New Method - Tick: 377 - -0.0356022805942101 Old Method - Tick: 377 - 0.17178412424636202 Old Method - Tick: 378 - 0.14594712412686528 New Method - Tick: 379 - 0.12383398614292312 New Method - Tick: 379 - -0.13197212177028367 Old Method - Tick: 379 - 0.12031954184394 New Method - Tick: 379 - -0.11702579110798299 Old Method - Tick: 380 - 0.09490400801774856 Old Method - Tick: 381 - 0.06966043347249218 Old Method - Tick: 381 - 0.05689014420318683 New Method - Tick: 382 - 0.006500144256413121 Old Method - Tick: 382 - 0.03530042054297566 New Method - Tick: 382 - -0.03131550029883694 New Method - Tick: 383 - 0.03944001409022628 Old Method - Tick: 383 - 0.017089836320882457 New Method - Tick: 383 - -0.032935628765503065 Old Method - Tick: 384 - 0.0022112358025561107 New Method - Tick: 384 - 0.037821101157178835 Old Method - Tick: 385 - -0.006224232245795491 New Method - Tick: 385 - 0.033282009633441814 New Method - Tick: 386 - -0.008552442685336111 Old Method - Tick: 386 - -0.006145794717080655 New Method - Tick: 386 - -0.02285761018790913 New Method - Tick: 386 - 0.007696491162579268 Old Method - Tick: 387 - -0.003627740452873507 Old Method - Tick: 388 - 0.0034375409585805095 New Method - Tick: 388 - 0.0332063694418352 Old Method - Tick: 389 - 0.00866265694156998 New Method - Tick: 390 - -0.0036449063373945167 New Method - Tick: 391 - 0.012846961527443801 Old Method - Tick: 391 - 0.016255360285823972 New Method - Tick: 391 - -0.03254898287973662 Old Method - Tick: 392 - 0.020776121159288286 New Method - Tick: 392 - 0.04195445718576423 Old Method - Tick: 393 - 0.020828264386091755 Old Method - Tick: 394 - 0.016241240431943416 New Method - Tick: 395 - 0.015401666261466674 Old Method - Tick: 395 - 0.008471932774098967 New Method - Tick: 395 - -0.03057483993739734 New Method - Tick: 395 - 0.0010379687190521048 Old Method - Tick: 396 - -0.002511362740282408 Old Method - Tick: 397 - -0.01668500701074538 New Method - Tick: 398 - 0.0277088382426191 Old Method - Tick: 398 - -0.0340388357342174 New Method - Tick: 398 - -0.025140268298184026 New Method - Tick: 399 - -0.035859212932112514 Old Method - Tick: 399 - -0.05456359192725335 New Method - Tick: 399 - 0.06631270345598508 Old Method - Tick: 400 - -0.07662412348383918 New Method - Tick: 400 - -0.04938239250069762 Old Method - Tick: 401 - -0.10010601139235664 New Method - Tick: 402 - -0.10828049886212268 New Method - Tick: 403 - 0.152613833674192 New Method - Tick: 404 - -0.12951481173024176 New Method - Tick: 404 - 0.166857848915775 New Method - Tick: 406 - -0.186233933311901 Old Method - Tick: 408 - -0.24580411736442098 New Method - Tick: 408 - 0.10987014664393165 New Method - Tick: 409 - 0.008772599436872475 Old Method - Tick: 409 - -0.26283485331547674 New Method - Tick: 410 - 0.004246794890332152 Old Method - Tick: 410 - -0.2765666065347592 New Method - Tick: 411 - -0.2171878856923661 Old Method - Tick: 411 - -0.28799271047600605 Old Method - Tick: 412 - -0.29379052436069486 New Method - Tick: 412 - 0.055950797523121265 Old Method - Tick: 413 - -0.30041463241101596 Old Method - Tick: 414 - -0.2965116590645007 Old Method - Tick: 415 - -0.298217133326548 Old Method - Tick: 416 - -0.29852866288683777 New Method - Tick: 416 - -0.28603215994367964 New Method - Tick: 416 - -0.0894936629368437 Old Method - Tick: 418 - -0.284645464592312 Old Method - Tick: 419 - -0.28410474060949875 New Method - Tick: 420 - -0.2902103036206202 Old Method - Tick: 420 - -0.2838041174391217 Old Method - Tick: 421 - -0.2835538289948798 New Method - Tick: 421 - 0.28132610420980625 New Method - Tick: 422 - 0.034155471722019645 Old Method - Tick: 422 - -0.2833556556038541 New Method - Tick: 423 - 0.030562709226017018 Old Method - Tick: 423 - -0.2865723168841965 Old Method - Tick: 424 - -0.2902481860657551 New Method - Tick: 424 - -0.019343128666514817 Old Method - Tick: 425 - -0.29816986621790753 New Method - Tick: 426 - -0.35796709696322593 New Method - Tick: 426 - -0.31377757591919647 Old Method - Tick: 426 - -0.3106534598024021 Old Method - Tick: 427 - -0.3250335155284345 New Method - Tick: 428 - 0.39003393820396487 Old Method - Tick: 428 - -0.341140485267303 New Method - Tick: 428 - -0.15772997609692452 New Method - Tick: 429 - -0.30445838198233965 New Method - Tick: 429 - 0.3989294995816096 New Method - Tick: 429 - 0.36365421374533685 Old Method - Tick: 429 - -0.3589935064147616 Old Method - Tick: 430 - -0.37880097674960034 New Method - Tick: 431 - 0.14511901613771824 Old Method - Tick: 431 - -0.3958094308205258 New Method - Tick: 432 - 0.14340055137114813 New Method - Tick: 432 - 0.41816870417890933 Old Method - Tick: 432 - -0.410140170516045 Old Method - Tick: 433 - -0.4233404931399898 New Method - Tick: 434 - 0.2640196559493896 New Method - Tick: 434 - 0.3498759076518825 Old Method - Tick: 434 - -0.43526126407826116 New Method - Tick: 435 - 0.26462557868592 New Method - Tick: 435 - 0.353247545591311 Old Method - Tick: 435 - -0.4460449818819603 New Method - Tick: 436 - 0.2650067069608541 Old Method - Tick: 436 - -0.4555486719808952 New Method - Tick: 436 - 0.37129771196292966 Old Method - Tick: 437 - -0.46388709220122415 New Method - Tick: 438 - -0.2840920775617402 Old Method - Tick: 438 - -0.47091646324872016 New Method - Tick: 438 - -0.4337666049699406 New Method - Tick: 438 - -0.26169821575022806 New Method - Tick: 439 - -0.2924776081295178 New Method - Tick: 439 - -0.48135199972271525 Old Method - Tick: 439 - -0.4767534875129176 Old Method - Tick: 440 - -0.4749960886587985 Old Method - Tick: 441 - -0.4865439575057522 Old Method - Tick: 442 - -0.4968620645003998 Old Method - Tick: 443 - -0.5041279052339691 Old Method - Tick: 444 - -0.5085518861319942 Old Method - Tick: 445 - -0.5104434857816269 Old Method - Tick: 446 - -0.5119595281544109 Old Method - Tick: 447 - -0.5136980081998512 Old Method - Tick: 447 - -0.5005142070932074 New Method - Tick: 447 - 0.508199078507455 New Method - Tick: 448 - -0.33840896519113434 New Method - Tick: 448 - -0.5238758526911147 Old Method - Tick: 448 - -0.49890504297689553 Old Method - Tick: 449 - -0.4936730615099707 New Method - Tick: 449 - -0.23007526285278745 New Method - Tick: 449 - 0.1565441795684511 Old Method - Tick: 450 - -0.4847792916824867 Old Method - Tick: 451 - -0.47234588554370927 Old Method - Tick: 451 - -0.4599934005719106 New Method - Tick: 452 - 0.2532485878377148 Old Method - Tick: 452 - -0.4458898704875587 New Method - Tick: 453 - -0.34222735772456864 New Method - Tick: 453 - -0.45695424739283175 Old Method - Tick: 453 - -0.42982231366928936 New Method - Tick: 453 - 0.4363054744297578 Old Method - Tick: 453 - -0.41766524889197143 New Method - Tick: 454 - 0.49336230877618215 Old Method - Tick: 454 - -0.39948690145298205 Old Method - Tick: 454 - -0.38710742859016456 Old Method - Tick: 455 - -0.36664083432927175 New Method - Tick: 456 - 0.4744804226454285 Old Method - Tick: 456 - -0.34373380632982276 Old Method - Tick: 456 - -0.33384456412993746 New Method - Tick: 457 - 0.19298422577021296 New Method - Tick: 457 - -0.39582549566526726 Old Method - Tick: 457 - -0.3098089184121804 Old Method - Tick: 457 - -0.2965322571308304 New Method - Tick: 457 - -0.1321163392831117 New Method - Tick: 458 - -0.3416356881815959 Old Method - Tick: 458 - -0.27417790166755296 New Method - Tick: 458 - 0.12729738166119414 Old Method - Tick: 459 - -0.24937133377339826 Old Method - Tick: 459 - -0.23545279208572722 New Method - Tick: 460 - 0.2668321538874437 New Method - Tick: 460 - 0.30927583727586905 Old Method - Tick: 460 - -0.20749120164337143 Old Method - Tick: 460 - -0.19302372936007295 Old Method - Tick: 461 - -0.1617900209043892 New Method - Tick: 462 - -0.21433042083845397 Old Method - Tick: 462 - -0.12732036902789012 Old Method - Tick: 462 - -0.11173134903674509 New Method - Tick: 463 - -0.26285207980167 Old Method - Tick: 463 - -0.07606932579266168 New Method - Tick: 464 - 0.27337651356571885 New Method - Tick: 464 - -0.25624839014636824 Old Method - Tick: 464 - -0.039838922288355505 Old Method - Tick: 464 - -0.02302631457777693 New Method - Tick: 465 - 0.010600984521355602 New Method - Tick: 465 - -0.05948136409272999 New Method - Tick: 465 - 0.056528452470596305 Old Method - Tick: 465 - 0.014289010951157088 New Method - Tick: 466 - 0.06279123551779103 Old Method - Tick: 466 - 0.05227516239931784 New Method - Tick: 467 - 0.1822351567060888 Old Method - Tick: 467 - 0.09086698924052783 Old Method - Tick: 467 - 0.10900848794388907 New Method - Tick: 467 - 0.12099444547636735 New Method - Tick: 467 - -0.15548631077267644 New Method - Tick: 467 - 0.10703257407067901 New Method - Tick: 468 - -0.023857556135259056 New Method - Tick: 468 - 0.13954510334049416 New Method - Tick: 468 - -0.12567626744650046 Old Method - Tick: 468 - 0.14288140603193078 New Method - Tick: 469 - -0.038449038995171464 New Method - Tick: 469 - 0.10247231898550029 New Method - Tick: 469 - -0.0910379716161322 Old Method - Tick: 469 - 0.1715647653631036 New Method - Tick: 470 - -0.06206039191070271 New Method - Tick: 470 - 0.12240744769633431 Old Method - Tick: 470 - 0.19549936060263384 New Method - Tick: 471 - 0.012293148627892818 Old Method - Tick: 471 - 0.21463784476017977 Old Method - Tick: 471 - 0.23380859354760908 New Method - Tick: 472 - -0.0996561715586668 New Method - Tick: 472 - 0.18917172386434236 Old Method - Tick: 472 - 0.2507094611316685 New Method - Tick: 472 - -0.26223599475496845 New Method - Tick: 472 - 0.3071237792366731 New Method - Tick: 472 - 0.02694244681283218 New Method - Tick: 473 - 0.02500692906095217 Old Method - Tick: 473 - 0.2615042238687266 Old Method - Tick: 474 - 0.26500118205333756 New Method - Tick: 474 - -0.25082440240631754 Old Method - Tick: 475 - 0.26912680494804064 New Method - Tick: 476 - 0.06604072258541925 New Method - Tick: 476 - -0.11821904631546168 Old Method - Tick: 476 - 0.27162973950285263 Old Method - Tick: 476 - 0.2697011136733316 Old Method - Tick: 477 - 0.26768047012552554 New Method - Tick: 477 - 0.24135660160163708 Old Method - Tick: 478 - 0.26476488542787635 New Method - Tick: 479 - -0.2646788485209207 Old Method - Tick: 479 - 0.2731896668035496 New Method - Tick: 480 - 0.21510667571435313 Old Method - Tick: 480 - 0.2647679623016579 Old Method - Tick: 481 - 0.24933744217932485 New Method - Tick: 481 - -0.16345484736249813 New Method - Tick: 481 - 0.04974512540557471 Old Method - Tick: 482 - 0.22867575649417304 New Method - Tick: 483 - -0.037778065631310316 New Method - Tick: 484 - 0.17492112852141206 Old Method - Tick: 484 - 0.17198620170937495 New Method - Tick: 485 - -0.17024044768211005 Old Method - Tick: 485 - 0.14138337260315925 New Method - Tick: 486 - -0.018256727333968152 Old Method - Tick: 486 - 0.10554382823739417 New Method - Tick: 486 - 0.10655362810616158 Old Method - Tick: 487 - 0.06728616672348231 Old Method - Tick: 488 - 0.026601092517447356 New Method - Tick: 489 - 0.02639223861372627 Old Method - Tick: 489 - -0.01581097540614884 Old Method - Tick: 490 - -0.057976905851710114 Old Method - Tick: 491 - -0.0998113132731886 New Method - Tick: 492 - 0.08309587986181774 Old Method - Tick: 492 - -0.13573820704073647 New Method - Tick: 492 - -0.03572591834447104 Old Method - Tick: 493 - -0.1661562043785505 New Method - Tick: 494 - -0.17914233302837979 New Method - Tick: 494 - 0.15917010215009367 Old Method - Tick: 497 - -0.2447986943633067 New Method - Tick: 498 - 0.044648482146917946 New Method - Tick: 498 - -0.16866162113431948 Old Method - Tick: 498 - -0.25688335642707116 New Method - Tick: 499 - 0.0469596049539631 Old Method - Tick: 499 - -0.2614486450091178 Old Method - Tick: 500 - -0.2656660501154269 New Method - Tick: 501 - -0.2707994680623969 New Method - Tick: 502 - 0.2587827592904405 Old Method - Tick: 502 - -0.26724613883515946 New Method - Tick: 502 - 0.05564100795220878 Old Method - Tick: 503 - -0.266371858591155 Old Method - Tick: 504 - -0.2657735040032936 New Method - Tick: 504 - -0.2292179428986012 New Method - Tick: 505 - 0.25340024453665677 Old Method - Tick: 505 - -0.2651428735498129 New Method - Tick: 506 - -0.16123272382242135 Old Method - Tick: 506 - -0.2571319017554625 Old Method - Tick: 506 - -0.25712149570293885 New Method - Tick: 507 - 0.03929723974283527 Old Method - Tick: 507 - -0.23989525154072844 Old Method - Tick: 508 - -0.21736157397184286 New Method - Tick: 509 - 0.2058942530583607 Old Method - Tick: 509 - -0.1892883159168317 Old Method - Tick: 509 - -0.17926579185813463 New Method - Tick: 510 - -0.1798942319289387 Old Method - Tick: 510 - -0.1568735682277742 Old Method - Tick: 510 - -0.14397010462550863 New Method - Tick: 511 - 0.07810969068283341 Old Method - Tick: 511 - -0.10542923759543577 New Method - Tick: 511 - -0.0921180465934051 New Method - Tick: 511 - 0.038049463638894554 Old Method - Tick: 512 - -0.0636307769533282 New Method - Tick: 512 - 0.04536290341816658 Old Method - Tick: 512 - -0.042570389306223255 New Method - Tick: 513 - -0.09856374638226037 Old Method - Tick: 513 - 0.0023237314566220135 New Method - Tick: 514 - 0.05869297915957322 Old Method - Tick: 514 - 0.04783771433636019 New Method - Tick: 514 - 0.007514174727654829 New Method - Tick: 515 - -0.07132933707850095 Old Method - Tick: 515 - 0.09391585520909196 New Method - Tick: 515 - -0.13350032361945777 New Method - Tick: 515 - 0.10966909164525457 New Method - Tick: 516 - 0.03431353092685463 New Method - Tick: 516 - -0.06535883414209281 Old Method - Tick: 516 - 0.14046156856131553 New Method - Tick: 516 - 0.14517394071016737 Old Method - Tick: 516 - 0.16311846814753395 New Method - Tick: 517 - 0.02678398641086776 Old Method - Tick: 517 - 0.18125901089735397 Old Method - Tick: 517 - 0.20400647983610298 Old Method - Tick: 518 - 0.23839737797471905 New Method - Tick: 519 - -0.24993242047494296 Old Method - Tick: 519 - 0.2619734772556086 New Method - Tick: 519 - 0.31497178060455416 Old Method - Tick: 520 - 0.28131803697981717 New Method - Tick: 520 - -0.060455259921373884 Old Method - Tick: 521 - 0.29290033395189496 New Method - Tick: 522 - -0.07502984289909014 Old Method - Tick: 522 - 0.2960367157168413 New Method - Tick: 522 - -0.29619178040319977 Old Method - Tick: 523 - 0.2899908526755475 New Method - Tick: 523 - 0.22169448823247304 Old Method - Tick: 524 - 0.2760204846278116 Old Method - Tick: 525 - 0.25577027201679137 New Method - Tick: 526 - 0.15245120142562935 New Method - Tick: 526 - -0.22812338529550522 Old Method - Tick: 526 - 0.22930969968853532 Old Method - Tick: 527 - 0.19668849565923807 Old Method - Tick: 528 - 0.16725117335496087 Old Method - Tick: 529 - 0.14110692751317888 New Method - Tick: 530 - 0.1412167984332873 Old Method - Tick: 530 - 0.10884652853130561 Old Method - Tick: 531 - 0.07964887886982464 New Method - Tick: 531 - -0.0810958634673436 New Method - Tick: 531 - 5.897452652249852E-4 New Method - Tick: 532 - 0.01902162842853444 New Method - Tick: 532 - -0.08149230223197829 Old Method - Tick: 532 - 0.05497008902185918 Old Method - Tick: 533 - 0.03326246412528633 New Method - Tick: 533 - 0.042695473939825736 Old Method - Tick: 534 - 0.014584881686217521 New Method - Tick: 535 - 0.020269013411352108 Old Method - Tick: 535 - -9.690074222916678E-4 New Method - Tick: 536 - -0.009596987690487153 Old Method - Tick: 536 - -0.022698811856896484 New Method - Tick: 536 - 0.01943110788083105 Old Method - Tick: 536 - -0.04758080623707883 Old Method - Tick: 537 - -0.06598990578246333 New Method - Tick: 538 - 0.018835370643752222 Old Method - Tick: 538 - -0.07467365319832098 New Method - Tick: 539 - -0.035456421395411754 New Method - Tick: 539 - -0.061056158782288504 Old Method - Tick: 539 - -0.08368798941205657 New Method - Tick: 539 - 0.04190673169846087 Old Method - Tick: 540 - -0.08311431685420168 Old Method - Tick: 541 - -0.07291687943394187 New Method - Tick: 542 - 0.05769422064795285 Old Method - Tick: 542 - -0.05643122097141684 New Method - Tick: 543 - -0.018503081588482 New Method - Tick: 543 - -0.04231620583648981 Old Method - Tick: 543 - -0.03374614546503585 New Method - Tick: 543 - 0.01682262513855787 New Method - Tick: 544 - 0.015501153805450427 Old Method - Tick: 544 - -0.0049686422443038225 New Method - Tick: 545 - -0.013208912037196915 Old Method - Tick: 545 - 0.029736782213975577 New Method - Tick: 545 - -0.012661903080969608 Old Method - Tick: 546 - 0.06999273507585069 New Method - Tick: 546 - 0.07214868477423399 New Method - Tick: 546 - -0.020117819029679622 Old Method - Tick: 547 - 0.11257498982935532 Old Method - Tick: 548 - 0.15675215836404144 New Method - Tick: 548 - -0.1670853333757256 New Method - Tick: 548 - -0.07283786682336481 Old Method - Tick: 549 - 0.19536375960979324 New Method - Tick: 549 - 0.23017212843685103 Old Method - Tick: 550 - 0.21875697269535332 Old Method - Tick: 551 - 0.2455376323052989 New Method - Tick: 552 - 0.0330083050561058 Old Method - Tick: 552 - 0.2694079618210987 New Method - Tick: 552 - -0.15564066699115975 Old Method - Tick: 553 - 0.2821507354130621 New Method - Tick: 553 - -0.2924143744002721 Old Method - Tick: 554 - 0.2824911546939428 Old Method - Tick: 555 - 0.27669062651924325 New Method - Tick: 555 - 0.26008665921713736 Old Method - Tick: 556 - 0.2637974319085832 New Method - Tick: 557 - 0.058142759064519475 Old Method - Tick: 557 - 0.2540467826384143 New Method - Tick: 557 - -0.1876115085104718 New Method - Tick: 558 - -0.24792638079509347 Old Method - Tick: 558 - 0.25454507966729545 Old Method - Tick: 559 - 0.2548703664537104 Old Method - Tick: 560 - 0.25525167048969966 New Method - Tick: 561 - 0.11600118570824959 Old Method - Tick: 561 - 0.26579890216887336 Old Method - Tick: 562 - 0.2761838593688304 Old Method - Tick: 563 - 0.2866128447908334 Old Method - Tick: 564 - 0.2969202811951328 New Method - Tick: 564 - -0.2740181388324343 New Method - Tick: 565 - 0.20634503267166837 Old Method - Tick: 565 - 0.30706624364667423 New Method - Tick: 566 - -0.25236612652453705 Old Method - Tick: 566 - 0.313222884543469 New Method - Tick: 567 - 0.3078270673958768 Old Method - Tick: 567 - 0.3095104990958406 New Method - Tick: 567 - -0.006545734643486848 Old Method - Tick: 568 - 0.2964133043472643 Old Method - Tick: 569 - 0.2774838827853665 Old Method - Tick: 570 - 0.2527009764430055 New Method - Tick: 571 - -0.25238054453759357 Old Method - Tick: 571 - 0.225218732731026 New Method - Tick: 572 - -0.10756332853954043 Old Method - Tick: 572 - 0.19497105677460125 New Method - Tick: 572 - 0.056675186941033164 New Method - Tick: 573 - 0.18615223915590853 Old Method - Tick: 573 - 0.16776538379857775 Old Method - Tick: 574 - 0.14356874905519912 New Method - Tick: 575 - -0.01570802316837205 Old Method - Tick: 575 - 0.12235173377070363 New Method - Tick: 575 - -0.08773334711104014 New Method - Tick: 576 - -0.025353454575477233 Old Method - Tick: 576 - 0.11345160768459284 Old Method - Tick: 576 - 0.11729707647375731 New Method - Tick: 577 - 0.09025584443520074 Old Method - Tick: 577 - 0.1213375185641854 New Method - Tick: 577 - 0.12665608972528775 New Method - Tick: 578 - -0.08232607243228518 Old Method - Tick: 578 - 0.12379969169013139 New Method - Tick: 578 - 0.05725009615201489 Old Method - Tick: 579 - 0.12578382144606914 Old Method - Tick: 579 - 0.11996712134001153 New Method - Tick: 579 - -0.1279624462458224 Old Method - Tick: 580 - 0.1093618815390105 New Method - Tick: 581 - 0.013063278883171225 Old Method - Tick: 581 - 0.0916042678944855 Old Method - Tick: 582 - 0.06690797876374832 SYSTEM: sheldor.micro.EpeeistMicro 1.9.0* has died New Method - Tick: 582 - 0.06085342630254822 New Method - Tick: 582 - -0.06258786528602456 Old Method - Tick: 582 - 0.04657607501171923 New Method - Tick: 582 - 2.8660691268322675E-4
Obviously, something isn't right. Could this be some kind of event timing error? Like how energy drops are always detected two ticks late?
I'm not sure, I'd have to see source code to properly understand what's happening here. But it seems that they aren't being registered as 'hit' at the same time. Could it be that?
That's what I assume.
Here's the current developmental code with all the debug code (I realize that it's quite a bit larger than 730 bytes.):
/*
EpeeistMicro v1.9.1 by Sheldor. 05/02/2013
A MicroBot with Stop and Go/Random movement and a guess factor gun.
Codesize: 730 Bytes without any colors.
Epee (pronounced ey-PEY) is one of the three forms of modern sport fencing,
along with Foil and Sabre. http://en.wikipedia.org/wiki/Epee
Credits:
Thanks go to the authors of the following bots:
Targeting: Falcon, pez.micro.Aristocles, voidious.mini.Komarious, kc.micro.Thorn, jam.micro.RaikoMicro, jk.mini.CunobelinDC, mld.LittleBlackBook, jk.micro.Connavar.
Movement : jk.micro.Toorkild, kc.micro.Thorn, wiki.nano.RaikoNano.
Special thanks to Jdev and Voidious for helping me with a math error.
And a general thanks to all open source bot authors and contributors to the RoboWiki.
EpeeistMicro is open source and released under the terms of the RoboWiki Public Code License (RWPCL) - Version 1.1.
See license here: http://robowiki.net/wiki/RWPCL
*/
package sheldor.micro;
import robocode.*;
import robocode.util.Utils;
import java.awt.geom.*;
public class EpeeistMicro extends AdvancedRobot
{
//Constants.
static final int GUESS_FACTORS = 25;
static final int MIDDLE_FACTOR = (GUESS_FACTORS - 1) / 2;
static final double MAXIMUM_ESCAPE_ANGLE = 0.72727272727272727272727272727273; //8 / 11
static final double FACTOR_ANGLE = MAXIMUM_ESCAPE_ANGLE / MIDDLE_FACTOR;
//Global variables.
static double averageLateralVelocity;
static double direction = 1;
static double enemyBulletSpeed;
static double enemyEnergy;
static double enemyHeading;
static double enemyVelocity;
static double enemyX;
static double enemyY;
static double hits;
static int absoluteEnemyLateralVelocity;
static int movementMode;
static int timeSinceVelocityChange;
static int ticks;
//Array to store the number of times the enemy has visited each guess factor.
//Segmented on acceleration, time since velocity change, absolute enemy lateral velocity, near wall, and distance.
static int[][][][][][] guessFactors = new int[3][4][5][2][5][GUESS_FACTORS];
//En garde!
public void run()
{
//Set the radar and gun to turn independently.
setAdjustRadarForGunTurn(true);
setAdjustGunForRobotTurn(true);
}
public void onStatus(StatusEvent e)
{
//Turn the radar every tick.
//Putting the code here instead of in the run() method saves one byte.
//I believe Wompi discovered this.
setTurnRadarRightRadians(1);
}
public void onScannedRobot(ScannedRobotEvent e)
{
//Local variables.
//Declare most used integer before most used double to save several bytes.
int antiRam;
double enemyDistance;
double absoluteBearing;
double enemyDirection;
double lateralVelocity;
double offset;
double theta;
int acceleration;
ticks = (int)getTime();
//Fire a wave.
Wave wave;
addCustomEvent(wave = new Wave());
enemyX = (wave.sourceX = getX()) + Math.sin(wave.absoluteBearing = absoluteBearing =
(e.getBearingRadians() + getHeadingRadians())) * (enemyDistance = e.getDistance());
enemyY = (wave.sourceY = getY()) + Math.cos(absoluteBearing) * enemyDistance;
/*********************************************
*---------------MOVEMENT CODE---------------*
*********************************************/
//Retreat very heavily when the enemy is ramming.
offset = 2 + (antiRam = (int)(100 / (wave.enemyDistance = enemyDistance = e.getDistance())));
//Wall smoothing based on Toorkild's.
//Subtract current coordinates from lower wall bounds instead of adding
//current coordinates to every fieldRectangle.contains() projection to save six bytes. Thanks go to Skilgannon.
Rectangle2D.Double fieldRectangle;
while(!(fieldRectangle = new Rectangle2D.Double(18 - getX(), 18 - getY(), 764, 564)).
contains(160 * Math.sin(theta = (wave.absoluteBearing = absoluteBearing =
(e.getBearingRadians() + getHeadingRadians())) + direction * (offset -= .02)), 160 * Math.cos(theta)));
setTurnRightRadians(Math.tan(theta -= getHeadingRadians()));
//Stop and Go movement based on Toorkild's.
//Move when the enemy fires, or when the robot is moving randomly, or when the enemy is ramming.
double energyDelta;
if ((energyDelta = (enemyEnergy - (enemyEnergy = e.getEnergy()))) > movementMode - antiRam)
{
//Calculate the length of Stop and Go movement based on enemy bullet power.
setAhead(((3 + (int)(energyDelta / 0.5000001)) << 3) * Math.signum(Math.cos(theta)));
}
//Random movement from Toorkild.
//Don't move randomly if the enemy is ramming, or if the bot is in Stop and Go mode.
//Reverse direction if the bot gets too close to a wall.
if (Math.random() + antiRam < (-0.6 * Math.sqrt(enemyBulletSpeed / enemyDistance) + 0.04) * movementMode || offset < Math.PI/3.5)
{
direction = -direction;
}
/********************************************
*--------------TARGETING CODE--------------*
********************************************/
//Determine the enemy's lateral velocity and movement direction.
//Use a simple rolling average to store the previous lateral direction
//if enemy lateral velocity == 0. Inspired by LittleBlackBook.
wave.enemyDirection = enemyDirection = (averageLateralVelocity = ((averageLateralVelocity * .01) +
(lateralVelocity = ((enemyVelocity = e.getVelocity()) * Math.sin((enemyHeading = e.getHeadingRadians()) - absoluteBearing))))) < 0 ? -FACTOR_ANGLE : FACTOR_ANGLE;
//Determine if the enemy is accelerating or decelerating.
if ((acceleration = (int)Math.signum(absoluteEnemyLateralVelocity - (absoluteEnemyLateralVelocity = (int)Math.abs(lateralVelocity)))) != 0)
{
timeSinceVelocityChange = 0;
}
//Determine the current situation.
//Declaring a local array saves two bytes.
double angle;
int[] guessFactorsLocal = wave.guessFactors = guessFactors
[1 + acceleration] //Acceleration.
[Math.min(3, (int)(Math.pow(280 * timeSinceVelocityChange++ / enemyDistance, .7)))] //Ticks since velocity change.
[absoluteEnemyLateralVelocity / 2] //Absolute enemy lateral velocity.
[(int)Math.signum(fieldRectangle.outcode(Math.sin(angle = (absoluteBearing +
enemyDirection * MIDDLE_FACTOR)) * enemyDistance, Math.cos(angle) * enemyDistance))] //Near wall. Many thanks go to Skilgannon for the outcode trick.
[(int)enemyDistance / 200]; //Distance.
//Find the most visited guess factor for the current situation.
//Looping like this is ugly, but it saves two bytes over the proper way.
int mostVisited = MIDDLE_FACTOR;
int i = 0;
try
{
while (true)
{
if (guessFactorsLocal[i] > guessFactorsLocal[mostVisited])
{
mostVisited = i;
}
i++;
}
}
catch(Exception ex)
{
}
//Turn the gun to the most visited guess factor.
//The slight offset helps to defeat simple bullet shielding.
setTurnGunRightRadians(0.0005 + Utils.normalRelativeAngle(absoluteBearing - getGunHeadingRadians()
+ (enemyDirection * (mostVisited - MIDDLE_FACTOR))));
//Fire medium power bullets most of the time, but use full power at very close range.
//If the enemy is weak, fire the minimum power needed to destroy them.
setFire(Math.min(2 + antiRam, enemyEnergy / 4));
//Narrow lock radar.
setTurnRadarRightRadians(2 * Utils.normalRelativeAngle(absoluteBearing - getRadarHeadingRadians()));
}
public void onBulletHit(BulletHitEvent e)
{
//Adjust enemy energy variable when the bot hits the enemy.
//This makes a big difference against linear targeting.
enemyEnergy -= 10;
}
public void onHitByBullet(HitByBulletEvent e)
{
//Adjust enemy energy variable when the bot gets hit.
//Store the velocity of the enemy bullet for the random movement.
enemyEnergy += 20 - (enemyBulletSpeed = e.getVelocity());
//If the bot takes a lot of damage on average in Stop and Go mode, switch to Random Movement.
//Thanks go to Skilgannon.
if ((hits += (4.25 / enemyBulletSpeed)) > getRoundNum() + 2)
{
movementMode = -1;
}
}
static class Wave extends Condition
{
//Global variables.
double absoluteBearing;
double bearingOffset;
double enemyDirection;
double enemyDistance;
double sourceX;
double sourceY;
double waveDistanceTraveled;
double distanceTraveled;
int[] guessFactors;
public boolean test()
{
//Update the bearing offset with angular velocities.
bearingOffset += (enemyVelocity * Math.sin(enemyHeading -= absoluteBearing)) / (enemyDistance += (enemyVelocity * Math.cos(enemyHeading/* - absoluteBearing*/)));
//Check if the wave has passed the enemy's current location.
if (Math.abs((waveDistanceTraveled += 14) - enemyDistance) <= 7)
{
//Calculate the guess factor that would have hit the enemy.
//Increment the bin that represents that guess factor.
guessFactors[(int)Math.round((bearingOffset / enemyDirection) + MIDDLE_FACTOR)]++;
System.out.println("New Method - Tick: " + ticks + " - " + bearingOffset);
}
if (Math.abs((distanceTraveled += 14) - Point2D.distance(sourceX, sourceY, enemyX, enemyY)) <= 7)
{
//Calculate the guess factor that would have hit the enemy.
//Increment the bin that represents that guess factor.
System.out.println("Old Method - Tick: " + ticks + " - " + Utils.normalRelativeAngle(Math.atan2(enemyX - sourceX,
enemyY - sourceY) - absoluteBearing));
}
return false;
}
}
}
Thanks
Doing enemyHeading -= absoluteBearing
in the test() method breaks things because many waves are evaluated each tick, but even after fixing that I'm seeing very different values for Point2D.distance(sourceX, sourceY, enemyX, enemyY)
and enemyDistance
, which is where I suspect the errors are creeping in. Of course, I can't see anything wrong with what you are doing :-/ Maybe a step-by-step printing/debugging with only one wave in the air would let you see how enemyDistance
is deviating from the old value on a per-tick basis?
For some reason, enemyDistance
is always 20-40 pixels less than the Point2D.distance()
calculation.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
Return to Thread:Talk:ÉpéeistMicro/MicroBot champ!/reply (16).