Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
Expand All @@ -16,7 +16,7 @@ <h2>output:</h2>
displayElement.innerHtml = "";

// put the data into the div
output.innerText = data;
displayElement.innerText = data;
}

document.querySelector('#input').addEventListener('change', function(event){
Expand Down
67 changes: 62 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,63 @@
console.log("hello script js");
console.log("hello script js");

var inputHappened = function(currentInput){
console.log( currentInput );
return "WOW SOMETHING HAPPEND";
};
var secretWord = ['c', 'a', 't'];
var fliptable = ['(', '╯', 'ರ', ' ~', 'ರ', ')', '╯', '︵', ' ┻', '━', '┻'];
var countDown = "";
var state = "player";
var flip = 0;
var chanceLeft = fliptable.length - flip;



document.getElementById('output').innerText = "Guess the word!";


var inputHappened = function (currentInput) {
if (state === "player") {

if (flip < 11) {
console.log(currentInput);
document.querySelector('#input').value = "";
var guess = currentInput
var i = 0
var numberFound = false;

// scans the secretWord for a match
// if a match is found, numberFound state changes to true
while (i < secretWord.length) {
if (secretWord[i] === guess) {
numberFound = true;
secretWord.splice(i,1);
}
i++;
}
if (secretWord.length <1 ) {
var output = "You did it! the word is cat! Y to restart";

return output
} if (currentInput == "Y") {
console.log("hi");
location.reload();
}

//if no match is found,
if (numberFound === false) {
countDown += fliptable[flip];

flip++;
console.log(flip);
}
console.log(numberFound);


var chanceLeft = fliptable.length - flip;
var output = chanceLeft + " chances left " + countDown;

return output
} else {
document.querySelector('#input').value = "";
var output = "Game Over (╯ರ ~ ರ)╯︵ ┻━┻ Game Over (╯ರ ~ ರ)╯︵ ┻━┻ Game Over (╯ರ ~ ರ)╯︵ ┻━┻";
return output
}
}
}