桂林人论坛

12
返回列表 发新帖
楼主: 雪月夜归人

[本地杂谈] 只说好话,莫问前程 —— 笑谈AI

[复制链接]

197

主题

1646

回帖

1万

积分

 楼主| 发表于 2025-2-27 18:43:37 | 显示全部楼层
有人给AI归纳了十条罪状:

       一、冲击社会就业、
  大量的不复杂、重复性高的工作岗位,如出租车司机、快递员、客服人员、办公室文员、教师等,可能在人工智能的冲击下,造成大批劳动人口的失业。
  二、深度伪造会带来难以预料的严重后果
  人工智能的画面、声音、视频的仿真技术,造成真假难辨,鱼目混珠,诈骗伪冒,栽赃陷害等犯罪活动。
  三、各种窃密活动更加隐蔽和难以防范
  不仅党政机关、军队、企事业单位的机密面临挑战,而且个人信息的保护也愈加困难。
  四、被别有用心的人用于洗脑
  人工智能的一个重要用途是咨询和教育,它的价值观念和思想观点来源于其开发者。敌人和坏人会通过监控人的思想活动来发现拉拢、策反对象,为其窃密破坏和犯罪活动服务。
  五、使黑箱操作更难被发现
  所谓“黑箱操作”,就是办理业务或处理事情时,不是公开进行,而是背地里或私下进行,甚至是偷偷进行。由于人工智能深度学习模型的决策过程不透明,会使黑箱操作更难被发现。
  六、人为设定程序,破坏社会规则
  人工智能看似公正,实际上它的裁判标准都是人设定的,当用于执法、司法裁决和各种竞争竞赛裁判时,会被心术不正的人用来进行偏袒一方的裁判。
  七、引发知识产权纠纷
  用人工智能写文作画搞视频,版权归属至今没有相应的法律规定,如果有人会利用人工智能进行抄袭、仿冒等侵犯知识产权的活动,版权所有人维护权益困难。
  八、助长学习惰性
  学习知识必须经过思考消化的过程,如果学生用人工智能来做作业、写论文,就没有这个过程,不仅对于牢固掌握所学的知识不利,而且会助长学习惰性。
  九、办事机械呆板,会使公务人员懒政
  人工智能一律按程序,会让机关公务人员使用机器办事,难以体现出人民公仆热情为群众服务的态度,损害党群政民关系。
  十、如果发生恐怖活动可能造成严重后果
  如果恐怖分子将人工智能用于恐怖活动,将大大提高其侦察窃密、策划方案、隐蔽行动、精准攻击等能力,从而造成更加严重的后果。


7

主题

272

回帖

4618

积分

发表于 2025-2-27 22:30:45 | 显示全部楼层
只能讲见人讲人话,见鬼讲鬼话

