Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
40 lines (30 loc) · 859 Bytes

File metadata and controls

40 lines (30 loc) · 859 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package chapter5;
public class Map {
private int[][] map;
private int size;
public void initMap(int size) {
this.size = size;
map = new int[size][size];
}
public int[][] getMap() {
return map;
}
public Coordinate getNextCoordinate(int row, int col, int i, int j) {
if (row +i < 0 ||
col + j < 0 ||
row + i > this.size - 1 ||
col + j > this.size - 1) {
return null;
}
return new Coordinate(row + i, col + j);
}
public void setVal(Coordinate coordinate, int value) {
map[coordinate.getRow()][coordinate.getCol()] = value;
}
public int getVal(Coordinate coordinate) {
return map[coordinate.getRow()][coordinate.getCol()];
}
public int getSize() {
return size;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.