Uma Ajuda Urgente

[code]package jm;
import robocode.*;

public class Wing_Gundam_Zero_Custom extends AdvanceRobot
{
private int hitCount;

public void run() {
	setTurnGunRight (Double.POSITIVE_INFINITY);
	
	while (true) {
		double direction = getHeading();
	double amount = Math.abs (270 - direction);
	
	if (direction > 270)
			turnLeft (amount);
	else
			turnRight (amount);	
	
	ahead(getX());
	turnGunRight(90);
	ahead(getBatleFieldHeight() - getY());
	
	turnGunRight(90);
	ahead(getBatleFieldWidth());
	
	turnGunRight(90);
	ahead(getBatleFieldHeight());
	
	turnGunRight(90);
	ahead(getBatleFieldWidth());
	}
}


public void onScannedRobot(ScannedRobotEvent e) {
	if (e.getBearing()>-10 && e.getBearing() <10)
	    fire(3);
else
       fire(2);
}


public void onHitByBullet(HitByBulletEvent e) {
	if (hitCount < 3)
		hitCount++;
	else
		{
		turnRight(45);
		ahead(100);
		hitCount = 0;
	}
}

}
[/code]

esse é meu codigo do meu Robocode, mas nao ta compilando nao sei oq é, e eu tbm queria q alguem me ajudasse a melhorar ele, por favor me ajudem…

Abaixo eu coloquei os Erros…

[code]Compiling…

Found 19 semantic errors compiling "C:/robocode/robots/jm/Wing_Gundam_Zero_Custom.java":

 4. public class Wing_Gundam_Zero_Custom extends AdvanceRobot
                                                 <---------->

*** Error: Type jm/AdvanceRobot was not found.

 9.         setTurnGunRight (Double.POSITIVE_INFINITY);
            <---------------------------------------->

*** Error: No method named "setTurnGunRight" was found in type "jm/Wing_Gundam_Zero_Custom".

12.             double direction = getHeading();
                                   <---------->

*** Error: No method named "getHeading" was found in type "jm/Wing_Gundam_Zero_Custom".

16.                 turnLeft (amount);
                    <--------------->

*** Error: No method named "turnLeft" was found in type "jm/Wing_Gundam_Zero_Custom".

18.                 turnRight (amount);    
                    <---------------->

*** Error: No method named "turnRight" was found in type "jm/Wing_Gundam_Zero_Custom".

20.         ahead(getX());
                  <---->

*** Error: No method named "getX" was found in type "jm/Wing_Gundam_Zero_Custom".

21.         turnGunRight(90);
            <-------------->

*** Error: No method named "turnGunRight" was found in type "jm/Wing_Gundam_Zero_Custom".

22.         ahead(getBatleFieldHeight() - getY());
                  <------------------->

*** Error: No method named "getBatleFieldHeight" was found in type "jm/Wing_Gundam_Zero_Custom".

22.         ahead(getBatleFieldHeight() - getY());
                                          <---->

*** Error: No method named "getY" was found in type "jm/Wing_Gundam_Zero_Custom".

24.         turnGunRight(90);
            <-------------->

*** Error: No method named "turnGunRight" was found in type "jm/Wing_Gundam_Zero_Custom".

25.         ahead(getBatleFieldWidth());
                  <------------------>

*** Error: No method named "getBatleFieldWidth" was found in type "jm/Wing_Gundam_Zero_Custom".

27.         turnGunRight(90);
            <-------------->

*** Error: No method named "turnGunRight" was found in type "jm/Wing_Gundam_Zero_Custom".

28.         ahead(getBatleFieldHeight());
                  <------------------->

*** Error: No method named "getBatleFieldHeight" was found in type "jm/Wing_Gundam_Zero_Custom".

30.         turnGunRight(90);
            <-------------->

*** Error: No method named "turnGunRight" was found in type "jm/Wing_Gundam_Zero_Custom".

31.         ahead(getBatleFieldWidth());
                  <------------------>

*** Error: No method named "getBatleFieldWidth" was found in type "jm/Wing_Gundam_Zero_Custom".

38.             fire(3);
                <----->

*** Error: No method named "fire" was found in type "jm/Wing_Gundam_Zero_Custom".

40.            fire(2);
               <----->

*** Error: No method named "fire" was found in type "jm/Wing_Gundam_Zero_Custom".

49.             turnRight(45);
                <----------->

*** Error: No method named "turnRight" was found in type "jm/Wing_Gundam_Zero_Custom".

50.             ahead(100);
                <-------->