是时候改抛弃对AI的成见了,AI的某项能力超过人类后,人类就再也赶不上了,目前短短不到一个月的轻度使用是非常震撼的,最震撼的是用AI实现一个小时候下的叫六子棋的棋类游戏,仅仅修改几次提示词AI就把人机对战的网页程序。而且我再也下不过电脑给的算法了。。只花了十来分钟。
这是AI生成的代码,有兴趣可以把代码用记事本保存,把.txt改成.html用浏览其打开试试。

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>六子棋</title>
  5.     <style>
  6.         body {
  7.             font-family: sans-serif;
  8.             display: flex;
  9.             flex-direction: column;
  10.             align-items: center;
  11.         }

  12.         #board {
  13.             display: grid;
  14.             grid-template-columns: repeat(4, 80px);
  15.             grid-template-rows: repeat(4, 80px);
  16.             border: 2px solid black;
  17.             margin-bottom: 20px;
  18.         }

  19.         .cell {
  20.             width: 80px;
  21.             height: 80px;
  22.             border: 1px solid lightgray;
  23.             position: relative;
  24.         }

  25.         .piece {
  26.             width: 70px;
  27.             height: 70px;
  28.             border-radius: 50%;
  29.             position: absolute;
  30.             top: 50%;
  31.             left: 50%;
  32.             transform: translate(-50%, -50%);
  33.             cursor: pointer;
  34.             transition: transform 0.3s ease, opacity 0.3s ease;
  35.         }

  36.         .red {
  37.             background-color: red;
  38.         }

  39.         .black {
  40.             background-color: black;
  41.         }

  42.         .selected {
  43.             transform: translate(-50%, -50%) scale(1.2);
  44.             box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  45.         }

  46.         .fading {
  47.             opacity: 0;
  48.         }

  49.         button {
  50.             margin: 5px;
  51.             padding: 8px 15px;
  52.             border: none;
  53.             background-color: #4CAF50;
  54.             color: white;
  55.             text-align: center;
  56.             text-decoration: none;
  57.             display: inline-block;
  58.             font-size: 14px;
  59.             cursor: pointer;
  60.             border-radius: 5px;
  61.         }

  62.         #message {
  63.             margin-top: 10px;
  64.             font-weight: bold;
  65.         }
  66.     </style>
  67. </head>
  68. <body>
  69.     <h1>六子棋</h1>
  70.     <div id="board"></div>
  71.     <button id="aiFirstButton">AI 先手</button>
  72.     <button id="restartButton">重新开始</button>
  73.     <div id="message"></div>

  74.     <script>
  75.         const boardSize = 4;
  76.         let board = Array(boardSize).fill(null).map(() => Array(boardSize).fill(null));
  77.         let currentPlayer = "black";
  78.         let selectedPiece = null;
  79.         let gameOver = false;
  80.         let aiIsFirst = false;
  81.         const aiDepth = 10; // Set the AI search depth

  82.         const redPiecesInitial = [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 3]];
  83.         const blackPiecesInitial = [[2, 0], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]];

  84.         function initializeBoard(aiFirst = false) {
  85.             board = Array(boardSize).fill(null).map(() => Array(boardSize).fill(null));
  86.             gameOver = false;
  87.             currentPlayer = "black";
  88.             selectedPiece = null;
  89.             aiIsFirst = aiFirst;

  90.             redPiecesInitial.forEach(coord => board[coord[0]][coord[1]] = "red");
  91.             blackPiecesInitial.forEach(coord => board[coord[0]][coord[1]] = "black");

  92.             if (aiFirst) {
  93.                 currentPlayer = 'red';
  94.                 aiMove();
  95.             }


  96.             renderBoard();
  97.             updateMessage();
  98.         }

  99.         function renderBoard() {
  100.             const boardElement = document.getElementById("board");
  101.             boardElement.innerHTML = "";

  102.             for (let row = 0; row < boardSize; row++) {
  103.                 for (let col = 0; col < boardSize; col++) {
  104.                     const cell = document.createElement("div");
  105.                     cell.classList.add("cell");
  106.                     cell.dataset.row = row;
  107.                     cell.dataset.col = col;
  108.                     cell.addEventListener("click", handleCellClick);

  109.                     if (board[row][col]) {
  110.                         const piece = document.createElement("div");
  111.                         piece.classList.add("piece", board[row][col]);
  112.                         piece.dataset.row = row;
  113.                         piece.dataset.col = col;
  114.                         piece.addEventListener("click", handlePieceClick); // Add click listener to piece
  115.                         cell.appendChild(piece);
  116.                     }

  117.                     boardElement.appendChild(cell);
  118.                 }
  119.             }
  120.         }

  121.         function handlePieceClick(event) {
  122.             event.stopPropagation(); // Prevent cell click from firing
  123.             const piece = event.target;
  124.             const row = parseInt(piece.dataset.row);
  125.             const col = parseInt(piece.dataset.col);

  126.             if (gameOver) return;
  127.             if (board[row][col] !== currentPlayer) return;

  128.             // Deselect if clicking the already selected piece
  129.             if (selectedPiece && selectedPiece.row === row && selectedPiece.col === col) {
  130.                 deselectPiece();
  131.                 return;
  132.             }


  133.             selectPiece(row, col);
  134.         }

  135.         function handleCellClick(event) {
  136.             if (gameOver) return;

  137.             const row = parseInt(event.target.dataset.row);
  138.             const col = parseInt(event.target.dataset.col);

  139.             if (selectedPiece) {
  140.                 movePiece(selectedPiece.row, selectedPiece.col, row, col);
  141.             }
  142.         }


  143.         function selectPiece(row, col) {
  144.             deselectPiece(); // Deselect any previously selected piece
  145.             selectedPiece = { row: row, col: col };
  146.             const pieceElement = document.querySelector(`.piece[data-row="${row}"][data-col="${col}"]`);
  147.             if (pieceElement) {
  148.                 pieceElement.classList.add("selected");
  149.             }
  150.         }

  151.         function deselectPiece() {
  152.             if (selectedPiece) {
  153.                 const pieceElement = document.querySelector(`.piece[data-row="${selectedPiece.row}"][data-col="${selectedPiece.col}"]`);
  154.                 if (pieceElement) {
  155.                     pieceElement.classList.remove("selected");
  156.                 }
  157.                 selectedPiece = null;
  158.             }
  159.         }


  160.         function isValidMove(startRow, startCol, endRow, endCol) {
  161.             if (endRow < 0 || endRow >= boardSize || endCol < 0 || endCol >= boardSize) return false;
  162.             if (board[endRow][endCol] !== null) return false;

  163.             const rowDiff = Math.abs(endRow - startRow);
  164.             const colDiff = Math.abs(endCol - startCol);
  165.             return (rowDiff === 1 && colDiff === 0) || (rowDiff === 0 && colDiff === 1);
  166.         }

  167.         function movePiece(startRow, startCol, endRow, endCol) {
  168.             if (!isValidMove(startRow, startCol, endRow, endCol)) {
  169.                 deselectPiece();
  170.                 return;
  171.             }

  172.             board[endRow][endCol] = board[startRow][startCol];
  173.             board[startRow][startCol] = null;

  174.             const pieceElement = document.querySelector(`.piece[data-row="${startRow}"][data-col="${startCol}"]`);

  175.             if (pieceElement) {
  176.                 pieceElement.dataset.row = endRow;
  177.                 pieceElement.dataset.col = endCol;
  178.             }
  179.             renderBoard(); //Re-render to move the element.
  180.             deselectPiece();


  181.             handleCaptures(endRow, endCol);
  182.             if (gameOver) return;

  183.             currentPlayer = currentPlayer === "black" ? "red" : "black";
  184.             updateMessage();

  185.             if (currentPlayer === "red") {
  186.                 setTimeout(aiMove, 500);  // Delay the AI move slightly
  187.             }
  188.         }


  189.         function handleCaptures(row, col) {
  190.             const opponent = currentPlayer === "black" ? "red" : "black";
  191.             let captures = [];

  192.             // Check horizontal captures
  193.             const horizontal = [board[row][0], board[row][1], board[row][2], board[row][3]];

  194.             // Check [ 空格, 我方, 我方, 敌方 ]
  195.             if (horizontal[0] === null && horizontal[1] === currentPlayer && horizontal[2] === currentPlayer && horizontal[3] === opponent) {
  196.                 captures.push([row, 3]);
  197.             }

  198.             // Check [ 敌方, 我方, 我方, 空格 ]
  199.             if (horizontal[0] === opponent && horizontal[1] === currentPlayer && horizontal[2] === currentPlayer && horizontal[3] === null) {
  200.                 captures.push([row, 0]);
  201.             }

  202.             // Check [ 我方, 我方, 敌方, 空格 ]
  203.             if (horizontal[0] === currentPlayer && horizontal[1] === currentPlayer && horizontal[2] === opponent && horizontal[3] === null) {
  204.                 captures.push([row, 2]);
  205.             }

  206.             // Check [ 空格, 敌方, 我方, 我方 ]
  207.             if (horizontal[0] === null && horizontal[1] === opponent && horizontal[2] === currentPlayer && horizontal[3] === currentPlayer) {
  208.                 captures.push([row, 1]);
  209.             }

  210.             // Check vertical captures
  211.             const vertical = [board[0][col], board[1][col], board[2][col], board[3][col]];

  212.             // Check [ 空格, 我方, 我方, 敌方 ]
  213.             if (vertical[0] === null && vertical[1] === currentPlayer && vertical[2] === currentPlayer && vertical[3] === opponent) {
  214.                 captures.push([3, col]);
  215.             }

  216.             // Check [ 敌方, 我方, 我方, 空格 ]
  217.             if (vertical[0] === opponent && vertical[1] === currentPlayer && vertical[2] === currentPlayer && vertical[3] === null) {
  218.                 captures.push([0, col]);
  219.             }

  220.             // Check [ 我方, 我方, 敌方, 空格 ]
  221.             if (vertical[0] === currentPlayer && vertical[1] === currentPlayer && vertical[2] === opponent && vertical[3] === null) {
  222.                 captures.push([2, col]);
  223.             }

  224.             // Check [ 空格, 敌方, 我方, 我方 ]
  225.             if (vertical[0] === null && vertical[1] === opponent && vertical[2] === currentPlayer && vertical[3] === currentPlayer) {
  226.                 captures.push([1, col]);
  227.             }



  228.             captures.forEach(capture => {
  229.                 const [captureRow, captureCol] = capture;
  230.                 removePiece(captureRow, captureCol);
  231.             });

  232.             if (checkWinCondition()) {
  233.                 gameOver = true;
  234.                 updateMessage();
  235.             }
  236.         }

  237.         function removePiece(row, col) {
  238.             const pieceElement = document.querySelector(`.piece[data-row="${row}"][data-col="${col}"]`);

  239.             if (pieceElement) {
  240.                 pieceElement.classList.add("fading");
  241.                 setTimeout(() => {
  242.                     board[row][col] = null;
  243.                     renderBoard();
  244.                 }, 300); // Match the transition duration
  245.             } else {
  246.                 board[row][col] = null;
  247.                 renderBoard();
  248.             }
  249.         }


  250.         function checkWinCondition() {
  251.             const redPieces = board.flat().filter(piece => piece === "red").length;
  252.             const blackPieces = board.flat().filter(piece => piece === "black").length;

  253.             if (redPieces === 0) {
  254.                 return "black";
  255.             }
  256.             if (blackPieces === 0) {
  257.                 return "red";
  258.             }

  259.             return null;
  260.         }

  261.         function updateMessage() {
  262.             const messageElement = document.getElementById("message");
  263.             if (gameOver) {
  264.                 messageElement.textContent = `游戏结束! ${checkWinCondition() === "black" ? "黑方" : "红方"} 获胜!`;
  265.             } else {
  266.                 messageElement.textContent = `轮到 ${currentPlayer === "black" ? "黑方" : "红方"} 走棋`;
  267.             }
  268.         }


  269.         // AI Logic
  270.         function aiMove() {
  271.             const bestMove = minimax(board, aiDepth, -Infinity, Infinity, true);  // Depth of 10

  272.             if (bestMove.move) {
  273.                 const [startRow, startCol, endRow, endCol] = bestMove.move;
  274.                 movePiece(startRow, startCol, endRow, endCol);
  275.             } else {
  276.                 console.log("No move found");
  277.             }
  278.         }


  279.         function minimax(boardState, depth, alpha, beta, maximizingPlayer) {
  280.             const winner = checkWinConditionForState(boardState);
  281.             if (depth === 0 || winner) {
  282.                 return { score: evaluateBoard(boardState, winner), move: null };
  283.             }

  284.             if (maximizingPlayer) {
  285.                 let bestScore = -Infinity;
  286.                 let bestMove = null;

  287.                 const possibleMoves = getPossibleMoves(boardState, "red");
  288.                 for (const move of possibleMoves) {
  289.                     const [startRow, startCol, endRow, endCol] = move;
  290.                     const newBoardState = getNewBoardState(boardState, startRow, startCol, endRow, endCol, "red");
  291.                     const score = minimax(newBoardState, depth - 1, alpha, beta, false).score;

  292.                     if (score > bestScore) {
  293.                         bestScore = score;
  294.                         bestMove = move;
  295.                     }
  296.                     alpha = Math.max(alpha, bestScore);
  297.                     if (beta <= alpha) {
  298.                         break; // Beta cutoff
  299.                     }
  300.                 }
  301.                 return { score: bestScore, move: bestMove };
  302.             } else {
  303.                 let bestScore = Infinity;
  304.                 let bestMove = null;
  305.                 const possibleMoves = getPossibleMoves(boardState, "black");

  306.                 for (const move of possibleMoves) {
  307.                     const [startRow, startCol, endRow, endCol] = move;
  308.                     const newBoardState = getNewBoardState(boardState, startRow, startCol, endRow, endCol, "black");
  309.                     const score = minimax(newBoardState, depth - 1, alpha, beta, true).score;

  310.                     if (score < bestScore) {
  311.                         bestScore = score;
  312.                         bestMove = move;
  313.                     }
  314.                     beta = Math.min(beta, bestScore);
  315.                     if (beta <= alpha) {
  316.                         break; // Alpha cutoff
  317.                     }
  318.                 }
  319.                 return { score: bestScore, move: bestMove };
  320.             }
  321.         }

  322.         function getPossibleMoves(boardState, player) {
  323.             const moves = [];
  324.             for (let row = 0; row < boardSize; row++) {
  325.                 for (let col = 0; col < boardSize; col++) {
  326.                     if (boardState[row][col] === player) {
  327.                         const possibleDestinations = [[row - 1, col], [row + 1, col], [row, col - 1], [row, col + 1]];
  328.                         for (const [endRow, endCol] of possibleDestinations) {
  329.                             if (endRow >= 0 && endRow < boardSize && endCol >= 0 && endCol < boardSize && boardState[endRow][endCol] === null) {
  330.                                 moves.push([row, col, endRow, endCol]);
  331.                             }
  332.                         }
  333.                     }
  334.                 }
  335.             }
  336.             return moves;
  337.         }

  338.        function getNewBoardState(boardState, startRow, startCol, endRow, endCol, player) {
  339.             const newBoardState = boardState.map(row => [...row]); // Deep copy
  340.             newBoardState[endRow][endCol] = newBoardState[startRow][startCol];
  341.             newBoardState[startRow][startCol] = null;

  342.             const opponent = player === "black" ? "red" : "black";
  343.             let captures = [];

  344.             // Check horizontal captures
  345.             const horizontal = [newBoardState[endRow][0], newBoardState[endRow][1], newBoardState[endRow][2], newBoardState[endRow][3]];

  346.             // Check [ 空格, 我方, 我方, 敌方 ]
  347.             if (horizontal[0] === null && horizontal[1] === player && horizontal[2] === player && horizontal[3] === opponent) {
  348.                 captures.push([endRow, 3]);
  349.             }

  350.             // Check [ 敌方, 我方, 我方, 空格 ]
  351.             if (horizontal[0] === opponent && horizontal[1] === player && horizontal[2] === player && horizontal[3] === null) {
  352.                 captures.push([endRow, 0]);
  353.             }

  354.             // Check [ 我方, 我方, 敌方, 空格 ]
  355.             if (horizontal[0] === player && horizontal[1] === player && horizontal[2] === opponent && horizontal[3] === null) {
  356.                 captures.push([endRow, 2]);
  357.             }

  358.             // Check [ 空格, 敌方, 我方, 我方 ]
  359.             if (horizontal[0] === null && horizontal[1] === opponent && horizontal[2] === player && horizontal[3] === player) {
  360.                 captures.push([endRow, 1]);
  361.             }

  362.             // Check vertical captures
  363.             const vertical = [newBoardState[0][endCol], newBoardState[1][endCol], newBoardState[2][endCol], newBoardState[3][endCol]];

  364.             // Check [ 空格, 我方, 我方, 敌方 ]
  365.             if (vertical[0] === null && vertical[1] === player && vertical[2] === player && vertical[3] === opponent) {
  366.                 captures.push([3, endCol]);
  367.             }

  368.             // Check [ 敌方, 我方, 我方, 空格 ]
  369.             if (vertical[0] === opponent && vertical[1] === player && vertical[2] === player && vertical[3] === null) {
  370.                 captures.push([0, endCol]);
  371.             }

  372.             // Check [ 我方, 我方, 敌方, 空格 ]
  373.             if (vertical[0] === player && vertical[1] === player && vertical[2] === opponent && vertical[3] === null) {
  374.                 captures.push([2, endCol]);
  375.             }

  376.             // Check [ 空格, 敌方, 我方, 我方 ]
  377.             if (vertical[0] === null && vertical[1] === opponent && vertical[2] === player && vertical[3] === player) {
  378.                 captures.push([1, endCol]);
  379.             }



  380.             captures.forEach(capture => {
  381.                 const [captureRow, captureCol] = capture;
  382.                 newBoardState[captureRow][captureCol] = null;
  383.             });

  384.             return newBoardState;
  385.         }

  386.         function checkWinConditionForState(boardState) {
  387.             const redPieces = boardState.flat().filter(piece => piece === "red").length;
  388.             const blackPieces = boardState.flat().filter(piece => piece === "black").length;

  389.             if (redPieces === 0) {
  390.                 return "black";
  391.             }
  392.             if (blackPieces === 0) {
  393.                 return "red";
  394.             }

  395.             return null;
  396.         }

  397.         function evaluateBoard(boardState, winner) {
  398.             if (winner === "red") {
  399.                 return 100;
  400.             } else if (winner === "black") {
  401.                 return -100;
  402.             } else {
  403.                 // Heuristic evaluation - consider piece count (red wants more, black wants less)
  404.                 const redPieces = boardState.flat().filter(piece => piece === "red").length;
  405.                 const blackPieces = boardState.flat().filter(piece => piece === "black").length;
  406.                 return redPieces - blackPieces;  // Simple piece difference
  407.             }
  408.         }



  409.         // Button Event Listeners
  410.         document.getElementById("aiFirstButton").addEventListener("click", () => {
  411.             initializeBoard(true);
  412.         });

  413.         document.getElementById("restartButton").addEventListener("click", () => {
  414.             initializeBoard(false);
  415.         });


  416.         initializeBoard();
  417.     </script>
  418. </body>
  419. </html>
复制代码


lzq.png

197

主题

1646

回帖

1万

积分

 楼主| 发表于 2025-2-28 00:49:57 | 显示全部楼层
sharwinmail 发表于 2025-2-27 22:30
只能讲见人讲人话,见鬼讲鬼话

是时候改抛弃对AI的成见了,AI的某项能力超过人类后,人类就再也赶不上了 ...

这个代码的转换有点麻烦。呵
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关于我们|广告合作|小黑屋|网站客服|法律声明|论坛APP| 桂林生活网

桂林生活网(Guilinlife.com)版权所有

Powered by Discuz! ( 桂B2-20040001 )

快速回复 返回顶部 返回列表 桂林人论坛客户端