diff options
author | amy <[email protected]> | 2023-02-10 19:36:26 -0600 |
---|---|---|
committer | amy <[email protected]> | 2023-02-10 19:36:26 -0600 |
commit | 8de1455ee981de70de25257b29844235985bc206 (patch) | |
tree | 6a923ae5645de7640c8103887cafdf3c4d6aa686 /src | |
parent | ef4fb392bea8648bf04f3e9349758a1c9e573d12 (diff) |
fixed border gen
Diffstat (limited to 'src')
-rw-r--r-- | src/fs.json | 4 | ||||
-rw-r--r-- | src/jssh.js | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/fs.json b/src/fs.json index 1709ae2..959b773 100644 --- a/src/fs.json +++ b/src/fs.json @@ -17,10 +17,10 @@ "content": "window cmd <div class='history' id='#_ID-history'></div><form autocomplete='off' onsubmit='exe_com(this);return false;'>λ <input id='#_ID-line' class='line' style='width:95%;' autofocus><input type='submit' style='display: none' /></form>\nmeta icon src/img/cmd.png" }, { - "name": "Mine Sweeper", + "name": "MineSweeper", "perms": { "r": true }, "dir": false, - "content": "window uwu uwu\nmeta icon src/img/mine.png, resize false, left 250, top 250, width 144, height 192, scroll false\njs let id = #_ID - 1;let cont = document.getElementById(id + '-content-content');let width = 9; let height = 10;cont.innerHTML='';let board = [];for(let i = 0; i!=height;i++){let temp = [];for(let i = 0; i!=width;i++){if(Math.random() < 0.19){temp.push(-1);} else {temp.push(0);}};board.push(temp);};for(let i = 0; i!= board.length; i++){for(let ii = 0; ii!=board[i].length; ii++){if((i!=0&&i!=height-1&&ii!=0&&ii!=width-1)&&board[i][ii]!=-1){board[i][ii] = (board[i-1][ii]==-1) + (board[i-1][ii-1]==-1) + (board[i][ii-1]==-1) + (board[i+1][ii-1]==-1) + (board[i+1][ii]==-1) + (board[i+1][ii+1]==-1) + (board[i][ii+1]==-1) + (board[i-1][ii+1]==-1);}}};console.log(board);for(let l of board){for(let ll of l){console.log(ll);if(ll==-1){cont.innerHTML+='<img src=\\'src/sprites/space-bomb.png\\'>'}else{cont.innerHTML+=`<img src='src/sprites/space-` + ll +`.png'>`}}}" + "content": "window uwu uwu\nmeta icon src/img/mine.png, resize false, left 250, top 250, width 144, height 192, scroll false\njs let id = #_ID - 1;let cont = document.getElementById(id + '-content-content');let width = 9; let height = 10;cont.innerHTML='';let board = [];for(let i = 0; i!=height;i++){let temp = [];for(let i = 0; i!=width;i++){if(Math.random() < 0.19){temp.push(-1);} else {temp.push(0);}};board.push(temp);};for(let i = 0; i!= board.length; i++){for(let ii = 0; ii!=board[i].length; ii++){if(board[i][ii]!=-1){board[i][ii] = (i!=0 ? board[i-1][ii]==-1 : 0) + (i!=0 && ii!=0 ? board[i-1][ii-1]==-1 : 0) + (ii!=0 ? board[i][ii-1]==-1 : 0) + (i!=height - 1 && ii!=0 ? board[i+1][ii-1]==-1 : 0) + (i!=height - 1 ? board[i+1][ii]==-1 : 0) + (i!=height - 1 && ii!=width - 1 ? board[i+1][ii+1]==-1 : 0) + (ii!=width - 1 ? board[i][ii+1]==-1 : 0) + (i!=0 && ii!=width - 1 ?board[i-1][ii+1]==-1 : 0);}}};for(let l of board){for(let ll of l){if(ll==-1){cont.innerHTML+='<img src=\\'src/sprites/space-bomb.png\\'>'}else{cont.innerHTML+=`<img src='src/sprites/space-` + ll +`.png'>`}}}" } ] } diff --git a/src/jssh.js b/src/jssh.js index cb7c551..970b38c 100644 --- a/src/jssh.js +++ b/src/jssh.js @@ -201,7 +201,13 @@ class jssh { let id = document.getElementsByClassName("window").length; let tt = line.split(" "); tt.splice(0, 1); - eval(tt.join(" ").replace(/#_ID/g, id)); + (async () => { + let time = new Date().getTime(); + await eval(tt.join(" ").replace(/#_ID/g, id)); + this.stdout( + "took " + Math.abs(new Date().getTime() - time) / 1000 + "s" + ); + })(); break; } } |