使用deekpseek v2开发中国象棋游戏

news2024/9/21 0:51:30

使用AI可以完成简单程序(如:五子棋),甚至都不要调试即可以运行,但逻辑规则复杂的程序就需要反复的调整,修改运行BUG,优化运行性能。(如:中国象棋,支持提示目标落子位置,并要求使用AI算法自动对弈)。

下面是经过反复调整后(N多次),得到的中国象棋游戏的js代码。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>中国象棋</title>
    <style>
        .board {
            display: grid;
            grid-template-columns: repeat(9, 50px);
            grid-template-rows: repeat(10, 50px);
            gap: 1px;
            background-color: #f0d9b5;
            width: fit-content;
            margin: auto;
        }
        .cell {
            width: 50px;
            height: 50px;
            background-color: #b58863;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            cursor: pointer;
        }
        .piece {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid;
            background-color: white;
        }
        .red {
            color: red;
            border-color: red;
        }
        .black {
            color: black;
            border-color: black;
        }
        .possible-move {
            position: relative;
            z-index: 1000;
        }
        .possible-move::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 45px;
            height: 45px;
            border: 2px dashed white;
            border-radius: 50%;
            z-index: 1000;
        }
        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0; }
        }
        .blink {
            animation: blink 1s linear infinite;
        }
    </style>
</head>
<body>
    <h1 align="center">中国象棋</h1>
    <div class="board" id="board"></div>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const board = document.getElementById('board');
            const pieces = {
                'red': ['车_red', '马_red', '相_red', '仕_red', '帅_red', '仕_red', '相_red', '马_red', '车_red', '炮_red', '炮_red', '兵_red', '兵_red', '兵_red', '兵_red', '兵_red'],
                'black': ['车_black', '马_black', '象_black', '士_black', '将_black', '士_black', '象_black', '马_black', '车_black', '炮_black', '炮_black', '卒_black', '卒_black', '卒_black', '卒_black', '卒_black']
            };

            const initialPositions = {
                'red': [
                    [0, 1, 2, 3, 4, 5, 6, 7, 8],
                    [null, null, null, null, null, null, null, null, null],
                    [null, 9, null, null, null, null, null, 10, null],
                    [11, null, 12, null, 13, null, 14, null, 15],
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null]
                ],
                'black': [
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null],
                    [null, null, null, null, null, null, null, null, null],
                    [11, null, 12, null, 13, null, 14, null, 15],
                    [null, 9, null, null, null, null, null, 10, null],
                    [null, null, null, null, null, null, null, null, null],
                    [0, 1, 2, 3, 4, 5, 6, 7, 8]
                ]
            };

            let selectedPiece = null;

            function createBoard() {
                for (let row = 0; row < 10; row++) {
                    for (let col = 0; col < 9; col++) {
                        const cell = document.createElement('div');
                        cell.classList.add('cell');
                        cell.dataset.row = row;
                        cell.dataset.col = col;
                        board.appendChild(cell);

                        const redPieceIndex = initialPositions.red[row]?.[col];
                        const blackPieceIndex = initialPositions.black[row]?.[col];

                        if (redPieceIndex !== null && redPieceIndex !== undefined) {
                            const piece = document.createElement('div');
                            piece.classList.add('piece', 'red');
                            piece.textContent = pieces.red[redPieceIndex].split('_')[0];
                            cell.appendChild(piece);
                        } else if (blackPieceIndex !== null && blackPieceIndex !== undefined) {
                            const piece = document.createElement('div');
                            piece.classList.add('piece', 'black');
                            piece.textContent = pieces.black[blackPieceIndex].split('_')[0];
                            cell.appendChild(piece);
                        }

                        cell.addEventListener('click', handleCellClick);
                    }
                }
            }

            function handleCellClick(event) {
                let cell = event.target;
                if (cell.classList.contains('piece')) {
                    cell = cell.parentElement;
                }
                if (!cell) {
                    console.error('Cell is null');
                    return;
                }
                const row = parseInt(cell.dataset.row);
                const col = parseInt(cell.dataset.col);
                
                if (selectedPiece) {
                    if (cell.classList.contains('possible-move')) {
                        const oldRow = parseInt(selectedPiece.parentElement.dataset.row);
                        const oldCol = parseInt(selectedPiece.parentElement.dataset.col);
                        const targetCell = document.querySelector(`.cell[data-row="${oldRow}"][data-col="${oldCol}"]`);
                        const targetPiece = cell.querySelector('.piece');

                        if (targetPiece) {
                            cell.removeChild(targetPiece);
                        }

                        targetCell.innerHTML = '';
                        cell.appendChild(selectedPiece);
                        selectedPiece = null;

                        renderBoard();

                        setTimeout(aiMove, 500);
                    } else {
                        selectedPiece = null;
                    }
                    
                    clearPossibleMoves();
                } else {
                    const piece = cell.querySelector('.piece');
                    if (piece) {
                        const pieceText = piece.textContent;
                        const color = piece.classList.contains('red') ? 'red' : 'black';
                        if (color) {
                            selectedPiece = piece;
                            highlightPossibleMoves(row, col, color);
                        } else {
                            console.error('Color is undefined');
                        }
                    }
                }
            }

            function renderBoard() {
                const boardState = getBoardState();
                const board = document.getElementById('board');
                board.innerHTML = '';

                for (let row = 0; row < 10; row++) {
                    for (let col = 0; col < 9; col++) {
                        const cell = document.createElement('div');
                        cell.classList.add('cell');
                        cell.dataset.row = row;
                        cell.dataset.col = col;
                        board.appendChild(cell);

                        const piece = boardState[row][col];
                        if (piece) {
                            const [pieceText, color] = piece.split('_');
                            const pieceElement = document.createElement('div');
                            pieceElement.classList.add('piece', color);
                            pieceElement.textContent = pieceText;
                            cell.appendChild(pieceElement);
                        }

                        cell.addEventListener('click', handleCellClick);
                    }
                }
            }

            function highlightPossibleMoves(row, col, color) {
                const piece = selectedPiece.textContent;
                const possibleMoves = getPossibleMoves(getBoardState(), row, col, color);

                possibleMoves.forEach(([r, c]) => {
                    const targetCell = document.querySelector(`.cell[data-row="${r}"][data-col="${c}"]`);
                    if (targetCell) {
                        targetCell.classList.add('possible-move');
                    }
                });
            }

            function clearPossibleMoves() {
                document.querySelectorAll('.possible-move').forEach(cell => {
                    cell.classList.remove('possible-move');
                });
            }

            function getPossibleMoves(boardState, row, col, color) {
                const piece = boardState[row][col];
                const [pieceText, _] = piece.split('_');
                const possibleMoves = [];

                switch (pieceText) {
                    case '车':
                        // 水平移动
                        for (let i = col + 1; i < 9; i++) {
                            if (boardState[row][i]) {
                                if (boardState[row][i].includes(color)) {
                                    break;
                                } else {
                                    possibleMoves.push([row, i]);
                                    break;
                                }
                            }
                            possibleMoves.push([row, i]);
                        }
                        for (let i = col - 1; i >= 0; i--) {
                            if (boardState[row][i]) {
                                if (boardState[row][i].includes(color)) {
                                    break;
                                } else {
                                    possibleMoves.push([row, i]);
                                    break;
                                }
                            }
                            possibleMoves.push([row, i]);
                        }
                        // 垂直移动
                        for (let i = row + 1; i < 10; i++) {
                            if (boardState[i][col]) {
                                if (boardState[i][col].includes(color)) {
                                    break;
                                } else {
                                    possibleMoves.push([i, col]);
                                    break;
                                }
                            }
                            possibleMoves.push([i, col]);
                        }
                        for (let i = row - 1; i >= 0; i--) {
                            if (boardState[i][col]) {
                                if (boardState[i][col].includes(color)) {
                                    break;
                                } else {
                                    possibleMoves.push([i, col]);
                                    break;
                                }
                            }
                            possibleMoves.push([i, col]);
                        }
                        break;
                    case '马':
                        const horseMoves = [
                            [row - 2, col - 1], [row - 2, col + 1],
                            [row - 1, col - 2], [row - 1, col + 2],
                            [row + 1, col - 2], [row + 1, col + 2],
                            [row + 2, col - 1], [row + 2, col + 1]
                        ];
                        const horseBlockers = [
                            [row - 1, col], [row - 1, col],
                            [row, col - 1], [row, col + 1],
                            [row, col - 1], [row, col + 1],
                            [row + 1, col], [row + 1, col]
                        ];
                        for (let i = 0; i < horseMoves.length; i++) {
                            const [r, c] = horseMoves[i];
                            const [br, bc] = horseBlockers[i];
                            if (r >= 0 && r < 10 && c >= 0 && c < 9) {
                                if (!boardState[br][bc] && (!boardState[r][c] || !boardState[r][c].includes(color))) {
                                    possibleMoves.push([r, c]);
                                }
                            }
                        }
                        break;
                    case '象':
                    case '相':
                        const elephantMoves = [
                            [row - 2, col - 2], [row - 2, col + 2],
                            [row + 2, col - 2], [row + 2, col + 2]
                        ];
                        const elephantBlockers = [
                            [row - 1, col - 1], [row - 1, col + 1],
                            [row + 1, col - 1], [row + 1, col + 1]
                        ];
                        for (let i = 0; i < elephantMoves.length; i++) {
                            const [r, c] = elephantMoves[i];
                            const [br, bc] = elephantBlockers[i];
                            if (r >= 0 && r < 10 && c >= 0 && c < 9) {
                                if (!boardState[br][bc] && (!boardState[r][c] || !boardState[r][c].includes(color))) {
                                    possibleMoves.push([r, c]);
                                }
                            }
                        }
                        break;
                    case '士':
                    case '仕':
                        const guardMoves = [
                            [row - 1, col - 1], [row - 1, col + 1],
                            [row + 1, col - 1], [row + 1, col + 1]
                        ];
                        guardMoves.forEach(([r, c]) => {
                            if (r >= 0 && r < 10 && c >= 3 && c <= 5) {
                                if (!boardState[r][c] || !boardState[r][c].includes(color)) {
                                    possibleMoves.push([r, c]);
                                }
                            }
                        });
                        break;
                    case '帅':
                    case '将':
                        const kingMoves = [
                            [row - 1, col], [row + 1, col],
                            [row, col - 1], [row, col + 1]
                        ];
                        kingMoves.forEach(([r, c]) => {
                            if (r >= 0 && r < 10 && c >= 3 && c <= 5) {
                                if (!boardState[r][c] || !boardState[r][c].includes(color)) {
                                    possibleMoves.push([r, c]);
                                }
                            }
                        });
                        break;
                    case '炮':
                        function checkMoves(start, end, step, fixedRow, fixedCol) {
                            let piecesBetween = 0;
                            for (let i = start; i !== end; i += step) {
                                const targetCell = fixedRow !== null ? boardState[fixedRow][i] : boardState[i][fixedCol];
                                if (targetCell) {
                                    piecesBetween++;
                                }
                                if (piecesBetween === 0) {
                                    if (!targetCell || !targetCell.includes(color)) {
                                        possibleMoves.push(fixedRow !== null ? [fixedRow, i] : [i, fixedCol]);
                                    }
                                } else if (piecesBetween === 2) {
                                    if (targetCell && !targetCell.includes(color)) {
                                        possibleMoves.push(fixedRow !== null ? [fixedRow, i] : [i, fixedCol]);
                                    }
                                }
                            }
                        }

                        // 水平移动
                        checkMoves(col + 1, 9, 1, row, null);
                        checkMoves(col - 1, -1, -1, row, null);

                        // 垂直移动
                                                checkMoves(row + 1, 10, 1, null, col);
                        checkMoves(row - 1, -1, -1, null, col);

                        break;
                    case '兵':
                    case '卒':
                        if (color === 'red') {
                            if (row < 5) {
                                possibleMoves.push([row + 1, col]);
                            } else {
                                possibleMoves.push([row - 1, col]);
                                possibleMoves.push([row, col - 1]);
                                possibleMoves.push([row, col + 1]);
                            }
                        } else {
                            if (row > 4) {
                                possibleMoves.push([row - 1, col]);
                            } else {
                                possibleMoves.push([row + 1, col]);
                                possibleMoves.push([row, col - 1]);
                                possibleMoves.push([row, col + 1]);
                            }
                        }
                        break;
                }
                return possibleMoves;
            }

            function getBoardState() {
                const boardState = [];
                for (let row = 0; row < 10; row++) {
                    const rowState = [];
                    for (let col = 0; col < 9; col++) {
                        const cell = document.querySelector(`.cell[data-row="${row}"][data-col="${col}"]`);
                        const piece = cell.querySelector('.piece');
                        if (piece) {
                            const color = piece.classList.contains('red') ? 'red' : 'black';
                            rowState.push(`${piece.textContent}_${color}`);
                        } else {
                            rowState.push(null);
                        }
                    }
                    boardState.push(rowState);
                }
                return boardState;
            }

            function aiMove() {
                const boardState = getBoardState();
                const moves = generateMoves(boardState, true);
            
                let bestMove = null;
                let bestValue = -Infinity;
            
                for (const [fromRow, fromCol, toRow, toCol] of moves) {
                    const newBoardState = makeMove(boardState, fromRow, fromCol, toRow, toCol);
                    const value = evaluateBoard(newBoardState, true);
            
                    if (value > bestValue) {
                        bestValue = value;
                        bestMove = [fromRow, fromCol, toRow, toCol];
                    }
                }
            
                if (bestMove) {
                    const [fromRow, fromCol, toRow, toCol] = bestMove;
                    const fromCell = document.querySelector(`.cell[data-row="${fromRow}"][data-col="${fromCol}"]`);
                    const toCell = document.querySelector(`.cell[data-row="${toRow}"][data-col="${toCol}"]`);
                    const piece = fromCell.querySelector('.piece');
            
                    const targetPiece = toCell.querySelector('.piece');
                    if (targetPiece) {
                        toCell.removeChild(targetPiece);
                    }
            
                    fromCell.innerHTML = '';
                    toCell.appendChild(piece);
            
                    piece.classList.add('blink');
            
                    setTimeout(() => {
                        piece.classList.remove('blink');
                    }, 2000);
            
                    // Check if the game is over after the move
                    const newBoardState = getBoardState();
                    const gameStatus = isGameOver(newBoardState);
                    if (gameStatus) {
                        if (gameStatus === 'check') {
                            alert('将军!');
                        } else {
                            alert(`游戏结束!${gameStatus === 'red' ? '红方' : '黑方'}获胜!`);
                            resetBoard();
                        }
                    }
                } else {
                    console.error('No valid move found');
                }
            }
            
            function resetBoard() {
                const board = document.getElementById('board');
                board.innerHTML = '';
                createBoard();
            }

            function generateMoves(boardState, isMaximizingPlayer) {
                const moves = [];
                const player = isMaximizingPlayer ? 'red' : 'black';

                for (let row = 0; row < 10; row++) {
                    for (let col = 0; col < 9; col++) {
                        const piece = boardState[row][col];
                        if (piece && (piece.includes(player))) {
                            const possibleMoves = getPossibleMoves(boardState, row, col, player);
                            
                            for (const [toRow, toCol] of possibleMoves) {
                                moves.push([row, col, toRow, toCol]);
                            }
                        }
                    }
                }

                return moves;
            }

            function makeMove(boardState, fromRow, fromCol, toRow, toCol) {
                const newBoardState = boardState.map(row => row.slice());
                newBoardState[toRow][toCol] = newBoardState[fromRow][fromCol];
                newBoardState[fromRow][fromCol] = null;
                return newBoardState;
            }

            function evaluateBoard(boardState, isMaximizingPlayer) {
                const pieceValues = {
                    '车': 10,
                    '马': 5,
                    '象': 3,
                    '相': 3,
                    '士': 3,
                    '仕': 3,
                    '将': 100,
                    '帅': 100,
                    '炮': 5,
                    '兵': 2,
                    '卒': 2
                };

                let score = 0;
                const player = isMaximizingPlayer ? 'red' : 'black';

                for (let row = 0; row < 10; row++) {
                    for (let col = 0; col < 9; col++) {
                        const piece = boardState[row][col];
                        if (piece){
                             const [pieceText, color] = piece.split('_');
                             if (pieceText) {
                                 const value = pieceValues[pieceText];
                                 if (color ===player) {
                                     score += value;
                                 } else {
                                     score -= value;
                                 }
                            }
                        }
                    }
                }

                return score;
            }

            function isGameOver(boardState) {
                let redKingExists = false;
                let blackKingExists = false;
            
                for (let row = 0; row < 10; row++) {
                    for (let col = 0; col < 9; col++) {
                        const piece = boardState[row][col];
                        if (piece) {
                            const [pieceText, color] = piece.split('_');
                            if (pieceText === '帅') {
                                redKingExists = true;
                            } else if (pieceText === '将') {
                                blackKingExists = true;
                            }
                        }
                    }
                }
            
                if (!redKingExists) {
                    return 'black'; // 黑方获胜
                } else if (!blackKingExists) {
                    return 'red'; // 红方获胜
                }
            
                // Check for check condition
                const redKingPosition = findKingPosition(boardState, 'red');
                const blackKingPosition = findKingPosition(boardState, 'black');
            
                if (isKingInCheck(boardState, redKingPosition, 'red')) {
                    return 'check';
                }
                if (isKingInCheck(boardState, blackKingPosition, 'black')) {
                    return 'check';
                }
            
                return null;
            }
            
            function findKingPosition(boardState, color) {
                const kingText = color === 'red' ? '帅' : '将';
                for (let row = 0; row < 10; row++) {
                    for (let col = 0; col < 9; col++) {
                        const piece = boardState[row][col];
                        if (piece && piece.includes(kingText)) {
                            return [row, col];
                        }
                    }
                }
                return null;
            }
            
            function isKingInCheck(boardState, kingPosition, color) {
                const [kingRow, kingCol] = kingPosition;
                const opponentColor = color === 'red' ? 'black' : 'red';
            
                for (let row = 0; row < 10; row++) {
                    for (let col = 0; col < 9; col++) {
                        const piece = boardState[row][col];
                        if (piece && piece.includes(opponentColor)) {
                            const [pieceText, _] = piece.split('_');
                            const possibleMoves = getPossibleMoves(boardState, row, col, opponentColor);
                            if (possibleMoves.some(([r, c]) => r === kingRow && c === kingCol)) {
                                return true;
                            }
                        }
                    }
                }
                return false;
            }

            createBoard();
        });
    </script>
