// Path: core/src/com/ychstudio/ai/astar/AStarMap.java
// public class AStarMap {
// 
//     private Node[][] map;
// 
//     private final int width;
//     private final int height;
// 
//     public AStarMap(int width, int height) {
//         this.width = width;
//         this.height = height;
// 
//         map = new Node[height][width];
//         for (int y = 0; y < height; y++) {
//            for (int x = 0; x < width; x++) {
//          	  map[y][x] = new Node(this, x, y);
//            }
//        }
//     }
// 
//     public int getWidth() {
//         return width;
//     }
// 
//     public int getHeight() {
//         return height;
//     }
// 
//     public Node getNodeAt(int x, int y) {
//         return map[y][x];
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder stringBuilder = new StringBuilder();
//         for (int y = 0; y < height; y++) {
//             for (int x = 0; x < width; x++) {
//                stringBuilder.append(map[y][x].isWall ? "#" : " ");
//             }
//             stringBuilder.append("\n");
//         }
//         return stringBuilder.toString();
//     }
// 
// }
// 
// Path: core/src/com/ychstudio/components/GhostComponent.java
// public class GhostComponent implements Component {
// 
//     // state
//     public static final int MOVE_UP = 0;
//     public static final int MOVE_DOWN = 1;
//     public static final int MOVE_LEFT = 2;
//     public static final int MOVE_RIGHT = 3;
//     public static final int ESCAPE = 4;
//     public static final int DIE = 5;
// 
//     public static final float WEAK_TIME = 10f;
//     public float weak_time;
// 
//     public GhostAgent ghostAgent;
// 
//     private final Body body;
// 
//     public int currentState;
// 
//     public boolean weaken;
//     public int hp;
// 
//     public GhostComponent(Body body) {
//         this.body = body;
//         ghostAgent = new GhostAgent(this);
//         ghostAgent.stateMachine.setInitialState(GhostState.MOVE_UP);
//         currentState = MOVE_UP;
//         weaken = false;
//         hp = 1;
//     }
// 
//     public Body getBody() {
//         return body;
//     }
// 
//     public void respawn() {
//         hp = 1;
//         weaken = false;
//     }
// }
// 
// Path: core/src/com/ychstudio/gamesys/GameManager.java
// public class GameManager implements Disposable {
// 
//     public static final GameManager instance = new GameManager();
// 
//     public static final float PPM = 16f;
// 
//     public static final short NOTHING_BIT = 0;
//     public static final short WALL_BIT = 1;
//     public static final short PLAYER_BIT = 1 << 1;
//     public static final short PILL_BIT = 1 << 2;
//     public static final short GHOST_BIT = 1 << 3;
//     public static final short GATE_BIT = 1 << 4;
//     public static final short LIGHT_BIT = 1 << 5;
// 
//     public AssetManager assetManager;
// 
//     public Vector2 playerSpawnPos;
//     public Vector2 ghostSpawnPos;
// 
//     public int totalPills = 0;
// 
//     public int highScore = 0;
//     public int score = 0;
// 
//     public int displayScore = 0;
//     public int displayHighScore = 0;
// 
//     public int playerLives = 4;
//     public boolean playerIsInvincible = true;
// 
//     public boolean bigPillEaten = false;
//     public boolean playerIsAlive = true;
//     private boolean gameOver = false;
// 
//     public AStartPathFinding pathfinder;
// 
//     public Location<Vector2> playerLocation;
// 
//     private GameManager() {
//         assetManager = new AssetManager();
//         assetManager.load("images/actors.pack", TextureAtlas.class);
//         assetManager.load("sounds/pill.ogg", Sound.class);
//         assetManager.load("sounds/big_pill.ogg", Sound.class);
//         assetManager.load("sounds/ghost_die.ogg", Sound.class);
//         assetManager.load("sounds/pacman_die.ogg", Sound.class);
//         assetManager.load("sounds/clear.ogg", Sound.class);
// 
//         assetManager.finishLoading();
// 
//         playerSpawnPos = new Vector2();
//         ghostSpawnPos = new Vector2();
//     }
// 
//     public void decreasePlayerLives() {
//         playerLives--;
//     }
// 
//     public void resetPlayerLives() {
//         playerLives = 3;
//     }
// 
//     public void makeGameOver() {
//         gameOver = true;
//     }
// 
//     public boolean isGameOver() {
//         return gameOver;
//     }
// 
//     public void resetGame(boolean restart) {
//         if (restart) {
//             score = 0;
//             displayScore = 0;
//             resetPlayerLives();
//         }
//         totalPills = 0;
//         playerIsAlive = true;
//         bigPillEaten = false;
//         gameOver = false;
//     }
// 
//     public void addScore(int score) {
//         this.score += score;
//         if (this.score > highScore) {
//             highScore = this.score;
//         }
//     }
// 
//     @Override
//     public void dispose() {
//         assetManager.dispose();
//     }
// }


import com.badlogic.gdx.ai.fsm.State;
import com.badlogic.gdx.ai.msg.Telegram;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.RayCastCallback;
import com.badlogic.gdx.physics.box2d.World;
import com.ychstudio.ai.astar.AStarMap;
import com.ychstudio.components.GhostComponent;
import com.ychstudio.gamesys.GameManager;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
package com.ychstudio.ai.fsm;


public enum GhostState implements State<GhostAgent> {