*** Error: No method named "ahead" was found in type "jm/Wing_Gundam_Zero_Custom".
Compile Failed (1)
[/code][/quote]

Leia a mensagem de erro com atencao e voce vera:

Error: Type jm/AdvanceRobot was not found. 

ou seja, o compilador nao encontrou a classe “AdvanceRobot”. Verifique se ela esta no CLASSPATH corretamente, ou se a estrutura de diretorios esta de acordo com o esperado ( em relacao aos packages ).

Por exemplo, se vc estiver no diretorio c:/java/robocode ao rodar o javac, devera ter o arquivo AdvanceRobot.java em c:/java/robocode/jm …

Rafael

[quote=“Rafael Steil”]Leia a mensagem de erro com atencao e voce vera:

Error: Type jm/AdvanceRobot was not found. 

ou seja, o compilador nao encontrou a classe “AdvanceRobot”. Verifique se ela esta no CLASSPATH corretamente, ou se a estrutura de diretorios esta de acordo com o esperado ( em relacao aos packages ).

Por exemplo, se vc estiver no diretorio c:/java/robocode ao rodar o javac, devera ter o arquivo AdvanceRobot.java em c:/java/robocode/jm …

Rafael[/quote]

Não entendi oq vc quis dizer, aonde eu estou errando?

O compilador nao encontrou a classe que ele acusa erro… simples assim…

A classe se chama exatamente “AdvanceRobot”… nao eh "AdvancedRobot " ou algo do estilo?

Rafael

[code]package hy;
import robocode.*;
import java.awt.Color;
//import java.awt.Color;

/**

  • Wing_Gundam_Zero_Custom - a robot by (your name here)
    */
    public class Wing_Gundam_Zero_Custom extends AdvancedRobot

{
private int hitCount;
/**
* run: Wing_Gundam_Zero_Custom’s default behavior
*/
public void run() {
setTurnGunRight(Double.POSITIVE_INFINITY);

	while (true){
		double direction = getHeading();
	double amount = Math.abs(270 - direction);
	
	if (direction > 270)
			turnLeft (amount);
	else
			turnRight (amount);	
	
	ahead(getX());
	turnGunRight(90);
	ahead(getBatleFieldHeight() - getY());
	
	turnGunRight(90);
	ahead(getBatleFieldWidth());
	
	turnGunRight(90);
	ahead(getBatleFieldHeight());
	
	turnGunRight(90);
	ahead(getBatleFieldWidth());
	}
}

/**
 * onScannedRobot: What to do when you see another robot
 */
public void onScannedRobot(ScannedRobotEvent e) {
	if (e.getBearing()>-10 && e.getBearing() <10)
	    fire(3);
else
       fire(2);
}

/**
 * onHitByBullet: What to do when you're hit by a bullet
 */
public void onHitByBullet(HitByBulletEvent e) {
	if (hitCount < 3)
		hitCount++;
	else{
		turnRight(45);
		ahead(100);
		hitCount = 0;
	}
}

}
[/code]

Eu dei uma modificada e apareceram esses erros agora…

[code]Compiling…

Found 4 semantic errors compiling "C:/robocode/robots/hy/Wing_Gundam_Zero_Custom.java":

30.         ahead(getBatleFieldHeight() - getY());
                  <------------------->

*** Error: No method named "getBatleFieldHeight" was found in type "hy/Wing_Gundam_Zero_Custom". However, there is an accessible method "getBattleFieldHeight" whose name closely matches the name "getBatleFieldHeight".

33.         ahead(getBatleFieldWidth());
                  <------------------>

*** Error: No method named "getBatleFieldWidth" was found in type "hy/Wing_Gundam_Zero_Custom". However, there is an accessible method "getBattleFieldWidth" whose name closely matches the name "getBatleFieldWidth".

36.         ahead(getBatleFieldHeight());
                  <------------------->

*** Error: No method named "getBatleFieldHeight" was found in type "hy/Wing_Gundam_Zero_Custom". However, there is an accessible method "getBattleFieldHeight" whose name closely matches the name "getBatleFieldHeight".

39.         ahead(getBatleFieldWidth());
                  <------------------>

*** Error: No method named "getBatleFieldWidth" was found in type "hy/Wing_Gundam_Zero_Custom". However, there is an accessible method "getBattleFieldWidth" whose name closely matches the name "getBatleFieldWidth".
Compile Failed (1)
[/code]

Humm, eu sei o que está acontecendo…

Você está tentando compilar, o compilador esta mostrando erros, e você copia/cola eles aqui no fórum sem ao menos tentar ler e entender…

Cara, presta atenção…