</body>
</html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2099228.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

NVIDIA H200与AMD MI300X:前者高利润率是否合理?

近年来&#xff0c;人工智能芯片巨头NVIDIA与AMD的竞争愈发激烈。尽管NVIDIA在AI计算解决方案市场占据主导地位&#xff0c;但在2023年末&#xff0c;AMD推出号称全球最快的AI芯片Instinct MI300X后&#xff0c;开始对NVIDIA构成了挑战。然而&#xff0c;经过一段时间的市场检验…

Sevenstar CS200A使用简明教程(485通信类型变送器)

该文章仅供参考&#xff0c;编写人不对任何实验设备、人员及测量结果负责&#xff01;&#xff01;&#xff01; 文章主要介绍流量计的硬件连接、软件配置、数据读写以及流量计气体计算。 1 硬件连接 2 软件配置 将流量计硬件部分正确连接后&#xff1a; 打开“CS200单台控…

scrapy 爬取微博(一)【最新超详细解析】:创建微博爬取工程

本项目属于个人学习记录&#xff0c;爬取的数据会于12小时内销毁&#xff0c;且不可用于商用。 1 初始化环境 首先我们需要有python环境&#xff0c;先安装一下python&#xff0c;然后配置环境变量&#xff0c;这边给出windows的配置&#xff1a; 我这边的安装目录是D:\pyt…

