COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Minecraft
|
|
Battleships
|
|
Snake
|
|
Snakes and Ladders
|
Detailed explanation-1: -2D arrays are often used to represent tables, images, and game boards. Checkers, chess, tic-tac-toe, crosswords and mazes are examples of games that could be implemented using a 2D array.
Detailed explanation-2: -In Java, 2D arrays are stored as arrays of arrays. Therefore, the way 2D arrays are declared is similar 1D array objects. 2D arrays are declared by defining a data type followed by two sets of square brackets.
Detailed explanation-3: -2D games use multiple 2-Dimensional arrays to keep track of every tile with in the game and to keep track of every ‘section’ of the world map, such as areas or cities.
Detailed explanation-4: -Two dimensional arrays are especially useful when the data is naturally organized in rows and columns like in a spreadsheet, bingo, battleship, theater seats, classroom seats, or a picture. In battleship, letters map to the rows (A is the first row, B is the second row, and so on) and the column indices start with 1.