<commit_before>// lecture140.js

var mode = 6;
var colors = [];
var pickedColor;
var squares = document.querySelectorAll('.square');
var colorDisplay = document.getElementById('colorDisplay');
var messageDisplay = document.querySelector('#message');
var h1 = document.querySelector('h1');
var resetButton = document.querySelector('#reset');
var modeButtons = document.querySelectorAll('.mode');

function changeColors() {
  // loop through all colors
  for (var i = 0; i < squares.length; i++) {
    // change each color to match given color
    squares[i].style.background = pickedColor.rgb;
  }
}

function pickColor() {
  // picks the color
  var random = Math.floor(Math.random() * colors.length);
  return colors[random];
}

function randomColor() {
  var color = {};
  // pick a red 0-255, green 0-255, blue 0-255
  var r = Math.floor(Math.random() * 256);
  var g = Math.floor(Math.random() * 256);
  var b = Math.floor(Math.random() * 256);
  // this creates the hex version of the same color
  // this is displayed instead of correct at game end
  var hR = r.toString(16);
  var hG = g.toString(16);
  var hB = b.toString(16);
  // bundle this up into an object
  color.hex = `#h${hR + hG + hB}`;
  color.rgb = `rgb(${r}, ${g}, ${b})`;
  return color;
}
<commit_msg>Color game, lecture148, fixed 'h' in hex number<commit_after>// lecture140.js

var mode = 6;
var colors = [];
var pickedColor;
var squares = document.querySelectorAll('.square');
var colorDisplay = document.getElementById('colorDisplay');
var messageDisplay = document.querySelector('#message');
var h1 = document.querySelector('h1');
var resetButton = document.querySelector('#reset');
var modeButtons = document.querySelectorAll('.mode');

function changeColors() {
  // loop through all colors
  for (var i = 0; i < squares.length; i++) {
    // change each color to match given color
    squares[i].style.background = pickedColor.rgb;
  }
}

function pickColor() {
  // picks the color
  var random = Math.floor(Math.random() * colors.length);
  return colors[random];
}

function randomColor() {
  var color = {};
  // pick a red 0-255, green 0-255, blue 0-255
  var r = Math.floor(Math.random() * 256);
  var g = Math.floor(Math.random() * 256);
  var b = Math.floor(Math.random() * 256);
  // this creates the hex version of the same color
  // this is displayed instead of correct at game end
  var hR = r.toString(16);
  var hG = g.toString(16);
  var hB = b.toString(16);
  // bundle this up into an object
  color.hex = `#${hR + hG + hB}`;
  color.rgb = `rgb(${r}, ${g}, ${b})`;
  return color;
}

{'fraction_non_alphanumeric': 0.154084397986837, 'fraction_numerical': 0.02748741773132017, 'mean_word_length': 3.7326007326007327, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '226508', 'n_tokens_mistral': 866, 'n_tokens_neox': 825, 'n_words': 261}