-
Notifications
You must be signed in to change notification settings - Fork 0
/
Coordinate.java
41 lines (37 loc) · 922 Bytes
/
Coordinate.java
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
public class Coordinate{
private int x, y;
private static final int DIM = 80;
private static final int startingX = 100;
private static final int startingY = 815;
public Coordinate(int num){
switch(num){
case 0: x = 20;
y = 815;
break;
default:
if ((num - 1) / 10 % 2 == 0){
if (num % 10 == 0){
x = 820;
}
else{
x = startingX + DIM * ((num - 1) % 10);
}
}
else{
if (num % 10 == 0){
x = 100;
}
else{
x = (startingX + (DIM * 9)) - DIM * ((num - 1) % 10);
}
}
y = startingY - DIM * ((num - 1) / 10);
}
}
public int getX(){
return x;
}
public int getY(){
return y;
}
}