-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tile.java
109 lines (98 loc) · 2.44 KB
/
Tile.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
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
import java.awt.geom.Point2D;
/**
* represent a states for problem solving by search
*/
public interface tile {
/**
*
* @return Parent tile - the tile state through which we reached the present state
*/
public tile getParent();
/**
*
* @param Parent tile - the tile state through which we reached the present state
*/
public void setParent(tile parent);
/**
* Possibility of marking certain information about the state - change to true
*/
public void out();
/**
* Possibility of marking certain information about the state - change to false
*/
public void markNoOut();
/**
*
* @return certain information about the state - true or false
*/
public boolean isOut();
/**
*
* @param cost path from the initial state to current state
*/
public void setCost(int cost);
/**
*
* @return cost path from the initial state to current state
*/
public int getCost();
/**
*
* @return board represent the current state of the Tile game
*/
public Board getBoard();
/**
*
* @param num_op - a String represent The number and moving direction of the piece moved to reach the current state
*/
public void setNumOp(String num_op);
/**
*
* @return a String represent The number and moving direction of the piece moved to reach the current state
*/
public String getNumOp();
/**
*
* @param direction - 1= LEFT , 2= UP , 3= RIGHT , 4= DOWN
* @return new tile state after moving - if moving the piece that is in the "direction" of the empty cell is legal
* otherwise null;
* e.g. move(1) = move the piece to the left of the empty cell to the empty empty cll
*/
public tile move(int direction);
/**
*
* @return "deep" copy of currrent tile
*/
public tile copy();
/**
*
* @param other - an object
* @return true if the object represent same tile state
*/
public boolean equals(Object other);
/**
*
* @return string represent current state
*/
public String toString();
/**
*
* @return String key of this state for hashing(shorter than toString)
*/
public String getKey();
/**
*
* @return goal state tile
*/
public tile getArrangedTile();
/**
*
* @return the state number according to the creation time (1 = the first state created)
*/
public int getTime();
/**
*
* @return empty cell location (x,y)
*/
public Point2D getFree();
}