Code Tutorial-Halite Collection- Logging Error


#1

I am following the code tutorials provided by Halite. They ask you to insert the following statement into your code, but I keep getting a compile-time error message each time.

logging.info(“Ship {} has {} halite.”.format(ship.id ,ship.halite_amount))

Since their API documentation format (snake_case) doesn’t match their API in the editor (they use camelCase), I tried doing various combinations (ship.haliteAmount) thinking that it is a syntax error, but that isn’t working.

The error I’m getting is the following:
Your bot failed to compile :frowning:
./MyBot.java:35: error: cannot find symbol
logging.info(“Ship {} has {} halite.”,format(ship.id, ship.haliteAmount));
^
symbol: variable haliteAmount
location: variable ship of type Ship
./MyBot.java:35: error: cannot find symbol
logging.info(“Ship {} has {} halite.”,format(ship.id, ship.haliteAmount));
^
symbol: variable logging
location: class MyBot
2 errors

Please help!!


#2

Looks like a copy&paste from python. Should be Log.info instead.


#3

Still isn’t working.


#4

The java api contains a field: ‘halite’ instead of ‘haliteAmount’.
When copying from the tutorial you need to adjust the python code to Java :slight_smile: