Robocode the basic principle of coordinate locking

Source: Internet
Author: User

Introduction

We know the absolute direction, the relative direction and the whole direction system of Robocode in the front. I believe you have a deep understanding of this. But the problem came again, knowing that the direction did not seem to fully achieve the purpose of understanding the enemy. How to detect the enemy's distance? How exactly do you lock your target? What do we do with moving targets? Here we will take advantage of the math class in the Java.lang base Class library and some basic trigonometric functions to uncover the fog for you. The knowledge of triangular geometry which is forgotten quickly is explained in detail in the last skyala.li of this paper.

Basic concepts of coordinates

First, let's look at a text translation in the Robocode API.

All coordinates are expressed as (x,y).

All coordinates are represented by X,y.

All coordinates are positive.

All coordinates are positive.

The origin (0,0) is on the bottom left to the screen.

Coordinate origin (0,0) in the lower left corner of the screen

Positive X is right. The right side of X is positive

Positive y is up. The top of Y is positive.

Figure 1 shows the coordinate system in the Robocode, the detailed description of the graph is shown in the article "Analysis of the direction of Robocode fundamentals".

Figure 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.