java - How to fix angular precision at robocode ? -


i've started playing robocode , i've encountered angle problem @ first robot project. i've wright following code in order shot enemies nearby ;

public void onscannedrobot(scannedrobotevent e) {      double radarangle ;      double gunzeroangle ;     double difference ;     radarangle = getradarheading ();     gunzeroangle = getgunheading () ;     difference = radarangle - gunzeroangle  ;     system.out.print("target :" + radarangle + "\nzero : "+ gunzeroangle +" \nfark : "+ diff + " \n "+ " *********************** "+ "\n" );       if (fark != 0) {         turngunright (fark) ;         fire(1); 

my problem when enemies far away there dead angles gun can't swipe this; enter image description here enter image description here

and here angles i've written robolog ; enter image description here guess angle differences less 1 degree problem. sample robots "corners" can focus on target @ angle. can me ???

you should heading of scanned robot

scannedrobotevent 

then turn gun direction , fire.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -