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;
and here angles i've written robolog ; 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
Post a Comment