gameLogic
Enum ErrorState

java.lang.Object
  extended by java.lang.Enum<ErrorState>
      extended by gameLogic.ErrorState
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ErrorState>

public enum ErrorState
extends java.lang.Enum<ErrorState>

ErrorState is used to check if a Brain has been doing something bad the last turn. NO_ERROR means that there have not been any error. If an error occurs, the bot will continue to move in the same direction as it did in the turn before.

Author:
Sixten Hilborn, Arian Jafari
See Also:
GameState

Enum Constant Summary
EXCEPTION
          Means that the Brain threw an exception to the game engine.
INVALID_MOVE
          Means that the Brain tries to make an invalid move.
NO_ERROR
          NO_ERROR means that all is well.
TOO_SLOW
          Means that the Brain is taking too long time to think.
 
Method Summary
 java.lang.String toString()
          Converts the enum label into a human readable string, describing the error.
static ErrorState valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ErrorState[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NO_ERROR

public static final ErrorState NO_ERROR
NO_ERROR means that all is well.


TOO_SLOW

public static final ErrorState TOO_SLOW
Means that the Brain is taking too long time to think. If you get this error, you should try to change your algorithms so they run in less time.


INVALID_MOVE

public static final ErrorState INVALID_MOVE
Means that the Brain tries to make an invalid move. There are three possible directions your snake can move in, and backwards is not one of them. Actually, a 180 degree turn is the only invalid move your snake can do.


EXCEPTION

public static final ErrorState EXCEPTION
Means that the Brain threw an exception to the game engine. The engine will not receive your movement decisions if you throw, so make sure to keep your exceptions for yourself.

Method Detail

values

public static ErrorState[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ErrorState c : ErrorState.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ErrorState valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

toString

public java.lang.String toString()
Converts the enum label into a human readable string, describing the error.

Overrides:
toString in class java.lang.Enum<ErrorState>
Returns:
A string describing the error.