it has issues. okay i've made a mistake, i admit that. i hope you're able to admit the mistakes you've made aswell.

This commit is contained in:
TheShinyMelon 2022-12-06 22:12:28 +01:00
parent b205529a11
commit 36dc480ebf
2 changed files with 17 additions and 6 deletions

View File

@ -25,8 +25,17 @@ start.addEventListener("mouseout", () => {
start.innerHTML = "sowwy mastaa! Ow0;" start.innerHTML = "sowwy mastaa! Ow0;"
}); });
start.addEventListener("click", () => { start.addEventListener("click", () => {
parseArr(); //continue with parsedArr parseArr();
parseCmd(); parseCmd();
for(let i=0; i<cmdArr.length; i++) {
move(cmdArr[i][0], cmdArr[i][1], cmdArr[i][2]);
}
let answer = "";
for(let i=0; i<parsedArr.length; i++) {
answer += parsedArr[i][getTopPos(i)];
}
console.log("parsedArr after move()", parsedArr);
console.log("ANSWER UwU", answer);
}); });
function parseArr() { //parsing is hard function parseArr() { //parsing is hard
@ -46,7 +55,7 @@ function parseArr() { //parsing is hard
} }
console.log("stackArr", stackArr); console.log("stackArr", stackArr);
for(let i=0; i<stackArr.length-1; i++) { for(let i=0; i<stackArr.length; i++) {
let tmpLine = []; let tmpLine = [];
let c=0; let c=0;
for(let j=0; j<stackArr[i].length; j++) { for(let j=0; j<stackArr[i].length; j++) {
@ -59,7 +68,7 @@ function parseArr() { //parsing is hard
} }
console.log("cleanArr", cleanArr); console.log("cleanArr", cleanArr);
for(let i=0; i<cleanArr.length; i++) { for(let i=0; i<cleanArr.length-1; i++) {
tmpLine = []; tmpLine = [];
let c=7; let c=7;
for(let j=0; j<8; j++) { for(let j=0; j<8; j++) {
@ -75,7 +84,7 @@ function parseArr() { //parsing is hard
function move(a, s, d) { function move(a, s, d) {
for(let i=0; i<a; i++) { for(let i=0; i<a; i++) {
parsedArr[s-1][getTopPos()] = parsedArr[d-1][getTopPos()]; parsedArr[d-1][getTopPos(d-1)] = parsedArr[s-1][getTopPos(s-1)];
} }
} }
@ -93,9 +102,11 @@ function getTopPos(s) {
function parseCmd() { function parseCmd() {
for(let i=10; i<linesArr.length; i++) { for(let i=10; i<linesArr.length; i++) {
let tmpLine = []; let tmpLine = [];
let tmpBool = true;
for(let j=0; j<linesArr[i].length; j++) { for(let j=0; j<linesArr[i].length; j++) {
if(linesArr[i].charAt(j)=='m') { if(linesArr[i].charAt(j)=='m' && tmpBool) {
let tmp = 1; let tmp = 1;
tmpBool = false;
if(linesArr[i][j+1]!=' ') tmp = 2 if(linesArr[i][j+1]!=' ') tmp = 2
tmpLine[tmpLine.length] = linesArr[i].substr(j+5,tmp); tmpLine[tmpLine.length] = linesArr[i].substr(j+5,tmp);
} }

View File

@ -5,7 +5,7 @@
<button id="start">pwess mee! UwU~</button> <button id="start">pwess mee! UwU~</button>
<hr> <hr>
<h3>Output:</h3> <h3>Output:</h3>
<p id=output>OwO Mastaaw, I dow't like bewwing in a webbwosaaww!! 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 numbaaw UmU~ :</p>
</body> </body>
<script src='script.js'></script> <script src='script.js'></script>