    MOVE_UP() {
        @Override
        public void update(GhostAgent entity) {
// Path: core/src/com/ychstudio/ai/astar/AStarMap.java
// public class AStarMap {
// 
//     private Node[][] map;
// 
//     private final int width;
//     private final int height;
// 
//     public AStarMap(int width, int height) {
//         this.width = width;
//         this.height = height;
// 
//         map = new Node[height][width];
//         for (int y = 0; y < height; y++) {
//            for (int x = 0; x < width; x++) {
//          	  map[y][x] = new Node(this, x, y);
//            }
//        }
//     }
// 
//     public int getWidth() {
//         return width;
//     }
// 
//     public int getHeight() {
//         return height;
//     }
// 
//     public Node getNodeAt(int x, int y) {
//         return map[y][x];
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder stringBuilder = new StringBuilder();
//         for (int y = 0; y < height; y++) {
//             for (int x = 0; x < width; x++) {
//                stringBuilder.append(map[y][x].isWall ? "#" : " ");
//             }
//             stringBuilder.append("\n");
//         }
//         return stringBuilder.toString();
//     }
// 
// }
// 
// Path: core/src/com/ychstudio/components/GhostComponent.java
// public class GhostComponent implements Component {
// 
//     // state
//     public static final int MOVE_UP = 0;
//     public static final int MOVE_DOWN = 1;
//     public static final int MOVE_LEFT = 2;
//     public static final int MOVE_RIGHT = 3;
//     public static final int ESCAPE = 4;
//     public static final int DIE = 5;
// 
//     public static final float WEAK_TIME = 10f;
//     public float weak_time;
// 
//     public GhostAgent ghostAgent;
// 
//     private final Body body;
// 
//     public int currentState;
// 
//     public boolean weaken;
//     public int hp;
// 
//     public GhostComponent(Body body) {
//         this.body = body;
//         ghostAgent = new GhostAgent(this);
//         ghostAgent.stateMachine.setInitialState(GhostState.MOVE_UP);
//         currentState = MOVE_UP;
//         weaken = false;
//         hp = 1;
//     }
// 
//     public Body getBody() {
//         return body;
//     }
// 
//     public void respawn() {
//         hp = 1;
//         weaken = false;
//     }
// }
// 
// Path: core/src/com/ychstudio/gamesys/GameManager.java
// public class GameManager implements Disposable {
// 
//     public static final GameManager instance = new GameManager();
// 
//     public static final float PPM = 16f;
// 
//     public static final short NOTHING_BIT = 0;
//     public static final short WALL_BIT = 1;
//     public static final short PLAYER_BIT = 1 << 1;
//     public static final short PILL_BIT = 1 << 2;
//     public static final short GHOST_BIT = 1 << 3;
//     public static final short GATE_BIT = 1 << 4;
//     public static final short LIGHT_BIT = 1 << 5;
// 
//     public AssetManager assetManager;
// 
//     public Vector2 playerSpawnPos;
//     public Vector2 ghostSpawnPos;
// 
//     public int totalPills = 0;
// 
//     public int highScore = 0;
//     public int score = 0;
// 
//     public int displayScore = 0;
//     public int displayHighScore = 0;
// 
//     public int playerLives = 4;
//     public boolean playerIsInvincible = true;
// 
//     public boolean bigPillEaten = false;
//     public boolean playerIsAlive = true;
//     private boolean gameOver = false;
// 
//     public AStartPathFinding pathfinder;
// 
//     public Location<Vector2> playerLocation;
// 
//     private GameManager() {
//         assetManager = new AssetManager();
//         assetManager.load("images/actors.pack", TextureAtlas.class);
//         assetManager.load("sounds/pill.ogg", Sound.class);
//         assetManager.load("sounds/big_pill.ogg", Sound.class);
//         assetManager.load("sounds/ghost_die.ogg", Sound.class);
//         assetManager.load("sounds/pacman_die.ogg", Sound.class);
//         assetManager.load("sounds/clear.ogg", Sound.class);
// 
//         assetManager.finishLoading();
// 
//         playerSpawnPos = new Vector2();
//         ghostSpawnPos = new Vector2();
//     }
// 
//     public void decreasePlayerLives() {
//         playerLives--;
//     }
// 
//     public void resetPlayerLives() {
//         playerLives = 3;
//     }
// 
//     public void makeGameOver() {
//         gameOver = true;
//     }
// 
//     public boolean isGameOver() {
//         return gameOver;
//     }
// 
//     public void resetGame(boolean restart) {
//         if (restart) {
//             score = 0;
//             displayScore = 0;
//             resetPlayerLives();
//         }
//         totalPills = 0;
//         playerIsAlive = true;
//         bigPillEaten = false;
//         gameOver = false;
//     }
// 
//     public void addScore(int score) {
//         this.score += score;
//         if (this.score > highScore) {
//             highScore = this.score;
//         }
//     }
// 
//     @Override
//     public void dispose() {
//         assetManager.dispose();
//     }
// }


// Path: core/src/com/ychstudio/ai/fsm/GhostState.java
import com.badlogic.gdx.ai.fsm.State;
import com.badlogic.gdx.ai.msg.Telegram;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.RayCastCallback;
import com.badlogic.gdx.physics.box2d.World;
import com.ychstudio.ai.astar.AStarMap;
import com.ychstudio.components.GhostComponent;
import com.ychstudio.gamesys.GameManager;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

package com.ychstudio.ai.fsm;


public enum GhostState implements State<GhostAgent> {

    MOVE_UP() {
        @Override
        public void update(GhostAgent entity) {
            entity.ghostComponent.currentState = GhostComponent.MOVE_UP;