[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
AI Challenge Forums • View topic - errors in the initial setup tutorial for mybot in java

It is currently Tue Jan 16, 2018 11:16 am Advanced search

errors in the initial setup tutorial for mybot in java

Topics about starter packages, visualizer or any other third party tools.
Please submit new language requests in the Language Request Forum.

errors in the initial setup tutorial for mybot in java

Postby dedly13 » Sat Nov 19, 2011 9:33 am

when i try to set up the bot for java i try to go through the tutorial and follow to the letter however there is an error in the system somewhere. when i run the play one game.cmd file it all goes fine however when i try to run the tutorial.cmd file after running the make.cmd file i get an error message in the prompt. "java.lang.NoClassDefFoundError : MyBot" all help is awesome, thanks guys :)
dedly13
Cadet
 
Posts: 3
Joined: Sat Nov 19, 2011 9:27 am

Re: errors in the initial setup tutorial for mybot in java

Postby dimkadimon » Sat Nov 19, 2011 11:25 am

dimkadimon
Major-General
 
Posts: 263
Joined: Wed Oct 06, 2010 11:34 pm
Location: Adelaide, Australia

Re: errors in the initial setup tutorial for mybot in java

Postby dedly13 » Sat Nov 19, 2011 12:32 pm

hi there, thanks so much for very quick reply :) when i try to javac MyBot.java i just spring a whole load of errors, im not sure but i think i havent done somehting like put the required libraries somewhere, also how do i make sure that play_one_game uses MyBot? thanks so much again
dedly13
Cadet
 
Posts: 3
Joined: Sat Nov 19, 2011 9:27 am

Re: errors in the initial setup tutorial for mybot in java

Postby dedly13 » Sat Nov 19, 2011 6:12 pm

sorted, i did javac *.java and it compiled everything together, it worked however when i went onto the next part of the tutorial i couldnt get it to compile, im not to sure where to paste the code and i think i did it wrong because i just get cannot find symbol : map and cannot find symbol : HashMap
dedly13
Cadet
 
Posts: 3
Joined: Sat Nov 19, 2011 9:27 am

Re: errors in the initial setup tutorial for mybot in java

Postby Hobbes » Tue Nov 22, 2011 9:44 pm

same here, after step one of the tutorial. my MyBot.java looks liek this:

import java.io.IOException;


/**
* Starter bot implementation.
*/

public class MyBot extends Bot {

/**
* Main method executed by the game engine for starting the bot.
*
* @param args command line arguments
*
* @throws IOException if an I/O error occurs
*/

public static void main(String[] args) throws IOException {

new MyBot().readSystemInput();
}
private Map<Tile, Tile> orders = new HashMap<Tile, Tile>();

private boolean doMoveDirection(Tile antLoc, Aim direction) {

Ants ants = getAnts();
// Track all moves, prevent collisions
Tile newLoc = ants.getTile(antLoc, direction);
if (ants.getIlk(newLoc).isUnoccupied() && !orders.containsKey(newLoc)) {
ants.issueOrder(antLoc, direction);
orders.put(newLoc, antLoc);
return true;
} else {
return false;
}
}


@Override
public void doTurn() {
Ants ants = getAnts();
orders.clear();
// default move
for (Tile myAnt : ants.getMyAnts()) {
for (Aim direction : Aim.values()) {
if (doMoveDirection(myAnt, direction)) {
break;
}
}
}
}
}


And my errorS with make are:


javac MyBot.java
MyBot.java:22: cannot find symbol
symbol : class Map
location: class MyBot
private Map<Tile, Tile> orders = new HashMap<Tile, Tile>();
_________^ (wouldn't work with spaces)
MyBot.java:22: cannot find symbol
symbol : class HashMap
location: class MyBot
private Map<Tile, Tile> orders = new HashMap<Tile, Tile>();
__________________________________^
2 errors
make: *** [MyBot.class] Error 1
Hobbes
Cadet
 
Posts: 2
Joined: Tue Nov 22, 2011 9:43 pm

Re: errors in the initial setup tutorial for mybot in java

Postby Hobbes » Tue Nov 22, 2011 9:58 pm

no uits, allrighty :D
Hobbes
Cadet
 
Posts: 2
Joined: Tue Nov 22, 2011 9:43 pm


Return to Starter Packages & Tools

Who is online

Users browsing this forum: No registered users and 1 guest

cron