Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
ITP4712 Logical and Artificial Intelligence in Games
ASSIGNMENT
Robocode is a Java programming game, where the goal is to develop a robot battle tank to battle
against other tanks. The robot battles are running in real-time and on-screen. The motto of Robocode
is: Build the best, destroy the rest!
In this assignment, you are required to build some Robocode robots to accomplish different tasks.
You will also need to have a design document on each robot you made.
TASK 1
Design a Chasing Robot using Finite State Machine Approach
In this task, you will need to model a robot as a Finite State Machine that chases and attacks 2 target
Robots of “lessons.Evader” until they died. Your robot should have at least FIVE different states
apart from the initial state. You may divide the states into sub-states if you want to. Here are some
state suggestions:
Finding a new Target (Find the target evader)
Finding previous Target (find the old target after avoiding an obstacle or wall)
Chasing the Target (going towards the target’s predicted future location)
Avoiding the Walls (turn away from the wall before it is too near)
Obstacle Avoidance (turn away from the obstacle (sitting ducks) before hitting it)
You can add other states to improve your robot. Your robot will use its senses (radar or hit events)
(i.e., onScannedRobot(),onBulletHit(), onHitByBullet() and etc.) and its own attributes (e.g.,
getBattleFieldWidth(), getBattleFieldWidth(), getX(), getY(), getOthers() and etc.) as the
condition of state transition. Your robot needs to consider the current status of battlefield and other
enemies to apply different strategies, such as, when to state away from others and when to apply
melee. You may also need to apply guessing and/or calculation to make your robot more robust.
2
Your current state can be stored as an instance variable. Try using switch case statement in your
run() method. Each case represents the action for each state of your robot. The state transition should
be triggered by the onXXX() methods and/or inside your run() method when you are checking your
robot’s status.
While your robot is chasing the targets, it may also encounter obstacles (10 sample.SittingDuck
robots). You will need to figure some ways to avoid destroying the obstacles (not to shoot and ram
the obstacles intentionally, accidental shot at obstacles will not result in mark deduction) and try to
chase the target after passing the obstacle.
You may use direct line of sight technique in chasing your robot, but you will get extra marks if you
use the interception technique in this robot in additional to chasing.
Deliverables:
- A diagram representing the state transition of the robot.
- A brief description of the states and transition.
- A brief description how your robot avoids the obstacle and locks the same target while passing
the obstacle.
- The robot’s java file. You should try your best to implement the robot as the state machine
designed by yourself. Marks will be deducted if the robot does not implement as designed.