-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPath_Card.java
More file actions
116 lines (99 loc) · 2.76 KB
/
Path_Card.java
File metadata and controls
116 lines (99 loc) · 2.76 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author nim_13512080
*/
class Path_Card extends Card {
public static Path_Card NilCard = new Path_Card('0', '0', '0', '0', '0', 0);
public static Path_Card StartCard = new Path_Card('1', '1', '1', '1', '1', 17);
public static Path_Card GoldCard = new Path_Card('1', '1', '1', '1', 'G', 18);
public static Path_Card RockCard = new Path_Card('1', '1', '1', '1', 'R', 19);
private char top;
private char right;
private char bottom;
private char left;
private char center;
private int id;
public Path_Card(char c, char c0, char c1, char c2, char c3, int i) {
right = c;
left = c0;
bottom = c1;
top = c2;
center = c3;
id = i;
}
@Override
public int getType(){
return 1;
}
@Override
public int getID(){
return id;
}
@Override
public void displayCard(){
System.out.println("Ini pathcard");
}
public char getRight(){
return right;
}
public char getLeft(){
return left;
}
public char getTop(){
return top;
}
public char getBottom(){
return bottom;
}
public char getCenter(){
return center;
}
public boolean canBePlacedRightOf(Path_Card C){
if((this.left=='1' && C.getRight()=='1')||(this.left=='0' && C.getRight()=='0') ){
return true;
}
else {
return false;
}
}
public boolean canBePlacedLeftOf(Path_Card C){
if((this.right=='1' && C.getLeft()=='1')||(this.right=='0' && C.getLeft()=='0') ){
return true;
}
else {
return false;
}
}
public boolean canBePlacedAboveOf(Path_Card C){
if((this.bottom=='1' && C.getTop()=='1')||(this.bottom=='0' && C.getTop()=='0') ){
return true;
}
else {
return false;
}
}
public boolean canBePlacedBelowOf(Path_Card C){
if((this.top=='1' && C.getBottom()=='1')||(this.top=='0' && C.getBottom()=='0') ){
return true;
}
else {
return false;
}
}
public boolean CompareCard(Path_Card C){
return ((this.top==C.getTop())&&(this.bottom==C.getBottom())&&(this.right==C.getRight())&&(this.left==C.getLeft())&&(this.center==C.getCenter())&&(this.id==C.getID()));
}
public void rotateCard(){
char temp = right;
right = left;
left = temp;
temp = top;
top = bottom;
bottom = temp;
}
}