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 MarioInput
actionSelectionAI()
Called on each tick to find out what action(s) Mario should take.void
debugDraw(VisualizationComponent vis, LevelScene level, IEnvironment env, java.awt.Graphics g)
static void
main(java.lang.String[] args)
void
reset(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, toggleKey
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.idsia.agents.IAgent
actionSelection, getName, observe, receiveReward
-
Constructor Details
-
MarioAgent
public MarioAgent()
-
-
Method Details
-
reset
Description copied from interface:IAgent
Called before the agent is executed for the first time or in-between respective tasks/scenarios.
You should clear all dynamic/intermediate data.- Specified by:
reset
in interfaceIAgent
- Overrides:
reset
in classMarioAIBase
-
debugDraw
public void debugDraw(VisualizationComponent vis, LevelScene level, IEnvironment env, java.awt.Graphics g)- Specified by:
debugDraw
in interfaceIMarioDebugDraw
- Overrides:
debugDraw
in classMarioHijackAIBase
-
actionSelectionAI
Called on each tick to find out what action(s) Mario should take.Use the
MarioAIBase.e
field to query entities (Goombas, Spikies, Koopas, etc.) around Mario; seeEntityType
for a complete list of entities. Important methods you will definitely need:Entities.danger(int, int)
andEntities.entityType(int, int)
.Use the
MarioAIBase.t
field to query tiles (bricks, flower pots, etc.} around Mario; seeTile
for a complete list of tiles. An important method you will definitely need:Tiles.brick(int, int)
.Use
MarioAIBase.control
to output actions (technically this method must returnMarioAIBase.action
in order forMarioAIBase.control
to work). Note that all actions specified throughMarioAIBase.control
run in "parallel" (exceptMarioControl.runLeft()
andMarioControl.runRight()
, which cancel each other out in consecutive calls). Also note that you have to callMarioAIBase.control
methods on everyactionSelectionAI()
tick (otherwiseMarioAIBase.control
will think you DO NOT want to perform that action}.- Overrides:
actionSelectionAI
in classMarioHijackAIBase
-
main
public static void main(java.lang.String[] args)
-