逆向工程核心原理 Chapter 21 | Windows消息钩取

开始DLL注入章节的学习。 知识点学习 消息钩子 这里主要是要弄明白Windows GUI程序的工作模式/流程。 GUI以事件驱动方式工作。核心概念&#xff1a;message queue 最具代表性的&#xff1a;MS提供的spy SetWindowsHookEX() SetWindowsHookExA 函数 (winuser.h) - Win32 a…

基于图片识别的摄影作品展示平台

一、项目概述 Hi&#xff0c;大家好&#xff0c;今天分享的项目是《基于图片识别的摄影作品展示平台》。 摄影作品展示平台为用户提供了一个实践和应用所学摄影知识的机会&#xff0c;通过这个平台&#xff0c;用户可以上传摄影作品&#xff0c;平台能根据用户上传的图片自动…

【初出江湖】分布式之什么是分布式存储?

目录标题 分布式存储分布式存储系统特点分布式存储原理分布式存储的应用场景分布式存储和集中式存储的区别 分布式存储 分布式存储是一种将数据分散存储在多个节点上的存储方式。与传统的集中式存储相比&#xff0c;分布式存储将数据分布在多个节点上&#xff0c;每个节点都可…

我司总经理张戈参加第十届中国车联网大会暨智慧交通博览会

