diff options
author | amy <[email protected]> | 2023-02-13 14:54:09 -0600 |
---|---|---|
committer | amy <[email protected]> | 2023-02-13 14:54:09 -0600 |
commit | cde2735ff419400f96c0c9fec7475676a6c3e7ea (patch) | |
tree | 09f4e0b7c09b0b59206d471ee16c97685055b8a6 /src | |
parent | 8de1455ee981de70de25257b29844235985bc206 (diff) |
more minesweeper :empty:
Diffstat (limited to 'src')
-rw-r--r-- | src/fs.json | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fs.json b/src/fs.json index 959b773..aa96c85 100644 --- a/src/fs.json +++ b/src/fs.json @@ -20,7 +20,7 @@ "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(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'>`}}}" + "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 = [];let bombs = 0;let max_bombs=10;for(let i = 0; i!=height;i++){let temp = [];for(let i = 0; i!=width;i++){if(Math.random() < 0.19 && bombs < max_bombs){temp.push(-1);bombs++;} 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 in board){for(let ll in board[l]){cont.innerHTML+='<img id=\\'#_ID-board-'+l+'-'+ll+'\\' onclick=\\'let board = '+JSON.stringify(board)+';console.log(board);if('+board[l][ll]+'==-1){for(let i in board){for(let ii in board[i]){if(board[i][ii]==-1){document.getElementById(`#_ID-board-${i}-${ii}`).src=`src/sprites/space-bomb.png`;};};};this.src=`src/sprites/bomb-ex.png`;}else{document.getElementById(this.id).src=`src/sprites/space-'+board[l][ll]+'.png`;}\\' src=\\'src/sprites/space-uncl.png\\'>'}};" } ] } |