<commit_before>//
// BetterClientSimulationBotFromRecording.js
//  examples
//
//  Created by <NAME> building on many others (November 2018).
//  Copyright 2017 High Fidelity, Inc.
//
//  Distributed under the Apache License, Version 2.0.
//  See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//

randFloat = function(low, high) {
    return low + Math.random() * (high - low);
}


var RECORDINGS_ARRAY = [
  "eventer1.hfr",
  // "cop1.hfr", // Bad Model
  // "cop2.hfr", // Bad Model
  "waiting1.hfr",
  "waiting2.hfr",
  // "waiting3.hfr", // Bad Model
  "waiting4.hfr",
  // "waiting5.hfr", // Moves downward
  "waiting6.hfr",
  // "waiting7.hfr", // Bad Model
  "waiting8.hfr",
  "waiting9.hfr",
  "waiting10.hfr",
  "bot1.hfr",
  "bot2.hfr",
  "bot3.hfr",
  "bot4.hfr",
  "check_12.hfr",
  "peanuts.hfr",
  "claude.hfr",
  "usher1.hfr",
  "usher2.hfr",
  "usher3.hfr",
  "jim.hfr"
];

var RECORDING_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Event%20/NPC%27s/" + RECORDINGS_ARRAY[Math.floor(Math.random() * RECORDINGS_ARRAY.length)];
print("RANDOM RECORDING SELECTED:" + RECORDING_URL);

var LOCATIONS_ARRAY = [{ min_x: 20, max_x: 21, y: 0.5, min_z: 20, max_z: 21}];

var LOCATION_PARAMS = LOCATIONS_ARRAY[Math.floor(Math.random() * LOCATIONS_ARRAY.length)];

var LOCATION = { x: randFloat(LOCATION_PARAMS.min_x, LOCATION_PARAMS.max_x) - 72.0, y: LOCATION_PARAMS.y - 22.0, z: randFloat(LOCATION_PARAMS.min_z, LOCATION_PARAMS.max_z) + 74.0 };

var LOCATION_ORIGIN = {x:-80.0, y:-22.0, z:83.0};
var LOCATION_POLAR = { min_yaw: 90, max_yaw: 180, min_radius: 5.0, max_radius: 10.0 }

function genLocation() {
    var seed = Math.random();
    var yaw = LOCATION_POLAR.min_yaw + seed * (LOCATION_POLAR.max_yaw - LOCATION_POLAR.min_yaw);
    var radiusShape = (1.0 - Math.abs(2 * seed - 1.0))

    var radius = randFloat(LOCATION_POLAR.min_radius, LOCATION_POLAR.min_radius + (LOCATION_POLAR.max_radius - LOCATION_POLAR.min_radius) *  radiusShape)

    var polar = { x: 0, y: yaw * Math.PI / 180, z: randFloat(LOCATION_POLAR.min_radius, LOCATION_POLAR.max_radius) };
    var p = Vec3.fromPolar(polar);

    return Vec3.sum(LOCATION_ORIGIN, p);
}
LOCATION = genLocation();

Vec3.print("RANDOM LOCATION SELECTED:", LOCATION);

// Disable the privacy bubble
Users.disableIgnoreRadius();

// Set position here if playFromCurrentLocation is true
Avatar.position = LOCATION;
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, randFloat(0, 360), 0);
Avatar.scale = 1.0;
Agent.isAvatar = true;

// make the agent "listen" to the audio stream to cause additional audio-mixer load, technically this isn't needed when you're playing a recording
// but if you switch to a non-recording bot, you will need this, so we can leave this.
Agent.isListeningToAudioStream = true;

