Node.js下载地址 : https://nodejs.org/zh-cn/download/
git下载地址
:
https://git-scm.com/downloa
环境完成,Windows端和Mac端需重启电脑,再次进入 Claude Code安装流程
<!DOCTYPE html >< html >< head >< title >扫雷游戏 </ title >< style >body {font-family: Arial, sans-serif;text-align: center;margin-top: 50px;}#game {margin: 20px auto;display: inline-block;}.cell {width: 30px;height: 30px;border: 1px solid #999;display: inline-block;text-align: center;line-height: 30px;font-weight: bold;cursor: pointer;background-color: #ddd;vertical-align: top;}.revealed {background-color: #fff;}.mine {background-color: red;}.flag {background-color: #ff0;}#controls {margin: 20px;}</ style ></ head >< body >< h1 >扫雷游戏 </ h1 >< div id = "controls" >< button onclick = "initGame(10, 10, 15)" >初级 (10x10, 15雷) </ button >< button onclick = "initGame(16, 16, 40)" > (16x16, 40雷) </ button >< button onclick = "initGame(16, 30, 99)" >高级 (16x30, 99雷) </ button ></ div >< div id = "game" ></ div >< script >let board = [];let rows, cols, mines;let gameOver = false;function initGame( r, c, m) {rows = r;cols = c;mines = m;gameOver = false;document. getElementById( 'game'). innerHTML = '';createBoard();placeMines();}function createBoard() {board = [];for ( let i = 0; i < rows; i++) {board[i] = [];for ( let j = 0; j < cols; j++) {board[i][j] = {isMine: false,revealed: false,flagged: false,value: 0};const cell = document. createElement( 'div');cell. className = 'cell';cell. dataset. row = i;cell. dataset. col = j;cell. addEventListener( 'click', () => handleClick(i, j));cell. addEventListener( 'contextmenu', ( e ) => {e. preventDefault();handleRightClick(i, j);});document. getElementById( 'game'). appendChild(cell);}document. getElementById( 'game'). appendChild( document. createElement( 'br'));}}function placeMines() {let minesPlaced = 0;while (minesPlaced < mines) {const row = Math. floor( Math. random() * rows);const col = Math. floor( Math. random() * cols);if (!board[row][col]. isMine) {board[row][col]. isMine = true;minesPlaced++;// 更新周围格子的数字for ( let i = Math. max( 0, row- 1); i <= Math. min(rows- 1, row+ 1); i++) {for ( let j = Math. max( 0, col- 1); j <= Math. min(cols- 1, col+ 1); j++) {if (!board[i][j]. isMine) {board[i][j]. value++;}}}}}}function handleClick( row, col) {if (gameOver || board[row][col]. revealed || board[row][col]. flagged) return;board[row][col]. revealed = true;updateCell(row, col);if (board[row][col]. isMine) {gameOver = true;revealAllMines();alert( '游戏结束!你踩到了!');return;}if (board[row][col]. value === 0) {// 如果是空白格子,自动展开周围的格子for ( let i = Math. max( 0, row- 1); i <= Math. min(rows- 1, row+ 1); i++) {for ( let j = Math. max( 0, col- 1); j <= Math. min(cols- 1, col+ 1); j++) {if (!board[i][j]. revealed && !board[i][j]. flagged) {handleClick(i, j);}}}}checkWin();}function handleRightClick( row, col) {if (gameOver || board[row][col]. revealed) return;board[row][col]. flagged = !board[row][col]. flagged;updateCell(row, col);}function updateCell( row, col) {const cells = document. querySelectorAll( '.cell');const cell = [...cells]. find( c =>c. dataset. row == row && c. dataset. col == col);if (board[row][col]. flagged) {cell. className = 'cell flag';cell. textContent = '🚩';} else if (board[row][col]. revealed) {cell. className = 'cell revealed';if (board[row][col]. isMine) {cell. className = 'cell mine';cell. textContent = '💣';} else if (board[row][col]. value > 0) {cell. textContent = board[row][col]. value;// 不同数字可以设置不同颜色cell. style. color = [ 'blue', 'green', 'red', 'darkblue', 'brown', 'teal', 'black','gray'][board[row][col]. value- 1];} else {cell. textContent = '';}} else {cell. className = 'cell';cell. textContent = '';}}function revealAllMines() {for ( let i = 0; i < rows; i++) {for ( let j = 0; j < cols; j++) {if (board[i][j]. isMine) {board[i][j]. revealed = true;updateCell(i, j);}}}}function checkWin() {let unrevealedSafeCells = 0;for ( let i = 0; i < rows; i++) {for ( let j = 0; j < cols; j++) {if (!board[i][j]. isMine && !board[i][j]. revealed) {unrevealedSafeCells++;}}}if (unrevealedSafeCells === 0) {gameOver = true;alert( '恭喜你赢了!');}}// 默认初始化初级难度window. onload = function() {initGame( 10, 10, 15);};</ script ></ body ></ html >

ModelGate官网:
https://www.modelgate.net
ModelGate 让 Claude Code 的安装接入更简单,真正一键上手,解决国内开发者的痛点,让AI高效编程没有门槛。抓住AI浪潮,从现在起就用ModelGate开启高效智能工作流。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70047035/viewspace-3092429/ ,如需转载,请注明出处,否则将追究法律责任。