diff --git a/code/matt_r/java/hacker/index.html b/code/matt_r/java/hacker/index.html new file mode 100644 index 00000000..c69d74d3 --- /dev/null +++ b/code/matt_r/java/hacker/index.html @@ -0,0 +1,17 @@ + + + + + + + + + Hacked + + +

Press any key to continue.

+ +
+ + + \ No newline at end of file diff --git a/code/matt_r/java/hacker/myscript.js b/code/matt_r/java/hacker/myscript.js new file mode 100644 index 00000000..e0f50fde --- /dev/null +++ b/code/matt_r/java/hacker/myscript.js @@ -0,0 +1,69 @@ + + +let area= document.querySelector('#area') + +let alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', '¼', '½', '¾', '⅓', '⅔', '⅛', '⅜', '⅝', '≈', '>', '≥', '≧', '≩', '≫', '≳', '⋝', '÷', '±', '∓', '≂', '⊟', '⊞', '⨁', '⨤', '⨦', '%', '∟∠∡', '⊾⟀', '⦜', '⦛', '⦠', '√', '∛', '∜', '⍍', '≡', '≢', '⧥', '⩧', '⅀', '◊', '⟠', '⨌⨍⨏', '⨜', '⨛', '◜', '◝', '◞', '◟', '⤸', '⤹', '◆', '◇', '❖', '○', '◍', '●', '◐', '◑', '◒', '◓', '◔', '◕', '◖', '◗', '⬡', '⬢', '‰', 'ⁿ', '¹', '²', '³', '§', '∞', 'ㅅ', '⌖', '◧', '◨', '◩', '◪', '▢', '▣', '▤', '▥', '▦', '▧', '▨', '▩', '▬', '▭', '▮', '▯', '▰', '▱', '◆', '◇', '◈', '◉', '◊', '○', '◌', '◎', '◘', '◙', '◚', '◛', '◜', '◝', '◞', '◟', '◠', '◡', '◢', '◣', '◤', '◥', '◦', '◫', '◬', '◭', '◮', '◯', '▲', '△', '▴', '▵', '▷', '▸', '▹', '►', '▻', '▼', '▽', '▾', '▿' , '◁', '◂', '◃', '◄', '◅'] +const textArray = [ + + 'Congratulations,', + "You've been hacked!!", + ' andfhg a ', + ' hello ', +] + + +let content = '' +let counter = 1 + +// document.body.addEventListener('keypress', (event) => { +// console.log(event) + +// content='' + +// for (let i=0; i < counter; i++){ + +// content += textArray[i] +// } + +// counter += 1 + +// area.innerHTML='' +// area.innerHTML= content + +// }) + + +document.body.addEventListener('keypress', (event) => { + console.log(event) + + content='' + let word='' + + + for (let i=0; i < counter; i++){ + + content += textArray[i] + } + + + let wordLength = Math.floor(Math.random() * (10 - 0) + 0) + + for (let i=0; i < wordLength; i++){ + + let alphaIndex = Math.floor(Math.random() * (166 - 0) + 0) + let letter = alphabet[alphaIndex] + + + word = word + letter + + } + + textArray.push(word + '....') + console.log(word) + + counter += 1 + + area.innerHTML='' + area.innerHTML= content + +}) \ No newline at end of file diff --git a/code/matt_r/java/hacker/styles.css b/code/matt_r/java/hacker/styles.css new file mode 100644 index 00000000..4979f1d6 --- /dev/null +++ b/code/matt_r/java/hacker/styles.css @@ -0,0 +1,13 @@ +.test{ + color: red; + margin-left: 5rem; +} + +.center{ + color: green; + margin-left: 15rem; +} + +body{ + word-wrap: break-word; +} \ No newline at end of file diff --git a/code/matt_r/java/redo_randpass/myscript.js b/code/matt_r/java/redo_randpass/myscript.js new file mode 100644 index 00000000..07d89801 --- /dev/null +++ b/code/matt_r/java/redo_randpass/myscript.js @@ -0,0 +1,73 @@ + + + + +const game = ['rock', 'paper', 'scisors'] +let choice = Math.floor(Math.random() * (2 - 0) + 0); + +let comp = game[choice] +let outcome = '' + +console.log('comp: ' + comp) + + +// let human = nextline('human') + + + + + + +let btn = document.querySelector('#btn') + +btn.onclick = function(){ + // console.log('hello') + + let humanNode = document.querySelector('#human') + let human = humanNode.value + console.log(human) + + if (human == 'rock') { + + if (comp == 'rock') { + outcome = 'its a tie' + } else if (comp == 'scissors') { + outcome = 'Player wins' + } else { + outcome = 'Computer wins' + } + } + + if (human == 'paper') { + + if (comp == 'paper') { + outcome = 'its a tie' + } + else if (comp == 'rock') { + outcome = 'Player wins' + } + else { + outcome = 'Computer wins' + } + } + + if (human == 'scissors'){ + + if (comp == 'scissors'){ + outcome = 'its a tie' + } + else if (comp == 'paper'){ + outcome = 'Player wins' + } + else { + outcome = 'Computer wins' + } + + } + console.log(outcome) + + let result = document.querySelector('#result') + result.innerHTML = `${outcome}, computer chose ${comp}` +} + +