AI代写 | Artificial Intelligence Use
这是一篇香港的java机器人游戏开发java代写
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.
To make the game more interesting, we are using a modified version of Robocode that can create obstacles in the battlefield before starting a game. In order to adapt to the customized version of Robocode, you need to download the Robocode setup file posted in the Moodle site. You robot must implement the following interfaces also:
robocode.robotinterfaces.IObstacleRobot and robocode.robotinterfaces.IObstacleEvents.
In IObstacleRobot interface, you need to implement the following method:
public IObstacleEvents getObstacleEventListener() { return this; }
The method will return an object that implements IObstacleEvents.
In IObstacleEvents interface, you need to implement the following methods:
public void onHitObstacle(HitObstacleEvent event) { … }
public void onScannedObstacle(ScannedObstacleEvent event) { … }
The two methods will be implemented by the robot accordingly if the two events are to be handled.
The HitObstacleEvent and ScannedObstacleEvent can give you the bearing of the obstacle and the distance between you and the obstacle (for ScannedObstacleEvent only) through the getBearing() and getDistance() methods form the event object.
TASK 1
Design a Chasing Robot
In this task, you will need to model a robot that chases and attacks TWO ObstacleEvader robots until they die in a map that contains a number of random obstacles of a size of 50×50 pixels. While
your robot is making line-of-sight chasing to the enemy, it may encounter obstacles also. You will need to figure some ways to go around the obstacles and try to chase the same target after passing the obstacles.
Deliverables:
– A brief description how your robot avoids the obstacles and locks the same target while passing the obstacle.
– The robot’s java file.
TASK 2
Design a Robot as a Finite State Machine
In this task, you will need to model a robot using a finite state machine. There will be big blocks of obstacles (with size of 250×150 pixels) placed in the battlefield. There will be 6 other enemies in the battlefield also. Your robot should try to walk along the wall while attacking other robots. Your robot should also avoid being stuck into an obstacle or a corner. If there is only one robot left, your robot should turn into a chasing robot to destroy your last enemy. Your robot should have at least SIX different states. You may divide the states into sub-states if you want to. Here are some state
suggestions:
• Idle (starting state)
• Finding Wall
• Avoiding Obstacle
• Avoiding Corner
• Moving Along Wall
• Chasing
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. You may also need to apply guessing and/or calculation to make your robot more robust.
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.
Deliverables:
– A diagram representing the state transition of the robot.
– A brief description of the states and transition.
– 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.