Class MarioAgent
- All Implemented Interfaces:
IMarioDebugDraw,IAgent,java.awt.event.KeyListener,java.util.EventListener
public class MarioAgent extends MarioHijackAIBase implements IAgent
Modify actionSelectionAI() to change Mario's behavior.
Modify debugDraw(VisualizationComponent, LevelScene, IEnvironment, Graphics) to draw custom debug information.
You can change the type of level you want to play in main(String[]).
Once your agent is ready, you can use the Evaluate class to benchmark the quality of your AI.
-
Field Summary
Fields inherited from class ch.idsia.agents.controllers.MarioHijackAIBase
floatFormat, hijacked, keyboard, renderExtraDebugInfo -
Constructor Summary
Constructors Constructor Description MarioAgent() -
Method Summary
Modifier and Type Method Description MarioInputactionSelectionAI()Called on each tick to find out what action(s) Mario should take.voiddebugDraw(VisualizationComponent vis, LevelScene level, IEnvironment env, java.awt.Graphics g)static voidmain(java.lang.String[] args)voidreset(AgentOptions options)Called before the agent is executed for the first time or in-between respective tasks/scenarios.Methods inherited from class ch.idsia.agents.controllers.MarioHijackAIBase
actionSelection, actionSelectionKeyboard, keyPressed, keyReleased, keyTyped, toggleKeyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.idsia.agents.IAgent
actionSelection, getName, observe, receiveReward
-
Constructor Details
-
MarioAgent
public MarioAgent()
-
-
Method Details
-
reset
Description copied from interface:IAgentCalled before the agent is executed for the first time or in-between respective tasks/scenarios.
You should clear all dynamic/intermediate data.- Specified by:
resetin interfaceIAgent- Overrides:
resetin classMarioAIBase
-
debugDraw
public void debugDraw(VisualizationComponent vis, LevelScene level, IEnvironment env, java.awt.Graphics g)- Specified by:
debugDrawin interfaceIMarioDebugDraw- Overrides:
debugDrawin classMarioHijackAIBase
-
actionSelectionAI
Called on each tick to find out what action(s) Mario should take.Use the
MarioAIBase.efield to query entities (Goombas, Spikies, Koopas, etc.) around Mario; seeEntityTypefor a complete list of entities. Important methods you will definitely need:Entities.danger(int, int)andEntities.entityType(int, int).Use the
MarioAIBase.tfield to query tiles (bricks, flower pots, etc.} around Mario; seeTilefor a complete list of tiles. An important method you will definitely need:Tiles.brick(int, int).Use
MarioAIBase.controlto output actions (technically this method must returnMarioAIBase.actionin order forMarioAIBase.controlto work). Note that all actions specified throughMarioAIBase.controlrun in "parallel" (exceptMarioControl.runLeft()andMarioControl.runRight(), which cancel each other out in consecutive calls). Also note that you have to callMarioAIBase.controlmethods on everyactionSelectionAI()tick (otherwiseMarioAIBase.controlwill think you DO NOT want to perform that action}.- Overrides:
actionSelectionAIin classMarioHijackAIBase
-
main
public static void main(java.lang.String[] args)
-