Question about the second-dimensional index value in the related array?
Source: Internet
Author: User
Question about the second-dimensional index value in the array ?? Ask a weak question, for example, there are two pictures in the upper and lower columns, and three images of the same size in no column, I would like to ask what is the first-dimensional index value and the second-dimensional index value of the second image object in the upper column? Because the following code is displayed in the code of the connected game, it is a bit unclear about the basic knowledge of arrays. // & Nbsp; question about the second-dimensional index value of this object in the Piece [] [] array ??
Ask a weak question
For example, if there are two pictures in the upper and lower columns and three images of the same size are not listed, I would like to ask what is the first-dimensional index value and the second-dimensional index value of the second image object in the upper column?
Because the following code is displayed in the code of the connected game, it is a bit unclear about the basic knowledge of arrays.
// The index value of the object in the first dimension of the Piece [] [] array
Private int indexX;
// The second-dimensional index value of the object in the Piece [] [] array
Private int indexY;
Share:
------ Solution --------------------
0 and 1...
------ Solution --------------------
What you see is not the php code
------ Solution --------------------
No context, cannot be explained
------ Solution --------------------
Dizzy
1. are you talking about rows or columns? When you say "up and down", it feels like a row, but the coordinates behind it are like a vertical column.
2. subscripts are generally used to start from 0, that is (this is the serial number, which is different from the following coordinate to distinguish)
(0, 0) (0, 1 )...
(1, 0) (1, 1 )...
The above is a one-dimensional row, two-dimensional is a column; if one-dimensional is a column, two-dimensional is a row, the location map becomes
(0, 0) (1, 0 )...
(0, 1) (1, 1 )...
A few people like to start from 1.
If the upper left corner is the coordinates of [], [] is the upper left corner of (), and [] is in) location -- the position of the first column and the second column is used here.
------ Solution --------------------
When you press [y] [x] to organize
[0] [0] [0] [1] [0] [2]
[1] [0] [1] [1] [1] [2]
You can see that the origin is placed in the upper left corner of the array. Therefore, the image should also place the origin point in the upper left corner to facilitate analysis and computation.
If you place the image origin in the lower left corner
That is, the coordinate system has a vertical flip
------ Solution --------------------
Is 0 rows and 1 column
------ Solution --------------------
It is 0 1.
------ Solution --------------------
------ Solution --------------------
How to organize data is based on your needs
You can use x, y (columns, rows)
Y, x (row, column)
------ Solution --------------------
This question hasn't been clarified yet? I thought Xu could explain it to you
Coordinates are fixed x, y
However, the array subscript is determined by the person who writes the program. it can be m, n, or n, m (m indicates rows, n indicates columns)
The minimum value of m or n (that is, the subscript of the first row/column) is also set by the writer. during traversal, you must start from the minimum value.
------ Solution --------------------
Description by mathematical coordinates
X horizontal axis
Y axis
Coordinate point (x, y)
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.