File tree 1 file changed +12
-12
lines changed
1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 2
2
3
3
class Node {
4
4
5
- private int index ;
6
- private int distance ;
5
+ private int x ;
6
+ private int y ;
7
7
8
- public Node (int index , int distance ) {
9
- this .index = index ;
10
- this .distance = distance ;
8
+ public Node (int x , int y ) {
9
+ this .x = x ;
10
+ this .y = y ;
11
11
}
12
12
13
- public int getIndex () {
14
- return this .index ;
13
+ public int getX () {
14
+ return this .x ;
15
15
}
16
16
17
- public int getDistance () {
18
- return this .distance ;
17
+ public int getY () {
18
+ return this .y ;
19
19
}
20
20
}
21
21
@@ -35,8 +35,8 @@ public static int bfs(int x, int y) {
35
35
// 큐가 빌 때까지 반복하기
36
36
while (!q .isEmpty ()) {
37
37
Node node = q .poll ();
38
- x = node .getIndex ();
39
- y = node .getDistance ();
38
+ x = node .getX ();
39
+ y = node .getY ();
40
40
// 현재 위치에서 4가지 방향으로의 위치 확인
41
41
for (int i = 0 ; i < 4 ; i ++) {
42
42
int nx = x + dx [i ];
@@ -76,4 +76,4 @@ public static void main(String[] args) {
76
76
System .out .println (bfs (0 , 0 ));
77
77
}
78
78
79
- }
79
+ }
You can’t perform that action at this time.
0 commit comments