public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    PacmanState that = (PacmanState) o;
    return Arrays.deepEquals(board, that.board) && pacmanPosition.equals(that.pacmanPosition);
}

public int hashCode() {
    int result = pacmanPosition.hashCode();
    result = 31 * result + Arrays.deepHashCode(board);
    return result;
}