我司总经理张戈参加第十届中国车联网大会暨智慧交通博览会 第十届中国&#xff08;大湾区&#xff09;车联网大会暨智慧交通博览会于8月23日隆重举行&#xff0c;此次大会聚焦于前沿技术、行业热点、产业生态以及企业创新等多个方面。会议深入探讨了“车路云一体化”、5G技术、…

使用docker容器部署考试系统

8.30 回顾 1、使用harbor仓库 python --version yum -y update yum -y install python2-pip 部署考试系统 使用docker部署project-exam-system 1、在一台主机内&#xff0c;实现容器的编排看&#xff0c;发布考试系统 2、环境准备 docker docker-compose docker脚本 …

华为云征文|遥遥领先的华为云Flexus云服务器X它来了~~~~

文章目录 ❀前言❀概述❀优点❀黑科技❀购买❀注册账号❀选配 ❀服务器连接 ❀前言 随着云计算时代的进一步深入&#xff0c;越来越多的中小企业企业与开发者需要一款简单易用、高能高效的云计算基础设施产品来支撑自身业务。云服务器相较于于实体服务器&#xff0c;操作更简单…

多目标应用:基于双存档模型的多模态多目标进化算法(MMOHEA)的移动机器人路径规划研究(提供MATLAB代码)

一、机器人路径规划介绍 移动机器人&#xff08;Mobile robot&#xff0c;MR&#xff09;的路径规划是 移动机器人研究的重要分支之&#xff0c;是对其进行控制的基础。根据环境信息的已知程度不同&#xff0c;路径规划分为基于环境信息已知的全局路径规划和基于环境信息未知或…

