Package aiinterface
Interface AIInterface
public interface AIInterface
The interface that defines the methods to implement in AI.
-
Method Summary
Modifier and TypeMethodDescriptionvoidgameEnd()It is called when the game ends.voidgetAudioData(AudioData audioData) Gets the audio information in each frame.
For more details on the data structure, please see https://tinyurl.com/DareFightingICE/AI.voidgetInformation(FrameData frameData, boolean isControl, FrameData nonDelayFrameData) Gets information from the game status in each frame.voidgetScreenData(ScreenData screenData) Gets the screen information in each frame.voidinitialize(GameData gameData, boolean playerNumber) This method initializes AI, and it will be executed only once in the beginning of each game.input()Receives a key input from AI.
It is executed in each frame and returns a value in the Key type.booleanisBlind()Receives whether or not the AI is blind.name()Receives a name from AI.voidProcesses the data from AI.voidroundEnd(RoundResult roundResult) Informs the result of each round.
It is called when each round ends.
-
Method Details
-
name
String name()Receives a name from AI.- Returns:
- the name of AI
-
isBlind
boolean isBlind()Receives whether or not the AI is blind.- Returns:
trueif the AI is blind, otherwisefalse
-
initialize
This method initializes AI, and it will be executed only once in the beginning of each game.
Its execution will load the data that cannot be changed and load the flag of the player's side ("Boolean player", true for P1 or false for P2).
If there is anything that needs to be initialized, you had better do it in this method.
It will return 0 when such initialization finishes correctly, otherwise the error code.- Parameters:
gameData- the data that will not be changed during a gameplayerNumber- the character's side flag.
trueif the character is P1, orfalseif P2.- See Also:
-
getInformation
Gets information from the game status in each frame.
Such information is stored in the parameter frameData.
IfframeData.getRemainingTime()returns a negative value, the current round has not started yet.
When you use frameData received from getInformation(),
you must always check if the condition!frameData.getEmptyFlag() && frameData.getRemainingTime() > 0holds; otherwise, NullPointerException will occur.
You must also check the same condition when you use the CommandCenter class.- Parameters:
frameData- the data that will be changed each frameisControl- whether the character can act. this parameter is not delayed unlikeCharacterData.isControl()nonDelayFrameData- the data that will be changed each frame with no delay (only available if --non-delay flag is set, otherwisenull)- See Also:
-
getScreenData
Gets the screen information in each frame.- Parameters:
screenData- the screen information such as the pixel data, it will be empty in blind mode.
-
getAudioData
Gets the audio information in each frame.
For more details on the data structure, please see https://tinyurl.com/DareFightingICE/AI.- Parameters:
audioData- the audio information.
-
processing
void processing()Processes the data from AI.
It is executed in each frame. -
input
Key input()Receives a key input from AI.
It is executed in each frame and returns a value in the Key type.- Returns:
- the value in the Key type
- See Also:
-
roundEnd
Informs the result of each round.
It is called when each round ends.- Parameters:
roundResult- the result of previous round- See Also:
-
gameEnd
void gameEnd()It is called when the game ends.
-