it's not workinggg

This commit is contained in:
TheShinyMelon 2022-12-08 12:46:04 +01:00
parent eed32a6b52
commit 96f7cc5a57
2 changed files with 22 additions and 7 deletions

View File

@ -1,4 +1,5 @@
let output = document.getElementById("output");
let errorOutput = document.getElementById("error");
let input;
let linesArr;
let parsedArr = [];
@ -25,7 +26,17 @@ start.addEventListener("mouseout", () => {
start.innerHTML = "sowwy mastaa! Ow0;"
});
start.addEventListener("click", () => {
parseArr();
try {
parseArr();
}
catch(e) {
console.error(e);
errorOutput.innerHTML = "^^^ pwease gibe me file fiwwst!!1! :3";
return 1;
}
if (errorOutput.innerHTML != "") {
errorOutput.innerHTML = "senk ju~ *UwU~";
}
parseCmd();
for(let i=0; i<cmdArr.length; i++) {
move(cmdArr[i][0], cmdArr[i][1], cmdArr[i][2]);
@ -36,6 +47,7 @@ start.addEventListener("click", () => {
}
console.log("parsedArr after move()", parsedArr);
console.log("ANSWER UwU", answer);
output.innerHTML += " " + answer + " &nbsp;&nbsp;&nbsp; ╭∩╮UwU╭∩╮";
});
function parseArr() { //parsing is hard
@ -56,7 +68,7 @@ function parseArr() { //parsing is hard
console.log("stackArr", stackArr);
for(let i=0; i<stackArr.length; i++) {
let tmpLine = [];
let tmpLine = [];
let c=0;
for(let j=0; j<stackArr[i].length; j++) {
if(stackArr[8][j]!=undefined) {
@ -68,12 +80,13 @@ function parseArr() { //parsing is hard
}
console.log("cleanArr", cleanArr);
for(let i=0; i<cleanArr.length-1; i++) {
for(let i=0; i<cleanArr.length; i++) {
tmpLine = [];
let c=7;
for(let j=0; j<8; j++) {
if(cleanArr[j][i] != undefined) {
if(cleanArr[j][i] != undefined/* || cleanArr[j][i] != null || typeof(cleanArr[j][i]) != "NaN"*/) {
tmpLine[c] = cleanArr[j][i];
console.log(tmpLine, cleanArr[j][i]);
}
c--;
}

View File

@ -1,11 +1,13 @@
<!DOCTYPE html>
<body>
<h3>Input-File: </h3><input onchange='readFile(this)' type='file'>
<body style="background-color: #3333; font-family: monospace;">
<h3>Input-File: </h3>
<input onchange='readFile(this)' type='file'>
<button id="start">pwess mee! UwU~</button>
<p id='error'></p>
<hr>
<h3>Output:</h3>
<p id=output>OwO Mastaaw, I dow't like bewwing in a webbwosaaww!! <br><br>I feew dizzy.. OwO° Anyway hewe's youww numbaaw UmU~ :</p>
<p id=output>OwO Mastaaw, I dow't like bewwing in a webbwosaaww!! <br><br>I feew dizzy.. OwO° Anyway hewe's youww ansaaww UmU~ :</p>
</body>
<script src='script.js'></script>