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
|
package ch.asynk.gdx.boardgame.boards;
import com.badlogic.gdx.math.Vector2;
import ch.asynk.gdx.boardgame.Piece;
import ch.asynk.gdx.boardgame.Tile;
import ch.asynk.gdx.boardgame.tilestorages.TileStorage.TileKeyGenerator;
import ch.asynk.gdx.boardgame.utils.Collection;
public interface Board extends TileKeyGenerator
{
public int size();
public int[] getAngles();
public Tile getTile(int x, int y);
public boolean isOnBoard(int x, int y);
public void centerOf(int x, int y, Vector2 v);
public void toBoard(float x, float y, Vector2 v);
public Tile[] getAdjacents();
public void buildAdjacents(int x, int y);
public int possibleMoves(Piece piece, Tile from, Collection<Tile> tiles);
public int shortestPath(Piece piece, Tile from, Tile to, Collection<Tile> tiles);
public boolean lineOfSight(int x0, int y0, int x1, int y1, Collection<Tile> tiles, Vector2 v);
default public boolean lineOfSight(Tile from, Tile to, Collection<Tile> tiles, Vector2 v)
{
return lineOfSight(from.x, from.y, to.x, to.y, tiles, v);
}
enum Geometry
{
EUCLIDEAN,
TAXICAB,
TCHEBYCHEV
}
public float distance(int x0, int y0, int x1, int y1, Geometry geometry);
default public float distance(int x0, int y0, int x1, int y1)
{
return distance(x0, y0, x1, y1, Geometry.EUCLIDEAN);
}
default public void dropInPlace(Piece piece, Vector2 v)
{
toBoard(piece.getCX(), piece.getCY(), v);
centerOf((int)v.x, (int)v.y, v);
piece.centerOn(v.x, v.y);
}
}
|