DPDK简介及相关资料整理

DPDK全称为Date planedevelopment kit&#xff0c;是一个用来进行包数据处理加速的软件库。与传统的数据包处理相比&#xff0c;DPDK具有以下特点&#xff1a; 1) 轮询&#xff1a;在包处理时避免中断上下文切换的开销&#xff0c; 2) 用户态驱动&#xff1a;规避不必要的内存…

如何定义核心场景用例?

​首先我们解决两个问题&#xff1a; 1.什么是场景测试&#xff1f; 2.什么是核心场景&#xff1f; 1、什么是场景测试&#xff1f; &#x1f3af; 1.1&#xff1a;什么是场景 事件触发时的情景形成了场景。场景必不可少的几个要素&#xff1a;环境、人、时间、行为。简而…

3.7 移位指令

&#x1f393; 微机原理考点专栏&#xff08;通篇免费&#xff09; 欢迎来到我的微机原理专栏&#xff01;我将帮助你在最短时间内掌握微机原理的核心内容&#xff0c;为你的考研或期末考试保驾护航。 为什么选择我的视频&#xff1f; 全程考点讲解&#xff1a;每一节视频都…

JAVA进阶学习14

文章目录 常用工具包commons-ioHutool工具包一、多线程1.1 多线程的实现方法1.2 多线程常见的成员方法1.3 线程的安全问题1.4 同步方法1.5 lock锁1.6 线程的死锁1.7 生产者消费者问题&#xff08;等待唤醒机制&#xff09;1.8 阻塞队列——同样解决生产和消费的问题1.9 线程的状…

