/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package miagent;
import java.awt.geom.Point2D;
import java.util.Random;
import miagent.WorldModel.GameMode;
/**
* Called from the main loop at the start of every new cycle. Here we decide the action that should be performed by the five players according to the WorldModel and the LearningModule.
* @see WorldModel
* @see LearningModule
* @author ahmed-s-ghonim
*/
public class DecisionModule {
static final int bestPositionShootUpX = 11;
static final int bestPositionShootUpY = 4;
static final int bestPositionShootDownX = 11;
static final int bestPositionShootDownY = 6;
//static boolean[] staticPlayersAction = {false,false,false};
static boolean dynamicPlayerAction = true;
Actions[] attackActions = new Actions[4];
/**Decide static positions if we are setting first*/
public Point2D.Double[] staticPositionsFirst() {
// set to predefined places
// Point2D.Double s1 = new Point2D.Double(7, 7);
// Point2D.Double s2 = new Point2D.Double(7, 4);
// Point2D.Double s3 = new Point2D.Double(9, 7);
Point2D.Double s1 = new Point2D.Double(7, 6);
Point2D.Double s2 = new Point2D.Double(5, 6);
Point2D.Double s3 = new Point2D.Double(5, 4);
return new Point2D.Double[]{s1, s2, s3};
}
/**Decide static positions if we are setting them next*/
public Point2D.Double[] staticPositionsSecond(int trial) {
return decideSuperDummyStaticsSecond(trial);
}
/** Decide what the dynamic player should do*/
public Actions decideDynamic() {
GameMode mode = MIAgent.model.getCurrentGameMode();
if (mode == WorldModel.GameMode.AGGRESSIVE) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is agressive");
return decideDynamicAggressive();
} else if (mode == WorldModel.GameMode.ATTACK_PLAN) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is ATTACK");
attackActions = AttackYaRab.getActions();
return attackActions[0];
//return decideSuperDummyDynamicAction();
} else if (mode == WorldModel.GameMode.FRIEND_GOAL_KICK) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is FRIEND_GOAL_KICK");
//return decideDynamicAttack();
State current = MIAgent.model.getLastState();
if (current.getFriendDynamic().getX() > 3) {
return Actions.DASH_WEST;
}
if (current.getFriendDynamic().getY() > 5) {
return Actions.DASH_NORTH;
}
if (current.getFriendDynamic().getY() < 5) {
return Actions.DASH_SOUTH;
}
return Actions.VOID;
} else if (mode == WorldModel.GameMode.ENEMY_GOAL_KICK) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is ENEMY_GOAL_KICK");
return Actions.DASH_WEST;
} else if (mode == WorldModel.GameMode.DEFENSE) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is DEFENSE");
State current = MIAgent.model.getLastState();
if (current.getFriendDynamic().getX() > 3) {
return Actions.DASH_WEST;
}
if (current.getFriendDynamic().getY() > 6) {
return Actions.DASH_NORTH;
}
if (current.getFriendDynamic().getY() < 6) {
return Actions.DASH_SOUTH;
}
return Actions.VOID;
} else if (mode == WorldModel.GameMode.HARRAS) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is HARRAS");
return decideDynamicHarras();
//return decideSuperDummyDynamicAction();
} else if (mode == WorldModel.GameMode.INTERCEPT) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is INTERCEPT");
// return decideDynamicIntercept();
return decideSuperDummyDynamicAction();
} else if (mode == WorldModel.GameMode.TACKLE) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is TACKLE");
// return decideDynamicTackle();
return decideSuperDummyDynamicTackle();
//return decideSuperDummyDynamicAction();
} else if (mode == WorldModel.GameMode.DUMMY) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is DUMMY");
return Dynamic.getAction(MIAgent.model.getLastState());
} else if (mode == WorldModel.GameMode.SUPER_DUMMY) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " : mode is SUPER_DUMMY");
return decideSuperDummyDynamicAction();
}
return null;
}
/** Decide what the goal keeper should do*/
public Actions decideGoalKeeper() {
State current = MIAgent.model.getLastState();
GameMode mode = MIAgent.model.getCurrentGameMode();
if (mode == WorldModel.GameMode.FRIEND_GOAL_KICK) {
if (current.getFriendGoal().getY() > 5) {
return Actions.DASH_NORTH;
}
if (current.getFriendGoal().getY() < 5) {
return Actions.DASH_SOUTH;
}
if (current.getFriendDynamic().getX() == 3 && current.getFriendDynamic().getY() == 5) {
return Actions.THROW_EAST;
}
return Actions.VOID;
}
return GoalKeeperAction.getAction(current);
}
/** Decide what the first static player should do*/
public Actions decideStatic1() {
GameMode mode = MIAgent.model.getCurrentGameMode();
if (mode == WorldModel.GameMode.ATTACK_PLAN) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Static 1 Action : " + attackActions[1]);
return attackActions[1];
// return AttackYaRab.getActions()[1];
}
if (mode == WorldModel.GameMode.SUPER_DUMMY) {
return Actions.VOID;
} else if (mode == WorldModel.GameMode.DUMMY) {
return StaticAction.getAction(MIAgent.model.getLastState());
} else {
return Actions.VOID;
}
}
/** Decide what the second static player should do*/
public Actions decideStatic2() {
GameMode mode = MIAgent.model.getCurrentGameMode();
if (mode == WorldModel.GameMode.ATTACK_PLAN) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Static 2 Action : " + attackActions[2]);
return attackActions[2];
// return AttackYaRab.getActions()[2];
}
if (mode == WorldModel.GameMode.SUPER_DUMMY) {
return Actions.VOID;
} else if (mode == WorldModel.GameMode.DUMMY) {
return StaticAction.getAction(MIAgent.model.getLastState());
} else {
return Actions.VOID;
}
}
/** Decide what the third static player should do*/
public Actions decideStatic3() {
GameMode mode = MIAgent.model.getCurrentGameMode();
if (mode == WorldModel.GameMode.ATTACK_PLAN) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Static 3 Action : " + attackActions[3]);
return attackActions[3];
//return AttackYaRab.getActions()[3];
}
if (mode == WorldModel.GameMode.SUPER_DUMMY) {
return Actions.VOID;
} else if (mode == WorldModel.GameMode.DUMMY) {
return StaticAction.getAction(MIAgent.model.getLastState());
} else {
return Actions.VOID;
}
}
public static Actions decideSuperDummyDynamicAction() {
State current = MIAgent.model.getLastState();
if (current != null) {
Ball b = current.getBall();
Player friendDynamic = current.getFriendDynamic();
// see if Iam currently in a shooting plan
if (MIAgent.model.getShootingPlanCounter() > 0) {
// I am still shooting the ball
return Actions.VOID;
}
if (friendDynamic.getX() == b.getX() && friendDynamic.getY() == b.getY()) {
// I have the ball. Try to score!
if (friendDynamic.getX() == 11) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " I will try to score");
if (friendDynamic.getY() == 5) {
Player enemyGoal = current.getEnemyGoal();
Player enemyDynamic = current.getEnemyDynamic();
if (enemyGoal.getY() != 5) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Shoot Directly");
MIAgent.model.setShootingPlanCounter(5);
return Actions.THROW_EAST;
}
if (enemyGoal.getY() == 4) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " try to go up");
if (Math.abs(enemyDynamic.getX() - enemyGoal.getX()) == 1) {
if (enemyDynamic.getY() == 4) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Cannot go UP");
if (new Random().nextBoolean()) {
return Actions.DASH_WEST;
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Shoot Directly we 5alas");
MIAgent.model.setShootingPlanCounter(5);
return Actions.THROW_EAST;
}
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Going UP");
return Actions.DASH_NORTH;
}
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Going UP");
return Actions.DASH_NORTH;
}
}
if (enemyGoal.getY() == 6) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " try to go down");
if (Math.abs(enemyDynamic.getX() - enemyGoal.getX()) == 1) {
if (enemyDynamic.getY() == 6) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Cannot go Down");
if (new Random().nextBoolean()) {
return Actions.DASH_WEST;
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Shoot Directly we 5alas");
MIAgent.model.setShootingPlanCounter(5);
return Actions.THROW_EAST;
}
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Going Down");
return Actions.DASH_NORTH;
}
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Going Down");
return Actions.DASH_NORTH;
}
}
}
if (friendDynamic.getY() == 4) {
if (current.getEnemyGoal().getY() != 4) {
MIAgent.model.setShootingPlanCounter(5);
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Shoot Directly");
return Actions.THROW_EAST;
} else {
MIAgent.model.setShootingPlanCounter(5);
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Shoot Diagonal");
return Actions.THROW_SOUTH_EAST;
}
}
if (friendDynamic.getY() == 6) {
if (current.getEnemyGoal().getY() != 6) {
MIAgent.model.setShootingPlanCounter(5);
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Shoot Directly");
return Actions.THROW_EAST;
} else {
MIAgent.model.setShootingPlanCounter(5);
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Shoot Diagonal");
return Actions.THROW_NORTH_EAST;
}
}
}
// try to go to the goal
if (MIAgent.model.getObjectAt(friendDynamic.getX() + 1, friendDynamic.getY()) != null) {
// some one is infront of me. Go up or down ?
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Some one is in front of me");
if (MIAgent.model.getObjectAt(friendDynamic.getX(), friendDynamic.getY() + 1) == null) {
// No one is south east
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " no one is down");
return Actions.DASH_SOUTH;
}
if (MIAgent.model.getObjectAt(friendDynamic.getX(), friendDynamic.getY() - 1) == null) {
// No one is north east
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " No one is up");
return Actions.DASH_NORTH;
}
return Actions.DASH_WEST;
} else {
// no one is in front of me
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " No one is in front of me");
if (friendDynamic.getY() > 6 && MIAgent.model.getObjectAt(friendDynamic.getX(), friendDynamic.getY() - 1) == null && MIAgent.model.getObjectAt(friendDynamic.getX() + 1, friendDynamic.getY() - 1) == null) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " I need to go south and no one is south & no one is south east");
// No one is NORTH & I need to go north
return Actions.DASH_NORTH;
} else if (friendDynamic.getY() < 4 && MIAgent.model.getObjectAt(friendDynamic.getX(), friendDynamic.getY() + 1) == null && MIAgent.model.getObjectAt(friendDynamic.getX() + 1, friendDynamic.getY() + 1) == null) {
// No one is SOUTH & I need to go south
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " I need to go north and no one is north & no one is north east");
return Actions.DASH_SOUTH;
} else {
// I do not need to go north or south & no one is directly in front
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " I can go directly to goal");
return Actions.DASH_EAST;
}
}
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Trying to Intercept");
return decideSuperDummyDynamicIntercept();
}
}
return null;
}
private Actions decideSuperDummyGoalAction() {
State current = MIAgent.model.getLastState();
if (current != null) {
Ball b = current.getBall();
Player friendGoal = current.getFriendGoal();
// ball with friend goal
if (b.getX() == friendGoal.getX() && b.getY() == friendGoal.getY()) {
Player friendDyn = current.getFriendDynamic();
if (friendDyn.getY() == friendGoal.getY() && Math.abs(friendDyn.getX() - friendGoal.getX()) < 3) {
return Actions.THROW_EAST;
} else {
return Actions.VOID;
}
} else {
// follow the ball
if (b.getY() > friendGoal.getY()) {
return Actions.DASH_SOUTH;
}
if (b.getY() < friendGoal.getY()) {
return Actions.DASH_NORTH;
}
return Actions.VOID;
}
} else {
return null;
}
}
private Point2D.Double[] decideSuperDummyStaticsSecond(int trial) {
Random r = new Random();
Point2D.Double s1 = null;
Point2D.Double s2 = null;
Point2D.Double s3 = null;
do {
s1 = new Point2D.Double(r.nextInt(6) + 7, r.nextInt(4) + 5);
s2 = new Point2D.Double(r.nextInt(6) + 7, r.nextInt(4) + 5);
s3 = new Point2D.Double(r.nextInt(6) + 7, r.nextInt(4) + 5);
} while (s1.equals(s2) || s1.equals(s3) || s2.equals(s3));
// call the GA and decide
return new Point2D.Double[]{s1, s2, s3};
}
/**
* Decides Action for My dynamic player when it enters the aggressive mode i.e. it has the ball
* and it is in the Goal Region.
* This function uses the heat map and checks which of the best 2 positions for shooting ([11,4] or [11,6])
* is best for shooting and go there. If we reach one of those 2 positions we use the learning to decide
* whether to shoot diagonally or straight.
* @return
*/
private Actions decideDynamicAggressive() {
State currentState = MIAgent.model.getLastState();
double[][] playGroundHeat = Heat.heatMap(currentState);
//Up is best
if (playGroundHeat[bestPositionShootUpX - 2][bestPositionShootUpY - 2] < playGroundHeat[bestPositionShootDownX - 2][bestPositionShootDownY - 2]) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " AGGRESSIVE Up is best. Going UP!");
if ((currentState.getFriendDynamic().getX() - bestPositionShootUpX) < 0) {
if ((currentState.getFriendDynamic().getY() - bestPositionShootUpY) > 0) {
return Actions.DASH_NORTH_EAST;
} else if ((currentState.getFriendDynamic().getY() - bestPositionShootUpY) < 0) {
return Actions.DASH_SOUTH_EAST;
} else {
return Actions.DASH_EAST;
}
} else if ((currentState.getFriendDynamic().getX() - bestPositionShootUpX) == 0) {
if ((currentState.getFriendDynamic().getY() - bestPositionShootUpY) > 0) {
return Actions.DASH_NORTH;
} else if ((currentState.getFriendDynamic().getY() - bestPositionShootUpY) < 0) {
return Actions.DASH_SOUTH;
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " AGGRESSIVE Checking Best Action to Shoot");
return DynamicShootingLearning.getBestActionForGoal();
}
}
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " AGGRESSIVE Down is best");
if ((currentState.getFriendDynamic().getX() - bestPositionShootDownX) < 0) {
if ((currentState.getFriendDynamic().getY() - bestPositionShootDownY) > 0) {
return Actions.DASH_NORTH_EAST;
} else if ((currentState.getFriendDynamic().getY() - bestPositionShootDownY) < 0) {
return Actions.DASH_SOUTH_EAST;
} else {
return Actions.DASH_EAST;
}
} else if ((currentState.getFriendDynamic().getX() - bestPositionShootDownX) == 0) {
if ((currentState.getFriendDynamic().getY() - bestPositionShootDownY) > 0) {
return Actions.DASH_NORTH;
} else if ((currentState.getFriendDynamic().getY() - bestPositionShootDownY) < 0) {
return Actions.DASH_SOUTH;
} else {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " AGGRESSIVE Checking Best Action to Shoot");
return DynamicShootingLearning.getBestActionForGoal();
}
}
}
return null;
}
private Actions decideDynamicAttack() {
return null;
}
private Actions decideDynamicDefense() {
return null;
}
private Actions decideDynamicHarras() {
return DynamicHarras.getDynamicDecision(MIAgent.model.getLastState());
}
private Actions decideDynamicIntercept() {
State current = MIAgent.model.getLastState();
Ball b = current.getBall();
Player fd = current.getFriendDynamic();
Point2D.Double vector = new Point2D.Double(b.getX() - fd.getX(), b.getY() - fd.getY());
if (vector.getX() == 0 && vector.getY() == 0) {
return Actions.VOID;
}
if (Math.abs(vector.getX()) == Math.abs(vector.getY())) {
if (vector.getX() > 0 && vector.getY() > 0) {
return Actions.DASH_NORTH_EAST;
}
if (vector.getX() > 0 && vector.getY() < 0) {
return Actions.DASH_SOUTH_EAST;
}
if (vector.getX() < 0 && vector.getY() > 0) {
return Actions.DASH_NORTH_WEST;
}
if (vector.getX() < 0 && vector.getY() < 0) {
return Actions.DASH_SOUTH_WEST;
}
}
if (Math.abs(vector.getX()) > Math.abs(vector.getY())) {
if (vector.getX() > 0) {
return Actions.DASH_EAST;
}
if (vector.getX() < 0) {
return Actions.DASH_WEST;
}
}
if (Math.abs(vector.getX()) < Math.abs(vector.getY())) {
if (vector.getY() > 0) {
return Actions.DASH_NORTH;
}
if (vector.getY() < 0) {
return Actions.DASH_SOUTH;
}
}
return null;
}
private static Actions decideSuperDummyDynamicIntercept() {
State current = MIAgent.model.getLastState();
Ball b = current.getBall();
Player fd = current.getFriendDynamic();
Point2D.Double vector = new Point2D.Double(b.getX() - fd.getX(), b.getY() - fd.getY());
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Ball is at vector " + vector);
if (vector.getX() == 0 && vector.getY() == 0) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " I have Ball no need to intercept");
return Actions.VOID;
}
if (Math.abs(vector.getX()) == Math.abs(vector.getY())) {
if (vector.getX() > 0 && vector.getY() > 0) {
return Actions.DASH_SOUTH_EAST;
}
if (vector.getX() > 0 && vector.getY() < 0) {
return Actions.DASH_NORTH_EAST;
}
if (vector.getX() < 0 && vector.getY() > 0) {
return Actions.DASH_SOUTH_WEST;
}
if (vector.getX() < 0 && vector.getY() < 0) {
return Actions.DASH_NORTH_WEST;
}
}
if (Math.abs(vector.getX()) > Math.abs(vector.getY())) {
if (vector.getX() > 0) {
return Actions.DASH_EAST;
}
if (vector.getX() < 0) {
return Actions.DASH_WEST;
}
}
if (Math.abs(vector.getX()) < Math.abs(vector.getY())) {
if (vector.getY() > 0) {
return Actions.DASH_SOUTH;
}
if (vector.getY() < 0) {
return Actions.DASH_NORTH;
}
}
return null;
}
private Actions decideDynamicTackle() {
State current = MIAgent.model.getLastState();
Player ed = current.getEnemyDynamic();
Player fd = current.getFriendDynamic();
Point2D.Double vector = new Point2D.Double(ed.getX() - fd.getX(), ed.getY() - fd.getY());
if (vector.getX() == 0 && vector.getY() == 0) {
return Actions.VOID;
}
if (Math.abs(vector.getX()) == Math.abs(vector.getY())) {
if (vector.getX() > 0 && vector.getY() > 0) {
return Actions.DASH_SOUTH_EAST;
}
if (vector.getX() > 0 && vector.getY() < 0) {
return Actions.DASH_NORTH_EAST;
}
if (vector.getX() < 0 && vector.getY() > 0) {
return Actions.DASH_SOUTH_WEST;
}
if (vector.getX() < 0 && vector.getY() < 0) {
return Actions.DASH_NORTH_WEST;
}
}
if (Math.abs(vector.getX()) > Math.abs(vector.getY())) {
if (vector.getX() > 0) {
return Actions.DASH_EAST;
}
if (vector.getX() < 0) {
return Actions.DASH_WEST;
}
}
if (Math.abs(vector.getX()) < Math.abs(vector.getY())) {
if (vector.getY() > 0) {
return Actions.DASH_SOUTH;
}
if (vector.getY() < 0) {
return Actions.DASH_NORTH;
}
}
return null;
}
/**
* This is used to get the action for Dynamic Player when it is in the Tackle Mode, it is used for
* the super dummy player and also for our intelligent
*/
private Actions decideSuperDummyDynamicTackle() {
State current = MIAgent.model.getLastState();
Ball b = current.getBall();
Player fd = current.getFriendDynamic();
Point2D.Double vector;
ValueMap tackleLearned = MiDynamic.GetState();
if (tackleLearned != null) {
vector = new Point2D.Double(tackleLearned.getEnemyDynamic().getX() - fd.getX(), tackleLearned.getEnemyDynamic().getY() - fd.getY());
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Ball is at vector " + vector);
} else {
vector = new Point2D.Double(b.getX() - fd.getX(), b.getY() - fd.getY());
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " Ball is at vector " + vector);
if (vector.getX() == 1) {
if (vector.getY() == -1) {
return Actions.DASH_NORTH;
} else if (vector.getY() == 1) {
return Actions.DASH_SOUTH;
}
}
}
if (vector.getX() == 0 && vector.getY() == 0) {
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " I have Ball no need to intercept");
return Actions.VOID;
}
if (MIAgent.enableLog) System.out.println("\t" + DecisionModule.class.getName() + " TACKLE MODE : " + vector.getX() + " " + vector.getY());
if (Math.abs(vector.getX()) == Math.abs(vector.getY())) {
if (vector.getX() > 0 && vector.getY() > 0) {
return Actions.DASH_SOUTH_EAST;
}
if (vector.getX() > 0 && vector.getY() < 0) {
return Actions.DASH_NORTH_EAST;
}
if (vector.getX() < 0 && vector.getY() > 0) {
return Actions.DASH_SOUTH_WEST;
}
if (vector.getX() < 0 && vector.getY() < 0) {
return Actions.DASH_NORTH_WEST;
}
}
if (Math.abs(vector.getX()) > Math.abs(vector.getY())) {
if (vector.getX() > 0) {
return Actions.DASH_EAST;
}
if (vector.getX() < 0) {
return Actions.DASH_WEST;
}
}
if (Math.abs(vector.getX()) < Math.abs(vector.getY())) {
if (vector.getY() > 0) {
return Actions.DASH_SOUTH;
}
if (vector.getY() < 0) {
return Actions.DASH_NORTH;
}
}
return null;
}
}