<commit_before>/**
 * @license
 * Code City: Demonstration database.
 *
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @fileoverview Demonstration database for Code City.
 * @author <EMAIL> (<NAME>)
 */

// Set up a room, two users, and a rock.
(function () {
  var hangout = Object.create($.room);
  hangout.name = 'Hangout';
  hangout.description = 'A place to hang out, chat, and program.';
  hangout.roll = function(cmd) {
    var json = {
      type: 'iframe',
      url: "https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1"
    };
    this.tellAll(json);
  };
  hangout.roll.verb = 'roll';
  hangout.roll.dobj = 'none';
  hangout.roll.prep = 'none';
  hangout.roll.iobj = 'none';
  $.startRoom = hangout;

  var clock = Object.create($.thing);
  clock.name = 'clock';
  clock.getDescription = function() {
    return 'It is currently ' + Date();
  };
  clock.getSvgText = function() {
    var svg = '<circle cx="0" cy="30" r="10" class="fillWhite" />';
    var r = 10;
    for (var i = 0; i < 12; i++) {
      var a = Math.PI * 2 / 12 * i;
      var length = (i % 3 === 0) ? 2 : 1;
      var x1 = Math.sin(a) * r;
      var y1 = Math.cos(a) * r + 30;
      var x2 = Math.sin(a) * (r - length);
      var y2 = Math.cos(a) * (r - length) + 30;
      svg += '<line x1="' + x1 + '" y1="' + y1 + '" x2="' + x2 + '" y2="' + y2 + '" />';
    }
    var now = new Date;
    var minutes = now.getMinutes() + (now.getSeconds() / 60);
    var hours = now.getHours() + (minutes / 60);
    var x1 = 0;
    var y1 = 30;
    a = minutes / 60 * Math.PI * 2 + Math.PI;
    var x2 = Math.sin(a) * -8;
    var y2 = Math.cos(a) * 8 + 30;
    svg += '<line x1="' + x1 + '" y1="' + y1 + '" x2="' + x2 + '" y2="' + y2 + '" />';
    a = hours / 12 * Math.PI * 2 + Math.PI;
    var x2 = Math.sin(a) * -6;
    var y2 = Math.cos(a) * 6 + 30;
    svg += '<line x1="' + x1 + '" y1="' + y1 + '" x2="' + x2 + '" y2="' + y2 + '" />';
    return svg;
  };
  clock.moveTo(hangout);
  clock.chime = function(silent) {
    var now = new Date;
    var nextHour = now.getTime() - (now.getTime() % 3600000) + 3600000;
    setTimeout(clock.chime.bind(clock), nextHour);
    if (silent) {
      return;
    }
    var hours = (now.getHours() % 12) || 12;
    var text = [];
    while (hours--) {
      text.push('Bong.');
    }
    this.location.narrateAll(text.join(' '), this);
  };
  clock.chime(true);

  var bob = Object.create($.user);
  bob.name = 'Bob';
  $.userDatabase['1387bfc24b159b3bd6ea187c66551d6b08f52dafb7fe5c3a5a93478f54ac6202b8f78efe5817015c250173b23a70f7f6ef3205e9f5d28730e0ff2033cc6fcf84'] = bob;
  bob.description = 'Looks a bit Canadian.';
  bob.svgText = '<path d="m 1.59,78.8 c 1.48,-6.43 3.16,-12.8 5.20,-18.9 1.71,5.85 3.26,11.5 6.06,18.5" />';
  bob.svgText += '<path d="m 0.74,99.4 c 3.18,-7.65 4.14,-15.4 6.27,-23.6 1.11,6.88 2.32,14.5 3.72,23.7" />';
  bob.svgText += '<path d="m 7.01,76.8 c -0.44,-7.45 -0.78,-14.6 -0.11,-18.7" />';
  bob.svgText += '<path d="m 6.59,58.5 c -3.47,-1.83 -6.15,-6.17 -6.06,-10.1 0.07,-3.06 2.25,-6.52 5.10,-7.65 2.94,-1.17 6.90,0.01 9.24,2.12 2.20,1.98 3.12,5.45 2.87,8.39 -0.22,2.57 -1.53,5.42 -3.72,6.80 -2.10,1.33 -5.24,1.59 -7.44,0.42 z" class="fillWhite" />';
  bob.moveTo(hangout);

  var alice = Object.create($.user);
  alice.name = 'Alice';
  $.userDatabase['4b567644d33ad68a38a45d3fb61e5a53a64cf261ea2516d9a3de5235e75d7490b9bd7b2dc12f64182f9b9b50ddb113f257803c1d069cbb32da1719d06a567cee'] = alice;
  alice.description = 'Mostly harmless.';
  alice.svgText = '<path d="m 7.01,77.6 c 1.6,-5.5 3.39,-12.3 5.29,-18.6 2.1,6.5 3.5,15.1 4.8,18.6" />';<commit_msg>Fix clock's chime.<commit_after>/**
 * @license
 * Code City: Demonstration database.
 *
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @fileoverview Demonstration database for Code City.
 * @author fr<EMAIL> (<NAME>)
 */

// Set up a room, two users, and a rock.
(function () {
  var hangout = Object.create($.room);
  hangout.name = 'Hangout';
  hangout.description = 'A place to hang out, chat, and program.';
  hangout.roll = function(cmd) {
    var json = {
      type: 'iframe',
      url: 'https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1'
    };
    this.tellAll(json);
  };
  hangout.roll.verb = 'roll';
  hangout.roll.dobj = 'none';
  hangout.roll.prep = 'none';
  hangout.roll.iobj = 'none';
  $.startRoom = hangout;

  var clock = Object.create($.thing);
  clock.name = 'clock';
  clock.getDescription = function() {
    return 'It is currently ' + Date();
  };
  clock.getSvgText = function() {
    var svg = '<circle cx="0" cy="30" r="10" class="fillWhite" />';
    var r = 10;
    for (var i = 0; i < 12; i++) {
      var a = Math.PI * 2 / 12 * i;
      var length = (i % 3 === 0) ? 2 : 1;
      var x1 = Math.sin(a) * r;
      var y1 = Math.cos(a) * r + 30;
      var x2 = Math.sin(a) * (r - length);
      var y2 = Math.cos(a) * (r - length) + 30;
      svg += '<line x1="' + x1 + '" y1="' + y1 + '" x2="' + x2 + '" y2="' + y2 + '" />';
    }
    var now = new Date;
    var minutes = now.getMinutes() + (now.getSeconds() / 60);
    var hours = now.getHours() + (minutes / 60);
    var x1 = 0;
    var y1 = 30;
    a = minutes / 60 * Math.PI * 2 + Math.PI;
    var x2 = Math.sin(a) * -8;
    var y2 = Math.cos(a) * 8 + 30;
    svg += '<line x1="' + x1 + '" y1="' + y1 + '" x2="' + x2 + '" y2="' + y2 + '" />';
    a = hours / 12 * Math.PI * 2 + Math.PI;
    var x2 = Math.sin(a) * -6;
    var y2 = Math.cos(a) * 6 + 30;
    svg += '<line x1="' + x1 + '" y1="' + y1 + '" x2="' + x2 + '" y2="' + y2 + '" />';
    return svg;
  };
  clock.moveTo(hangout);
  clock.chime = function(silent) {
    var minuteMs = 60 * 1000;
    var hourMs = 60 * minuteMs;
    var now = new Date;
    var hours = (now.getHours() % 12) || 12;
    var nextHour = hourMs - (now.getTime() % hourMs);
    if (nextHour < minuteMs && !silent) {
      // Next hour is less than a minute away, we got called a wee bit too soon.
      // Schedule for the next hour.
      nextHour += hourMs;
      // Round current hour up to the next hour.
      hours++;
    }
    setTimeout(clock.chime.bind(clock), nextHour);
    if (!silent) {
      var text = [];
      while (hours--) {
        text.push('Bong.');
      }
      this.location.narrateAll(text.join(' '), this);
    }
  };
  clock.chime(true);

  var bob = Object.create($.user);
  bob.name = 'Bob';
  $.userDatabase['1387bfc24b159b3bd6ea187c66551d6b08f52dafb7fe5c3a5a93478f54ac6202b8f78efe5817015c250173b23a70f7f6ef3205e9f5d28730e0ff2033cc6fcf84'] = bob;
  bob.description = 'Looks a bit Canadian.';
  bob.svgText = '<path d="m 1.59,78.8 c 1.48,-6.43 3.16,-12.8 5.20,-18.9 1.71,5.85 3.26,11.5 6.06,18.5" />';
  bob.svgText += '<path d="m 0.74,99.4 c 3.18,-7.65 4.14,-15.4 6.27,-23.6 1.11,6.88 2.32,14.5 3.72,23.7" />';
  bob.svgText += '<path d="m 7.01,76.8 c -0.44,-7.45 -0.78,-14.6 -0.11,-18.7" />';
  bob.svgText += '<path d="m 6.59,58.5 c -3.47,-1.83 -6.15,-6.17 -6.06,-10.1 0.07,-3.06 2.25,-6.52 5.10,-7.65 2.94,-1.17 6.90,0.01 9.24,2.12 2.20,1.98 3.12,5.45 2.87,8.39 -0.22,2.57 -1.53,5.42 -3.72,6.80 -2.10,1.33 -5.24,1.59 -7.44,0.42 z" class="fillWhite" />';
  bob.moveTo(hangout);

  var alice = Object.create($.user);
  alice.name = 'Alice';
  $.userDatabase['<KEY>'] = alice;
  alice.description = 'Mostly harmless.';
  alice.svgText = '<path d="m 7.01,77.6 c 1.6,-5.5 3.39,-12.3 5.29,-18.6 2.1,6.5 3.5,15.1 4.8,18.6" />';
{'fraction_non_alphanumeric': 0.19430999881950184, 'fraction_numerical': 0.11332782434187227, 'mean_word_length': 2.6189662537377187, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, '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': '6499828', 'n_tokens_mistral': 3982, 'n_tokens_neox': 3477, 'n_words': 856}