Web端——超级马里奥【简化版】

1.介绍

这是一个简单的受超级马里奥启发的平台游戏演示!这个基于网络的游戏包括:

  • 角色移动:使用箭头键让马里奥向左和向右移动,空格键或向上箭头键跳跃。
  • 跳跃平台:游戏中有多个可以跳跃的平台,包括经典的问题方块,从下方击中会释放金币。
  • 敌人:有类似栗子怪的敌人来回移动。你可以通过踩在它们头上来打败它们。
  • 可收集物品:在整个关卡中收集金币以增加你的得分。
  • 目标:到达关卡末尾的旗帜以获胜。

游戏包括:

  • 得分和金币追踪
  • 游戏结束和获胜屏幕,并重新开始选项
  • 跟随马里奥的横向滚动摄像机
  • 基本的物理效果,包括重力和碰撞检测
  • 简单的敌人人工智能,在碰到障碍物或边缘时改变方向。

游戏包括:

  • 角色移动:使用箭头键让马里奥向左和向右移动,空格键或向上箭头键跳跃。
  • 跳跃平台:游戏中有多个可以跳跃的平台,包括经典的问题方块,从下方击中会释放金币。
  • 敌人:有类似栗子怪的敌人来回移动。你可以通过踩在它们头上来打败它们。
  • 可收集物品:在整个关卡中收集金币以增加你的得分。
  • 目标:到达关卡末尾的旗帜以获胜。

游戏包括:

得分和金币追踪
游戏结束和获胜屏幕,并重新开始选项
跟随马里奥的横向滚动摄像机
基本的物理效果,包括重力和碰撞检测
简单的敌人人工智能,在碰到障碍物或边缘时改变方向。

2.效果展示图

在这里插入图片描述