olha o erro e olha a sugestão que o compilador está te dando!

O segredo é ler o erro e tentar tirar conclusões dele

[]´s

[quote=“Vegetto”]Humm, eu sei o que está acontecendo…

Você está tentando compilar, o compilador esta mostrando erros, e você copia/cola eles aqui no fórum sem ao menos tentar ler e entender…

Cara, presta atenção…

olha o erro e olha a sugestão que o compilador está te dando!

O segredo é ler o erro e tentar tirar conclusões dele

[]´s[/quote]

Eu arrumei alguns erros, eu coloquei esses erros pq eu nao consegui arrumar e pedi ajuda. Nao estou sendo preguiçoso como vc está dizendo.

Certo, devo ter me expressado mal, mas olhe bem para o erro

30. ahead(getBatleFieldHeight() - getY()); <-------------------> *** Error: No method named "getBatleFieldHeight" was found in type "hy/Wing_Gundam_Zero_Custom". However, there is an accessible method "getBattleFieldHeight" whose name closely matches the name "getBatleFieldHeight".

o método getBatleFieldHeight não foi encontrado, entretanto há um método acessivel com um nome parecido getBattleFieldHeight

logo, da para perceber que o erro esta na grafia da chamada do método

[quote=“Vegetto”]Certo, devo ter me expressado mal, mas olhe bem para o erro

30. ahead(getBatleFieldHeight() - getY()); <-------------------> *** Error: No method named "getBatleFieldHeight" was found in type "hy/Wing_Gundam_Zero_Custom". However, there is an accessible method "getBattleFieldHeight" whose name closely matches the name "getBatleFieldHeight".

o método getBatleFieldHeight não foi encontrado, entretanto há um método acessivel com um nome parecido getBattleFieldHeight
[/quote]

Vlw pela ajuda to me matando p/ arrumar isso tenho mais 1 semana p/ terminar e ir p/ o campeonato, eu faço faculdade e trabalhando sem tempo p/ terminar, vou participar de um campeonato de ROBOCODE e to sozinho concorrendo com alguns grupos da minha escola, entao por isso eu vim aqui desesperado, desculpem qq coisa, e vlw pela força…

logo, da para perceber que o erro esta na grafia da chamada do método

esse é o meu Robo, gostaria de ver oq eu posso fazer p/ melhora-lo…

package hy;
import robocode.*;
import java.awt.Color;

//import java.awt.Color;


public class Wing_Gundam_Zero_Custom extends AdvancedRobot
{


		
			
				
						private int hitCount;
						boolean peek;		
						double moveAmount;
	/**
	 * run: Wing_Gundam_Zero_Custom's default behavior
	 */
	public void run() {
		
		
		moveAmount = Math.max(getBattleFieldWidth(),getBattleFieldHeight());
		
		peek = false;
			
		turnLeft(getHeading() % 90);
		ahead(moveAmount);
		peek = true;
		turnGunRight(90);
		turnRight(90);
		
		while (true)
		{
			
			peek = true;
			ahead(moveAmount);
			peek = false;
			turnRight(90);
		}
	}
		
		
public void onHitRobot(HitRobotEvent e) {
	if (e.getBearing() > -90 && e.getBearing() < 90)
		back(100);
	else
		ahead(100);
	}
		
	
		

	/**
	 * onScannedRobot: What to do when you see another robot
	 */
	public void onScannedRobot(ScannedRobotEvent e) {
		if (e.getBearing()>-10 && e.getBearing()<10)
			fire (3);
			else
			fire(2);
			
		
		if (peek)
			scan();
	}
	
	
}

Me da uma força ai gente, tem campeonato no mes q vem aki…

:smiley:
Pow fiquei curioso pra saber o que faz esse teu codigo… O robo fica se mexendo ???
Parece ateh LEGO…rs…

Se soubesse o que faz e o que pode fazer ateh poderia ajudar… :roll:

Abraços,

Pow fiquei curioso pra saber o que faz esse teu codigo… O robo fica se mexendo ???
Parece ateh LEGO…rs…

Se soubesse o que faz e o que pode fazer ateh poderia ajudar… :roll:

Abraços,[/quote]

Sim, vc tem q baixar no seu pc o ROBOCODE, www.robocode.org acho q ai tem o Robocode p/ baixar, vc instala e faz o robo no editor se vc quiser saber mais vai em http://www.fic.br/~gaucho/SOO-I/robocode/rock.html
se vc quiser me ajuda ai ^^ :stuck_out_tongue: [/url]

Gente me ajuda ai vai… como melhorar ele???