【5G PHY】5G循环前缀(CP)设计思路简述

博主未授权任何人或组织机构转载博主任何原创文章&#xff0c;感谢各位对原创的支持&#xff01; 博主链接 本人就职于国际知名终端厂商&#xff0c;负责modem芯片研发。 在5G早期负责终端数据业务层、核心网相关的开发工作&#xff0c;目前牵头6G技术研究。 博客内容主要围绕…

苹果手机升级iOS 18时一直显示“正在检测更新”怎么办?

随着科技的不断发展&#xff0c;苹果手机的iOS系统也在不断迭代更新&#xff0c;为用户带来更加优质的使用体验。然而&#xff0c;在升级iOS 18的过程中&#xff0c;一些用户可能会遇到手机一直显示“正在检测更新”的问题&#xff0c;导致无法顺利完成系统升级。 这种情况不仅…

线性代数 第五讲:线性方程组_齐次线性方程组_非齐次线性方程组_公共解同解方程组_详解

线性方程组 文章目录 线性方程组1.齐次线性方程组的求解1.1 核心要义1.2 基础解系与线性无关的解向量的个数1.3 计算使用举例 2. 非齐次线性方程的求解2.1 非齐次线性方程解的判定2.2 非齐次线性方程解的结构2.3 计算使用举例 3.公共解与同解3.1 两个方程组的公共解3.2 同解方程…

标准库标头 <charconv>(c++17)学习

此头文件是strings library. std::to_chars_result 是 std::to_chars 的返回类型。它没有基类&#xff0c;并且只有以下成员。 数据成员 成员名字定义 ptr char* 类型的指针 (公开成员对象) ec std::errc 类型的错误码 (公开成员对象) std::from_chars_result 是 std::from…

CSS瀑布流实现

文章目录 前言前置知识 React 中实现代码实现 Vue 中实现代码实现 前言 瀑布流是一种CSS布局技术&#xff0c;它允许不同高度的元素在页面上以美观的方式排列&#xff0c;同时保持行与列间的间距一致。 前置知识 使用 multi-column 实现多列布局 column-count: 设置布局显示…

深度学习实战4--GAN进阶与优化

GAN 的问题主要有两点&#xff1a;Loss 等于0的梯度消失问题和梯度不稳定以及多样性受损。 前者是因为选择的分布函数使用JS 距离&#xff0c;这个距离不能衡量两个不相交的分布的距离&#xff1b;后者是因为Loss 函数要求KL 距离最小&#xff0c;JS 距离最大&#xff0c;所以…