Recording.loadRecording(RECORDING_URL, function(success) {<commit_msg>Adjusting the values for futvrlands<commit_after>//
// BetterClientSimulationBotFromRecording.js
//  examples
//
//  Created by <NAME> building on many others (November 2018).
//  Copyright 2017 High Fidelity, Inc.
//
//  Distributed under the Apache License, Version 2.0.
//  See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//

randFloat = function(low, high) {
    return low + Math.random() * (high - low);
}


var RECORDINGS_ARRAY = [
  "eventer1.hfr",
  // "cop1.hfr", // Bad Model
  // "cop2.hfr", // Bad Model
  "waiting1.hfr",
  "waiting2.hfr",
  // "waiting3.hfr", // Bad Model
  "waiting4.hfr",
  // "waiting5.hfr", // Moves downward
  "waiting6.hfr",
  // "waiting7.hfr", // Bad Model
  "waiting8.hfr",
  "waiting9.hfr",
  "waiting10.hfr",
  "bot1.hfr",
  "bot2.hfr",
  "bot3.hfr",
  "bot4.hfr",
  "check_12.hfr",
  "peanuts.hfr",
  "claude.hfr",
  "usher1.hfr",
  "usher2.hfr",
  "usher3.hfr",
  "jim.hfr"
];

var RECORDING_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Event%20/NPC%27s/" + RECORDINGS_ARRAY[Math.floor(Math.random() * RECORDINGS_ARRAY.length)];
print("RANDOM RECORDING SELECTED:" + RECORDING_URL);

var LOCATIONS_ARRAY = [{ min_x: 20, max_x: 21, y: 0.5, min_z: 20, max_z: 21}];

var LOCATION_PARAMS = LOCATIONS_ARRAY[Math.floor(Math.random() * LOCATIONS_ARRAY.length)];

var LOCATION = { x: randFloat(LOCATION_PARAMS.min_x, LOCATION_PARAMS.max_x) - 72.0, y: LOCATION_PARAMS.y - 22.0, z: randFloat(LOCATION_PARAMS.min_z, LOCATION_PARAMS.max_z) + 74.0 };


var LOCATION_ORIGIN = {x:-80.5, y:-22.0, z:83.5};
var LOCATION_POLAR = { min_yaw: 60, max_yaw: 200, min_radius: 6.0, max_radius: 13.0 }


randFloat = function(low, high) {
    return low + Math.random() * (high - low);
}

clamp = function(x, lower, upper) {
    return Math.max(lower, Math.min(upper, x));
}

smoothstep = function(edge0, edge1, x) {
    var t = clamp( (x - edge0) / (edge1 - edge0), 0, 1);
    return t * t * (3.0 - 2.0 * t);
} 

function genLocation(seed) {
    var sign = (seed >= 0.5 ? 1.0 : -1.0);
    var absSeed = 2.0 * Math.abs((seed - 0.5));
    //var param = smoothstep(1.0, 0.0, absSeed);
    var param = (1.0 - absSeed) * (1.0 - absSeed);
    var yawCoord = 0.5 + sign * 0.5 * param
    var yaw = LOCATION_POLAR.min_yaw + yawCoord * (LOCATION_POLAR.max_yaw - LOCATION_POLAR.min_yaw);

    var radiusCoord = (1.0 - Math.abs(2 * yawCoord - 1.0) * Math.abs(2 * yawCoord - 1.0))
   // var radiusCoord = Math.cos(Math.abs(2 * yawCoord - 1.0))
    var radiusNoise = Math.random()
    //var radiusNoise = 1.0
    radiusCoord = radiusCoord * radiusNoise;

    var radius = LOCATION_POLAR.min_radius + (LOCATION_POLAR.max_radius - LOCATION_POLAR.min_radius) *  radiusCoord;

    var polar = { x: 0, y: yaw * Math.PI / 180, z: radius };
    var p = Vec3.fromPolar(polar);

    var pos = Vec3.sum(LOCATION_ORIGIN, p);
    print(JSON.stringify(pos))
    return pos;
}
LOCATION = genLocation(Math.random());

Vec3.print("RANDOM LOCATION SELECTED:", LOCATION);

// Disable the privacy bubble
Users.disableIgnoreRadius();

// Set position here if playFromCurrentLocation is true
Avatar.position = LOCATION;
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, randFloat(0, 360), 0);
Avatar.scale = 1.0;
Agent.isAvatar = true;

// make the agent "listen" to the audio stream to cause additional audio-mixer load, technically this isn't needed when you're playing a recording
// but if you switch to a non-recording bot, you will need this, so we can leave this.
Agent.isListeningToAudioStream = true;

Recording.loadRecording(RECORDING_URL, function(success) {
{'fraction_non_alphanumeric': 0.15276707260675196, 'fraction_numerical': 0.03653460767689225, 'mean_word_length': 3.681096681096681, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7142377', 'n_tokens_mistral': 2697, 'n_tokens_neox': 2508, 'n_words': 565}