|
|||||||||
PREV NEXT | FRAMES NO FRAMES |
Uses of Position in gameLogic |
---|
Methods in gameLogic that return Position | |
---|---|
static Position |
GameState.calculateNextPosition(Direction direction,
Position oldPosition)
Gets the next position a snake would end up in if it continues in this direction. |
Position |
Direction.calculateNextPosition(Position oldPosition)
Gets the next position a snake would end up in if it continues in this direction. |
Position |
Direction.getDirectionVector()
|
Position |
Snake.getHeadPosition()
Gets the current position of this snake's head. |
Position |
Snake.getTailPosition()
Gets the current position of the last segment of the snake's tail. |
Methods in gameLogic that return types with arguments of type Position | |
---|---|
java.util.ArrayList<Position> |
GameState.getFruits()
Gets a list containing the positions of all the fruits currently on the board. |
java.util.List<Position> |
Position.getNeighbours()
Get a list of all neighbours to this position. |
java.util.LinkedList<Position> |
Snake.getSegments()
Get a list of all the squares this snake has occupied. |
java.util.ArrayList<Position> |
GameState.getWalls()
Gets a list containing the positions of all the walls currently on the board. |
Methods in gameLogic with parameters of type Position | |
---|---|
static Position |
GameState.calculateNextPosition(Direction direction,
Position oldPosition)
Gets the next position a snake would end up in if it continues in this direction. |
Position |
Direction.calculateNextPosition(Position oldPosition)
Gets the next position a snake would end up in if it continues in this direction. |
static int |
GameState.distanceBetween(Position from,
Position to)
This method can be used to calculate the distance between two positions. |
Direction |
Snake.getDirection(Position position)
Get the direction of a specific segment in this snake. |
static Direction |
Direction.getDirectionFromPositionToPosition(Position from,
Position to)
Returns the direction between two positions, as long as they are on a straight line. |
int |
Position.getDistanceTo(Position other)
Calculates the manhattan distance (the number of squares that must be traversed) between this Position and another Position. |
static java.util.ArrayList<Direction> |
GameState.getRelativeDirections(Position from,
Position to)
Returns in which direction one has to move in order to reach one position from another one. |
Square |
Board.getSquare(Position p)
Gets a Square at |
boolean |
Board.hasFruit(Position p)
Returns whether or not the board contains a fruit at the given position. |
boolean |
Board.hasGameObject(Position p)
Returns whether or not the board contains any game object at the given position. |
boolean |
Board.hasLethalObjectWithinRange(Position pos,
int range)
Calculates whether or not the board contains a lethal object within a given radius of a certain square. |
boolean |
Board.hasSnake(Position p)
Returns whether or not the board contains a snake at the given position. |
boolean |
Board.hasWall(Position p)
Returns whether or not the board contains a wall at the given position. |
boolean |
Board.isLethal(Position p)
Returns whether or not the board contains a lethal game object at the given position. |
Constructors in gameLogic with parameters of type Position | |
---|---|
Position(Position position)
|
|
|||||||||
PREV NEXT | FRAMES NO FRAMES |