-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpos.java
61 lines (58 loc) · 1.1 KB
/
pos.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.company;
/**
* Created by ben on 2017-09-27.
*/
public class pos
{
int posX;
int posY;
pos(int x,int y)
{
this.posX = x;
this.posY = y;
}
public int [] getUp()
{
int [] f = {posX - 1, posY};
return f;
}
public int [] getDown()
{
int [] f = {posX + 1, posY};
return f;
}
public int [] getRight()
{
int [] f = {posX, posY + 1};
return f;
}
public int [] getLeft()
{
int [] f = {posX, posY - 1};
return f;
}
public int [] getQ1()
{
int [] f = {posX - 1, posY + 1};
return f;
}
public int [] getQ2()
{
int [] f = {posX - 1, posY - 1};
return f;
}
public int [] getQ3()
{
int [] f = {posX + 1, posY - 1};
return f;
}
public int [] getQ4()
{
int [] f = {posX + 1, posY + 1};
return f;
}
public String toString()
{
return "[ X = " + posX + " , Y = " + posY + " ] ";
}
}