// Pseduocdoe
// Mission: The computer will randomly select a word. It is your objective to guess what that word starts with. If you guess correctly you win. The amount of tries you have is determined by the length of the word. If you can't successfully guess the correct letter during that period then you lose.
// Goals: Correctly guess the first letter in the randomly selected word.
// Objects: Computer, User
// Functions: startGame, guess, checkUserGuess

// Create a function called startGame: Displays game objective and rules to user
// Create a object called user
//    Declare a property called letterArray which contains letters a - z
//    Declare a property called userGuess and set that to null
//    Declare a property called numOfGuessesLeft set that equal to the length of the word declared in the computer object
//    Declare a method called guess
//        Generate a random num between 0 and one less than length
//        use that number to randomly grab a letter from the letterArray
//        set the value equal to userGuess

// Create a object called computer
//    Declare a property called word and set it equal to a value
//    Declare a method called checkUserGuess
//      iterate through the each letter in the word property
//      IF numOfGuessesLeft > 0 THEN
//          IF user.userGuess ==== first letter of string THEN
//                return Yay! you have a match! The full word is "word"
//                subtract one from userGuess
//          END IF
//      ELSE
//          return You didn't guess the first letter in enough time!
//      END If
//   DECLARE a letterArray from [a..z]
//   DECLARE a property called userGuess and set it to null
//   DECLARE a method called guess
//     When guess is called it will randomly select a value from the letter array


function startGame () {
    return "Welcome to Guess the First Letter of the word.\nMission: Correctly guess the first letter of the word.\nRules: The computer will randomly select a word.\nIt is your objective to guess what that word starts with.\nIf you guess correctly you win.\nThe amount of tries you have is determined by the length of the word.\nIf you can't successfully guess the correct letter during that period then you lose.";
};

var computer = {
     word: "wirable",
     checkUserGuess: function() {
        if (user.numOfGuessesLeft > 0) {
            if (user.userGuess === this.word.charAt(0)) {
                return "It's a match! The full word is " + this.word + ".";
            } else {
                console.log("Not a match");
                user.numOfGuessesLeft = user.numOfGuessesLeft - 1;
                console.log("You have " + user.numOfGuessesLeft + " guesses left.")
                console.log(user.guess());
            }
        } else {
              console.log("Sorry I can't accept that guess. Better luck next time.");
        }
     }
};

var user = {
   letterArray: "abcdefghijklmnopqrstuvwxyz".split(""),
   userGuess: null,
   numOfGuessesLeft: computer.word.length,

   guess: function() {
      var index = Math.floor(Math.random() * this.letterArray.length);
      console.log(this.userGuess = this.letterArray[index]);
      console.log(computer.checkUserGuess());
  }

};

console.log(startGame());
console.log(user.guess());


@@ -1884,64 +1884,8 @@
 the 
-word.%5CnMission: Correctly guess the first letter of the 
 word
@@ -2217,18 +2217,20 @@
     word
+s
 : 
+%5B
 %22wirable
@@ -2231,16 +2231,314 @@
 irable%22,
+ %22unrocked%22, %22hausen%22, %22platonised%22, %22chantey%22, %22pest%22, %22roven%22%5D,%0A     wordToGuess: null,%0A%0A     selectWord: function() %7B%0A        var index = Math.floor(Math.random() * this.words.length);%0A        this.wordToGuess = this.words%5Bindex%5D;%0A        user.numOfGuessesLeft = this.wordToGuess.length;%0A     %7D,
 %0A     ch
@@ -2649,16 +2649,23 @@
 his.word
+ToGuess
 .charAt(
@@ -2738,16 +2738,23 @@
 his.word
+ToGuess
  + %22.%22;%0A
@@ -2968,16 +2968,17 @@
  left.%22)
+;
 %0A       
@@ -2986,28 +2986,23 @@
         
-console.log(
+return 
 user.gue
@@ -3001,25 +3001,24 @@
 user.guess()
-)
 ;%0A          
@@ -3052,28 +3052,23 @@
         
-console.log(
+return 
 %22Sorry I
@@ -3092,16 +3092,44 @@
 t guess.
+ You are all out of guesses.
  Better 
@@ -3144,17 +3144,16 @@
 t time.%22
-)
 ;%0A      
@@ -3281,28 +3281,12 @@
 ft: 
-computer.word.length
+null
 ,%0A%0A 
@@ -3384,28 +3384,16 @@
 ;%0A      
-console.log(
 this.use
@@ -3424,17 +3424,16 @@
 y%5Bindex%5D
-)
 ;%0A      
@@ -3444,16 +3444,82 @@
 ole.log(
+%22Does the word start with %22 + this.userGuess + %22?%22);%0A      return 
 computer
@@ -3535,17 +3535,16 @@
 rGuess()
-)
 ;%0A  %7D%0A%0A%7D
@@ -3572,16 +3572,123 @@
 ame());%0A
+console.log(computer.selectWord());%0Aconsole.log(computer.wordToGuess);%0Aconsole.log(user.numOfGuessesLeft);%0A
 console.

Create word array.