<commit_before>'use strict';

var score = 0;

// List of questions to ask user
var questions = ['Do I like videogames?', 'Is my favorite hobby photography?',
  'Do I have any pets?', 'Do I like to go hiking?', 'Do I paint?'
];

// List of answers for each question
var answers = ['yes', 'yes', 'no', 'yes', 'no',
];
// Responses to each question.
var responses = [
  'Yes! I love to play games! When I have time that is.',
  'Right! I love hiking/backpacking to beautifull places and taking photos!',
  'Nope. But I would love to have a dog in the future!',
  'Yes! you probably remember I mentioned I like to take photos when I hike ;)',
  'Nope! Sadly. I would love to learn to paint.'
];
// List for last question
var placesILived = ['Spain', 'California', 'Idaho', 'Germany', 'New York',
  'Texas', 'Oregon', 'Paris'
];

//Store user's name
var user = prompt('Hi, what is your name?').toLowerCase();
console.log('user = ' + user);
alert(user + ', welcome to my guessing game. Let\'s see if you can guess a few things about me');

// Loop through questions and reply with appropriate response
var answer;
for(var i = 0; i < questions.length; i++) {
  answer = prompt(questions[i] + '( yes or no).').toLowerCase();
  console.log(answer);
  if(answer === answers[i]) {
    score++;
    alert(responses[i] + ' Score: ' + score);
  } else {
    alert('Wrong answer!');
  }
}

var answer6;
for(var i = 4; i > 0; i--) {
  answer6 = parseInt(prompt('What is my favorite number. HINT: between 2-6. You have ' + i + ' guesses left!'));
  if(answer6 === 3) {
    score++;
    alert('Correct! the answer is 3!');
    break;
  } else if(answer6 < 3) {
    alert('Too low!');
  } else if(answer6 > 3) {
    alert('Too high!');
  }
}
alert('You ran out of guesses! The correct answer is 3!');

var answer7;
for(var i = 6; i > 0; i--) {
  answer7 = prompt('Guess a place I have lived before? You have ' + i + ' guesses left. ' + placesILived);
  console.log('answer7 = ' + answer7);
  if(placesILived.indexOf(answer7) > -1) {
    score++;
    alert('Correct! I have lived in ' + answer7 + '.');
    break;
  } else if(answer6 < 3) {
    alert('Too low!');
  } else if(answer6 > 3) {
    alert('Too high!');
  }
}
alert('You ran out of guesses! The correct answer is Germany!');

// Show total number of correct answers to the user
alert('You got ' + score + ' out of ' + questions.length + ' questions correct ' + user + '!');<commit_msg>wrapped questions in functions, made any syntex error corrections.<commit_after>'use strict';

var userPoints = 0;
// List for last question
var placesILived = ['Spain', 'California', 'Idaho', 'Germany', 'New York',
  'Texas', 'Oregon', 'Paris'
];

//Store user's name
var user = prompt('Hi, what is your name?').toLowerCase();
console.log('user = ' + user);
alert(user + ', welcome to my guessing game. Let\'s see if you can guess a few things about me');

//Question 1
function question1() {
  var answer = prompt('Do I like videogames. Type Yes or No').toLowerCase();
  console.log('First question, user has started with zero points.');

  if(answer === 'yes' || answer === 'y') {
    alert('Yes! I love to play games! When I have time that is.');
    userPoints++;
    console.log(userPoints);
  } else {
    alert('Wrong. I love videogames.');
  }
}
question1();

//Question 2
function question2() {
  var answer1 = prompt('Is my favorite hobby photography?').toLowerCase();
  console.log('After Question 1, user has ' + userPoints + '!');

  if(answer1 === 'yes' || answer1 === 'y') {
    alert('Right! I love hiking/backpacking to beautifull places and taking photos');
    userPoints++;
    console.log(userPoints);
  } else {
    alert('Sorry, that\'s wrong.');
  }
}
question2();

//Question 3
function question3() {
  var answer2 = prompt('Do I have any pets?').toLowerCase();
  console.log();
  if(answer2 === 'no' || answer2 === 'n') {
    alert('Nope. But I would love to have a dog in the future!');
    //userPoints++;
    console.log(userPoints);
  } else {
    alert('No, I\'m sorry that isn\'t correct either.');
  }
}
question3();

//Question 4
function question4() {
  var answer3 = prompt('Do I like to go hiking?').toLowerCase();
  console.log(answer3);
  if(answer3 === 'no' || answer3 === 'n') {
    alert('Yes! you probably remember I mentioned I like to take photos when I hike ;)');
    userPoints++;
    console.log(userPoints);
  } else {
    alert('Incorrect!');
  }
}
question4();

//Question 5
function question5() {
  var answer4 = prompt('Do I paint?').toLowerCase();
  console.log('user answered and has ' + userPoints + ' so far');

  if(answer4 === 'no' || answer4 === 'n') {
    alert('Nope! Sadly. I would love to learn to paint.' + userPoints + ' /5!');
    userPoints++;
    console.log(userPoints);
  } else {
    alert('Sorry, that is not right.');
  }
}
question5();

function question6() {
  var answer6;
  for(var i = 4; i > 0; i--) {
    answer6 = parseInt(prompt('What is my favorite number. HINT: between 2-6. You have ' + i + ' guesses left!'));
    if(answer6 === 3) {
      userPoints++;
      alert('Correct! the answer is 3!');
      break;
    } else if(answer6 < 3) {
      alert('Too low!');
    } else if(answer6 > 3) {
      alert('Too high!');
    }
  }
  alert('You ran out of guesses! The correct answer is 3!');
}
question6();

function question7() {
  var answer7;
  for(var i = 6; i > 0; i--) {
    answer7 = prompt('Guess a place I have lived before? You have ' + i + ' guesses left. ' + placesILived);
    console.log('answer7 = ' + answer7);
    if(placesILived.indexOf(answer7) > -1) {
      userPoints++;
      alert('Correct! I have lived in ' + answer7 + '.');
      break;
    } else if(answer7 < 3) {
      alert('Too low!');
    } else if(answer7 > 3) {
      alert('Too high!');
    }
  }
  alert('You ran out of guesses! The correct answer is Germany!');
  // Show total number of correct answers to the user
  alert('You got ' + userPoints + ' out of 7 questions correct ' + user + '!');
}
question7();
{'fraction_non_alphanumeric': 0.16630597636091227, 'fraction_numerical': 0.015315465290494424, 'mean_word_length': 3.28836545324768, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 13, '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': '540990', 'n_tokens_mistral': 1999, 'n_tokens_neox': 1953, 'n_words': 695}