3.代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Super Mario Demo</title>
    <style>
        body {
            margin: 0;
            overflow: hidden;
            background: #87CEEB;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            font-family: Arial, sans-serif;
        }
        
        #game-container {
            position: relative;
            width: 800px;
            height: 400px;
            background: #87CEEB;
            overflow: hidden;
            border: 4px solid #333;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
        }
        
        #game-canvas {
            position: absolute;
            top: 0;
            left: 0;
        }
        
        #ui {
            position: absolute;
            top: 10px;
            left: 10px;
            color: white;
            font-size: 20px;
            font-weight: bold;
            text-shadow: 2px 2px 0 #000;
        }
        
        #controls {
            position: absolute;
            bottom: 10px;
            left: 10px;
            color: white;
            font-size: 14px;
            text-shadow: 1px 1px 0 #000;
        }
        
        #game-over, #win-screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: white;
            font-size: 36px;
            font-weight: bold;
            display: none;
        }
        
        button {
            margin-top: 20px;
            padding: 10px 20px;
            font-size: 18px;
            background-color: #e52521;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        
        button:hover {
            background-color: #ff4040;
        }
    </style>
</head>
<body>
    <div id="game-container">
        <canvas id="game-canvas" width="800" height="400"></canvas>
        <div id="ui">Score: <span id="score">0</span> | Coins: <span id="coins">0</span></div>
        <div id="controls">
            Controls: Arrow keys to move, Space to jump
        </div>
        <div id="game-over">
            Game Over!
            <button id="restart-button">Restart</button>
        </div>
        <div id="win-screen">
            You Win!
            <button id="restart-button-win">Play Again</button>
        </div>
    </div>

    <script>
        // Game setup
        const canvas = document.getElementById("game-canvas");
        const ctx = canvas.getContext("2d");
        const scoreElement = document.getElementById("score");
        const coinsElement = document.getElementById("coins");
        const gameOverScreen = document.getElementById("game-over");
        const winScreen = document.getElementById("win-screen");
        const restartButton = document.getElementById("restart-button");
        const restartButtonWin = document.getElementById("restart-button-win");
        
        // Game state
        let gameRunning = true;
        let score = 0;
        let coins = 0;

        // Sprites (simplified placeholders)
        const sprites = {
            mario: {
                width: 40,
                height: 60,
                color: "red",
                jumpingColor: "#e52521"
            },
            ground: {
                color: "#8b4513"
            },
            platform: {
                color: "#5d94fb"
            },
            brick: {
                color: "#c86e0c"
            },
            pipe: {
                color: "#05c34c"
            },
            questionBlock: {
                color: "#e39d25",
                hitColor: "#c86e0c"
            },
            goomba: {
                width: 40,
                height: 40,
                color: "#a05000"
            },
            coin: {
                width: 20,
                height: 30,
                color: "gold"
            },
            flag: {
                color: "green",
                poleColor: "#ffffff"
            }
        };

        // Player
        const player = {
            x: 100,
            y: 300,
            width: sprites.mario.width,
            height: sprites.mario.height,
            velocityX: 0,
            velocityY: 0,
            speed: 5,
            jumpForce: 12,
            gravity: 0.5,
            isJumping: false,
            facingRight: true,
            isAlive: true
        };

        // Camera offset (for scrolling)
        let cameraOffsetX = 0;

        // Level design (coordinates are in game space, not screen space)
        const platforms = [
            // Ground
            { x: 0, y: 360, width: 1000, height: 40, type: "ground" },
            { x: 1100, y: 360, width: 600, height: 40, type: "ground" },
            { x: 1800, y: 360, width: 800, height: 40, type: "ground" },
            
            // Platforms
            { x: 400, y: 280, width: 120, height: 30, type: "platform" },
            { x: 600, y: 220, width: 120, height: 30, type: "platform" },
            { x: 1300, y: 260, width: 100, height: 30, type: "platform" },
            { x: 1500, y: 200, width: 80, height: 30, type: "platform" },
            
            // Bricks and question blocks
            { x: 300, y: 200, width: 40, height: 40, type: "brick" },
            { x: 340, y: 200, width: 40, height: 40, type: "question", hit: false },
            { x: 380, y: 200, width: 40, height: 40, type: "brick" },
            { x: 800, y: 240, width: 40, height: 40, type: "question", hit: false },
            { x: 1200, y: 200, width: 40, height: 40, type: "question", hit: false },
            
            // Pipes
            { x: 500, y: 320, width: 60, height: 40, type: "pipe" },
            { x: 1400, y: 320, width: 60, height: 40, type: "pipe" },
            { x: 1700, y: 320, width: 60, height: 40, type: "pipe" }
        ];

        // Goal
        const goal = {
            x: 2400,
            y: 160,
            width: 10,
            height: 200,
            flagHeight: 40,
            flagWidth: 30
        };

        // Enemies
        let enemies = [
            { x: 500, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true },
            { x: 900, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true },
            { x: 1300, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true },
            { x: 1600, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true },
            { x: 2000, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true }
        ];

        // Coins
        let coins_collection = [
            { x: 340, y: 150, width: sprites.coin.width, height: sprites.coin.height, collected: false },
            { x: 800, y: 190, width: sprites.coin.width, height: sprites.coin.height, collected: false },
            { x: 450, y: 230, width: sprites.coin.width, height: sprites.coin.height, collected: false },
            { x: 650, y: 170, width: sprites.coin.width, height: sprites.coin.height, collected: false },
            { x: 1200, y: 150, width: sprites.coin.width, height: sprites.coin.height, collected: false },
            { x: 1350, y: 210, width: sprites.coin.width, height: sprites.coin.height, collected: false },
            { x: 1550, y: 150, width: sprites.coin.width, height: sprites.coin.height, collected: false },
            { x: 2100, y: 310, width: sprites.coin.width, height: sprites.coin.height, collected: false }
        ];

        // Controls
        const keys = {
            right: false,
            left: false,
            up: false
        };

        // Event listeners for keyboard controls
        window.addEventListener('keydown', function(e) {
            if (e.key === 'ArrowRight') keys.right = true;
            if (e.key === 'ArrowLeft') keys.left = true;
            if (e.key === 'ArrowUp' || e.key === ' ') keys.up = true;
            
            // Prevent scrolling when pressing space
            if (e.key === ' ') e.preventDefault();
        });

        window.addEventListener('keyup', function(e) {
            if (e.key === 'ArrowRight') keys.right = false;
            if (e.key === 'ArrowLeft') keys.left = false;
            if (e.key === 'ArrowUp' || e.key === ' ') keys.up = false;
        });

        // Game restart
        restartButton.addEventListener('click', resetGame);
        restartButtonWin.addEventListener('click', resetGame);

        function resetGame() {
            // Reset player
            player.x = 100;
            player.y = 300;
            player.velocityX = 0;
            player.velocityY = 0;
            player.isAlive = true;
            
            // Reset camera
            cameraOffsetX = 0;
            
            // Reset score and coins
            score = 0;
            coins = 0;
            scoreElement.textContent = score;
            coinsElement.textContent = coins;
            
            // Reset enemies
            enemies = [
                { x: 500, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true },
                { x: 900, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true },
                { x: 1300, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true },
                { x: 1600, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true },
                { x: 2000, y: 320, width: sprites.goomba.width, height: sprites.goomba.height, velocityX: -1, isAlive: true }
            ];
            
            // Reset coins
            coins_collection.forEach(coin => coin.collected = false);
            
            // Reset question blocks
            platforms.forEach(platform => {
                if (platform.type === "question") {
                    platform.hit = false;
                }
            });
            
            // Hide screens
            gameOverScreen.style.display = "none";
            winScreen.style.display = "none";
            
            // Restart game
            gameRunning = true;
            requestAnimationFrame(gameLoop);
        }

        // Collision detection
        function isColliding(obj1, obj2) {
            return obj1.x < obj2.x + obj2.width &&
                   obj1.x + obj1.width > obj2.x &&
                   obj1.y < obj2.y + obj2.height &&
                   obj1.y + obj1.height > obj2.y;
        }

        // Game loop
        function gameLoop() {
            if (!gameRunning) return;
            
            // Clear canvas
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            
            // Calculate camera offset (follow player)
            if (player.x > canvas.width / 2) {
                cameraOffsetX = player.x - canvas.width / 2;
            }
            
            // Background (simple blue sky)
            ctx.fillStyle = '#87CEEB';
            ctx.fillRect(0, 0, canvas.width, canvas.height);

            // Draw ground and platforms
            platforms.forEach(platform => {
                ctx.fillStyle = getPlatformColor(platform);
                ctx.fillRect(platform.x - cameraOffsetX, platform.y, platform.width, platform.height);
                
                // Add details for question blocks
                if (platform.type === "question" && !platform.hit) {
                    ctx.fillStyle = 'white';
                    ctx.font = '20px Arial';
                    ctx.fillText('?', platform.x - cameraOffsetX + 15, platform.y + 25);
                }
            });
            
            // Draw goal (flag)
            ctx.fillStyle = sprites.flag.poleColor;
            ctx.fillRect(goal.x - cameraOffsetX, goal.y, goal.width, goal.height);
            ctx.fillStyle = sprites.flag.color;
            ctx.fillRect(goal.x - cameraOffsetX, goal.y, goal.flagWidth, goal.flagHeight);
            
            // Draw coins
            coins_collection.forEach(coin => {
                if (!coin.collected) {
                    ctx.fillStyle = sprites.coin.color;
                    ctx.beginPath();
                    ctx.arc(coin.x - cameraOffsetX + coin.width/2, coin.y + coin.height/2, coin.width/2, 0, Math.PI * 2);
                    ctx.fill();
                }
            });
            
            // Draw enemies
            enemies.forEach(enemy => {
                if (enemy.isAlive) {
                    ctx.fillStyle = sprites.goomba.color;
                    ctx.fillRect(enemy.x - cameraOffsetX, enemy.y, enemy.width, enemy.height);
                    
                    // Simple face for the goomba
                    ctx.fillStyle = 'black';
                    ctx.fillRect(enemy.x - cameraOffsetX + 10, enemy.y + 15, 5, 5);
                    ctx.fillRect(enemy.x - cameraOffsetX + 25, enemy.y + 15, 5, 5);
                    ctx.beginPath();
                    ctx.arc(enemy.x - cameraOffsetX + 20, enemy.y + 30, 10, 0, Math.PI, false);
                    ctx.stroke();
                }
            });
            
            // Draw player (Mario)
            if (player.isAlive) {
                ctx.fillStyle = player.isJumping ? sprites.mario.jumpingColor : sprites.mario.color;
                ctx.fillRect(player.x - cameraOffsetX, player.y, player.width, player.height);
                
                // Simple face for mario
                ctx.fillStyle = 'black';
                ctx.fillRect(player.facingRight ? player.x - cameraOffsetX + 25 : player.x - cameraOffsetX + 10, player.y + 15, 5, 5);
                
                // Mario's cap and overalls (simplified)
                ctx.fillStyle = 'red';
                ctx.fillRect(player.x - cameraOffsetX, player.y, player.width, 15);
                ctx.fillStyle = 'blue';
                ctx.fillRect(player.x - cameraOffsetX + 5, player.y + 35, player.width - 10, 25);
            }

            // Update player
            if (gameRunning && player.isAlive) {
                // Handle movement
                if (keys.right) {
                    player.velocityX = player.speed;
                    player.facingRight = true;
                } else if (keys.left) {
                    player.velocityX = -player.speed;
                    player.facingRight = false;
                } else {
                    player.velocityX = 0;
                }
                
                // Handle jumping
                if (keys.up && !player.isJumping) {
                    player.velocityY = -player.jumpForce;
                    player.isJumping = true;
                }
                
                // Apply gravity
                player.velocityY += player.gravity;
                
                // Update position
                player.x += player.velocityX;
                player.y += player.velocityY;
                
                // Don't go off the left edge
                if (player.x < 0) player.x = 0;
                
                // Check for platform collisions
                player.isJumping = true; // Assume we're in the air unless we find a platform below
                
                platforms.forEach(platform => {
                    if (isColliding(player, platform)) {
                        // Collision with bottom of platform
                        if (player.y < platform.y + platform.height && 
                            player.y > platform.y && 
                            player.velocityY < 0) {
                            player.y = platform.y + platform.height;
                            player.velocityY = 0;
                            
                            // Hit question block
                            if (platform.type === "question" && !platform.hit) {
                                platform.hit = true;
                                spawnCoin(platform.x + platform.width/2, platform.y - 40);
                            }
                        }
                        // Collision with top of platform
                        else if (player.y + player.height > platform.y && 
                                player.y + player.height < platform.y + platform.height &&
                                player.velocityY > 0) {
                            player.y = platform.y - player.height;
                            player.velocityY = 0;
                            player.isJumping = false;
                        }
                        // Collision with right side of platform
                        else if (player.x < platform.x + platform.width && 
                                player.x + player.width > platform.x + platform.width) {
                            player.x = platform.x + platform.width;
                        }
                        // Collision with left side of platform
                        else if (player.x + player.width > platform.x && 
                                player.x < platform.x) {
                            player.x = platform.x - player.width;
                        }
                    }
                });
                
                // Check for enemy collisions
                enemies.forEach(enemy => {
                    if (enemy.isAlive && isColliding(player, enemy)) {
                        // Jumping on enemy
                        if (player.velocityY > 0 && player.y + player.height < enemy.y + enemy.height/2) {
                            enemy.isAlive = false;
                            player.velocityY = -player.jumpForce/1.5;
                            score += 100;
                            scoreElement.textContent = score;
                        } 
                        // Hit by enemy
                        else {
                            gameOver();
                        }
                    }
                });
                
                // Check for coin collisions
                coins_collection.forEach(coin => {
                    if (!coin.collected && isColliding(player, coin)) {
                        coin.collected = true;
                        coins++;
                        score += 50;
                        scoreElement.textContent = score;
                        coinsElement.textContent = coins;
                    }
                });
                
                // Check for goal collision
                if (isColliding(player, goal)) {
                    win();
                }
                
                // Check for falling off the world
                if (player.y > canvas.height) {
                    gameOver();
                }
            }
            
            // Update enemies
            enemies.forEach(enemy => {
                if (enemy.isAlive) {
                    enemy.x += enemy.velocityX;
                    
                    // Simple AI: Change direction when hitting obstacles
                    let onGround = false;
                    let hitWall = false;
                    
                    platforms.forEach(platform => {
                        if (isColliding(enemy, platform)) {
                            // Detect if enemy is on ground
                            if (enemy.y + enemy.height >= platform.y && 
                                enemy.y + enemy.height <= platform.y + 10) {
                                onGround = true;
                            }
                            // Detect if enemy hit wall
                            else if (enemy.x + enemy.width >= platform.x && 
                                    enemy.x <= platform.x) {
                                hitWall = true;
                            }
                            else if (enemy.x <= platform.x + platform.width && 
                                    enemy.x + enemy.width >= platform.x + platform.width) {
                                hitWall = true;
                            }
                        }
                    });
                    
                    // Check if there's ground ahead
                    let groundAhead = false;
                    platforms.forEach(platform => {
                        if (enemy.velocityX < 0) { // Moving left
                            if (enemy.x - 5 >= platform.x && 
                                enemy.x - 5 <= platform.x + platform.width &&
                                enemy.y + enemy.height >= platform.y &&
                                enemy.y + enemy.height <= platform.y + 10) {
                                groundAhead = true;
                            }
                        } else { // Moving right
                            if (enemy.x + enemy.width + 5 >= platform.x && 
                                enemy.x + enemy.width + 5 <= platform.x + platform.width &&
                                enemy.y + enemy.height >= platform.y &&
                                enemy.y + enemy.height <= platform.y + 10) {
                                groundAhead = true;
                            }
                        }
                    });
                    
                    // Change direction if hit wall or about to fall
                    if (hitWall || (!groundAhead && onGround)) {
                        enemy.velocityX = -enemy.velocityX;
                    }
                }
            });

            // Continue the loop
            if (gameRunning) {
                requestAnimationFrame(gameLoop);
            }
        }

        // Spawn a coin (when hitting question blocks)
        function spawnCoin(x, y) {
            const newCoin = { 
                x: x - sprites.coin.width/2, 
                y: y, 
                width: sprites.coin.width, 
                height: sprites.coin.height, 
                collected: false 
            };
            coins_collection.push(newCoin);
            
            // Animation to collect the coin automatically
            setTimeout(() => {
                if (!newCoin.collected) {
                    newCoin.collected = true;
                    coins++;
                    score += 50;
                    scoreElement.textContent = score;
                    coinsElement.textContent = coins;
                }
            }, 1000);
        }

        // Get color based on platform type
        function getPlatformColor(platform) {
            switch(platform.type) {
                case "ground":
                    return sprites.ground.color;
                case "platform":
                    return sprites.platform.color;
                case "brick":
                    return sprites.brick.color;
                case "pipe":
                    return sprites.pipe.color;
                case "question":
                    return platform.hit ? sprites.questionBlock.hitColor : sprites.questionBlock.color;
                default:
                    return "gray";
            }
        }

        // Game over
        function gameOver() {
            player.isAlive = false;
            gameRunning = false;
            gameOverScreen.style.display = "flex";
        }

        // Win
        function win() {
            gameRunning = false;
            winScreen.style.display = "flex";
        }

        // Start the game
        gameLoop();
    </script>
</body>
</html>

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

PEFT介绍及其源码解析

PEFT库介绍 PEFT&#xff08;Parameter-Efficient Fine-Tuning&#xff0c;参数高效微调&#xff09;是由 Hugging Face 开源的一个高效微调库&#xff0c;旨在通过少量可训练参数实现对大型预训练模型的快速适应&#xff0c;从而显著降低计算和存储成本。 核心功能与优势 多…

osgEarth安装总结

第一步&#xff1a;安装OSG 直接通过git下载源码&#xff0c;使用cmake进行编译&#xff0c; git clone --depth 1 https://github.com/openscenegraph/OpenSceneGraph.git mkdir build cd build cmake .. make sudo make isntall编译过程中缺什么库&#xff0c;就安装什么库 …

实体机器人在gazebo中的映射

这一部分目的是将真实的机器人映射到gazebo中&#xff0c;使得gazebo中的其他虚拟机器人能识别到真实世界的wheeltec机器人。 真实机器人的型号的wheeltec旗下的mini_mec。 一、在wheeltec官方百度云文档中找到URDF原始导出功能包.zip 找到对应的包 拷贝到工作空间下 在原有…

8、HTTP/1.0和HTTP/1.1的区别【高频】

第一个是 长连接&#xff1a; HTTP/1.0 默认 短连接&#xff0c;&#xff08;它也可以指定 Connection 首部字段的值为 Keep-Alive实现 长连接&#xff09;而HTTP/1.1 默认支持 长连接&#xff0c;HTTP/1.1是基于 TCP/IP协议的&#xff0c;创建一个TCP连接是需要经过三次握手的…

kafka-leader -1问题解决

一. 问题&#xff1a; 在 Kafka 中&#xff0c;leader -1 通常表示分区的领导者副本尚未被选举出来&#xff0c;或者在获取领导者信息时出现了问题。以下是可能导致出现 kafka leader -1 的一些常见原因及相关分析&#xff1a; 1. 副本同步问题&#xff1a; 在 Kafka 集群中&…

stm32hal库寻迹+蓝牙智能车(STM32F103C8T6)

简介: 这个小车的芯片是STM32F103C8T6&#xff0c;其他的芯片也可以照猫画虎,基本配置差不多,要注意的就是,管脚复用,管脚的特殊功能,(这点不用担心,hal库每个管脚的功能都会给你罗列,很方便的.)由于我做的比较简单,只是用到了几个简单外设.主要是由带霍尔编码器电机的车模,电机…

使用DeepSeek/ChatGPT等AI工具辅助编写wireshark过滤器

随着deepseek,chatgpt等大模型的能力越来越强大&#xff0c;本文将介绍借助deepseek&#xff0c;chatgpt等大模型工具&#xff0c;通过编写提示词&#xff0c;辅助生成全面的Wireshark显示过滤器的能力。 每一种协议的字段众多&#xff0c;流量分析的需求多种多样&#xff0c;…

飞鱼科技游戏策划岗内推

协助策划完成相关工作&#xff0c;包括但不仅限于策划配置&#xff0c;资料搜集&#xff0c;游戏体验&#xff1b; 游戏策划相关作品&#xff1b;游戏大赛经历&#xff1b;游戏demo制作经历&#xff1b;游戏公司策划岗位实习经历优先 内推码 DSZP7YFU

解决中文乱码:字符编码全攻略 - ASCII、Unicode、UTF-8、GB2312详解

&#x1f9d1; 博主简介&#xff1a;CSDN博客专家&#xff0c;历代文学网&#xff08;PC端可以访问&#xff1a;https://literature.sinhy.com/#/?__c1000&#xff0c;移动端可微信小程序搜索“历代文学”&#xff09;总架构师&#xff0c;15年工作经验&#xff0c;精通Java编…

Mesh自组网技术及应用

前言&#xff1a; Mesh自组网随着无线技术发展&#xff0c;在消费领域最近比较有热度。当然应用的场景不限于普通消费领域&#xff0c;在工业、军事领域被也是越来越重要。 一、什么是无线Mesh技术 1.1 无线自组网概念 无线Mesh是一种智能、自组织、多跳、移动、对等、去中心…

滑动验证组件-微信小程序

微信小程序-滑动验证组件&#xff0c;直接引用就可以了&#xff0c;效果如下&#xff1a; 组件参数&#xff1a; 1.enable-close&#xff1a;是否允许关闭&#xff0c;默认true 2.bind:onsuccess&#xff1a;验证后回调方法 引用方式&#xff1a; <verification wx:if&qu…

11.Docker 之分布式仓库 Harbor

Docker 之分布式仓库 Harbor Docker 之分布式仓库 Harbor1. Harbor 组成2. 安装 Harbor Docker 之分布式仓库 Harbor Harbor 是一个用于存储和分发 Docker 镜像的企业级 Registry 服务器&#xff0c;由 VMware 开源&#xff0c;其通过添加一些企业必需的功能特性&#xff0c;例…

(一)趣学设计模式 之 单例模式!

目录 一、啥是单例模式&#xff1f;二、为什么要用单例模式&#xff1f;三、单例模式怎么实现&#xff1f;1. 饿汉式&#xff1a;先下手为强&#xff01; &#x1f608;2. 懒汉式&#xff1a;用的时候再创建&#xff01; &#x1f634;3. 枚举&#xff1a;最简单最安全的单例&a…

Chrome 浏览器(版本号49之后)‌解决跨域问题

谷歌浏览器解决跨域问题 如何查看 Chrome 浏览器版本号 打开 Chrome 浏览器点击右上角的三个点&#xff0c;打开“设置”页面 点击“关于Chrome” 查看版本号 解决跨域操作&#xff1a;windows系统为例 方法一&#xff1a;命令行启动方式&#xff08;最简单&#xff09; …

python中的JSON数据格式

文章目录 什么是json主要功能Python数据和Json数据的相互转化 什么是json JSON是一种轻量级的数据交互格式。可以按照JSON指定的格式去组织和封装数据。JSON本质上是一个带有特定格式的字符串。 主要功能 json就是一种在各个编程语言中流通的数据格式&#xff0c;负责不同编…

汽车智能制造企业数字化转型SAP解决方案总结

一、项目实施概述 项目阶段划分&#xff1a; 蓝图设计阶段主数据管理方案各模块蓝图设计方案下一阶段工作计划 关键里程碑&#xff1a; 2022年6月6日&#xff1a;项目启动会2022年12月1日&#xff1a;系统上线 二、总体目标 通过SAP实施&#xff0c;构建研产供销协同、业财一…

JavaWeb-在idea中配置Servlet项目

文章目录 在idea中进行Servlet项目的配置(较新的idea版本)创建一个空的JavaSE项目(Project)创建一个普通的JavaSE板块(module)添加Web项目的配置定义一个对象模拟实现接口在web.xml中配置路径映射配置项目到Tomcat服务器启动Tomcat服务器进行测试 在idea中进行Servlet项目的配置…

【深度学习神经网络学习笔记(二)】神经网络基础

神经网络基础 神经网络基础前言1、Logistic 回归2、逻辑回归损失函数3、梯度下降算法4、导数5、导数计算图6、链式法则7、逻辑回归的梯度下降 神经网络基础 前言 Logistic 回归是一种广泛应用于统计学和机器学习领域的广义线性回归模型&#xff0c;主要用于解决二分类问题。尽…

力扣hot100 —— 电话号码字母组合; 子集 (非回溯做法)简单易懂

由于博主对回溯也不是很熟悉&#xff0c;这里提出一种简单易懂的解法&#xff08;有点暴力&#xff09; 解题思路&#xff1a; 每个数字对应有自己的字母串&#xff1b; 首先遍历将每个字母存入也就是 res{{a},{b},{c}} 然后遍历后续数子对应的字母&#xff0c;让每个字母与…

React 源码揭秘 | 更新队列

前面几篇遇到updateQueue的时候&#xff0c;我们把它先简单的当成了一个队列处理&#xff0c;这篇我们来详细讨论一下这个更新队列。 有关updateQueue中的部分&#xff0c;可以见源码 UpdateQueue实现 Update对象 我们先来看一下UpdateQueue中的内容&#xff0c;Update对象&…