-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHvitRute.java
More file actions
54 lines (48 loc) · 1.01 KB
/
HvitRute.java
File metadata and controls
54 lines (48 loc) · 1.01 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
public class HvitRute extends Rute {
public HvitRute(int x, int y) {
super(x, y);
}
String farge = "Hvit";
@Override
public String farge() {
return farge;
}
public String toString() {
return "(" + this.rad + ", " + this.kolonne + ")";
}
int t = 0;
public void finn(Rute fra) {
t++;
if (t > 1) {
return;
}
forrige = fra;
if (forrige == null) {
if (this.nord != null) {
this.nord.finn(this);
}
if (this.syd != null) {
this.syd.finn(this);
}
if (this.vest != null) {
this.vest.finn(this);
}
if (this.oest != null) {
this.oest.finn(this);
}
} else {
if (!forrige.equals(this.nord) && this.nord != null) {
this.nord.finn(this);
}
if (!forrige.equals(this.syd) && this.syd != null) {
this.syd.finn(this);
}
if (!forrige.equals(this.vest) && this.vest != null) {
this.vest.finn(this);
}
if (!forrige.equals(this.oest) && this.oest != null) {
this.oest.finn(this);
}
}
}
}