From f5617805ada602004ea2edeb518d0a6a300ed5e4 Mon Sep 17 00:00:00 2001 From: amy Date: Fri, 10 Feb 2023 14:07:15 -0600 Subject: minesweeper board gen --- src/fs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fs.json') diff --git a/src/fs.json b/src/fs.json index be1a7b4..1709ae2 100644 --- a/src/fs.json +++ b/src/fs.json @@ -20,7 +20,7 @@ "name": "Mine Sweeper", "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);}}};for(let l of board){console.log(l)}" + "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+=''}else{cont.innerHTML+=``}}}" } ] } -- cgit v1.2.3