Java课程设计(双人对战游戏)持续更新......
少废话,当然借助了ai,就这么个实力,后续会逐渐完善......
考虑添加以下功能:
选将,选图,技能,天赋,道具,防反,反重力,物理反弹,击落,计分,粒子效果,打击感加强,陷阱,逃杀......
package game;import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.List;public class GameFrame extends JFrame {public GameFrame() {setTitle("平台射击对战");setSize(800, 600);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setLocationRelativeTo(null);add(new GamePanel());setVisible(true);}public static void main(String[] args) {SwingUtilities.invokeLater(() -> new GameFrame());}
}class GamePanel extends JPanel implements KeyListener, ActionListener {private Player p1, p2;private Timer timer;private boolean[] keys = new boolean[256];private boolean gameOver = false;private boolean gameStarted = false;private JButton startButton, restartButton, exitButton;private List<Platform> platforms = new ArrayList<>();private List<Bullet> bullets = new ArrayList<>();public GamePanel() {setLayout(null);setFocusable(true);addKeyListener(this);// 对称平台布局platforms.add(new Platform(150, 350, 200, 20)); // 左平台platforms.add(new Platform(300, 250, 200, 20)); // 中央平台platforms.add(new Platform(450, 350, 200, 20)); // 右平台startButton = createButton("开始游戏", 300, 250);restartButton = createButton("重新开始", 300, 300);exitButton = createButton("退出游戏", 300, 350);restartButton.setVisible(false);exitButton.setVisible(false);add(startButton);add(restartButton);add(exitButton);startButton.addActionListener(e -> startGame());restartButton.addActionListener(e -> restartGame());exitButton.addActionListener(e -> System.exit(0));}private JButton createButton(String text, int x, int y) {JButton button = new JButton(text);button.setBounds(x, y, 200, 40);button.setFocusable(false);button.setFont(new Font("微软雅黑", Font.BOLD, 18));button.setBackground(new Color(200, 200, 200));return button;}private void startGame() {gameStarted = true;gameOver = false;bullets.clear();startButton.setVisible(false);restartButton.setVisible(false);exitButton.setVisible(false);p1 = new Player(100, 400, Color.BLUE, KeyEvent.VK_A, KeyEvent.VK_D, KeyEvent.VK_W, KeyEvent.VK_F);p2 = new Player(600, 400, Color.RED, KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT, KeyEvent.VK_UP, KeyEvent.VK_M);if (timer != null && timer.isRunning()) {timer.stop();}timer = new Timer(16, this);timer.start();requestFocusInWindow();}private void restartGame() {gameOver = false;gameStarted = false;startGame();}@Overrideprotected void paintComponent(Graphics g) {super.paintComponent(g);if (!gameStarted) {g.setColor(new Color(30, 30, 30));g.fillRect(0, 0, getWidth(), getHeight());g.setColor(Color.WHITE);g.setFont(new Font("微软雅黑", Font.BOLD, 48));g.drawString("平台射击对战", 250, 150);return;}Graphics2D g2d = (Graphics2D) g;g2d.setPaint(new GradientPaint(0, 0, new Color(30, 30, 50), 0, 600, new Color(10, 10, 20)));g2d.fillRect(0, 0, getWidth(), getHeight());g.setColor(new Color(80, 50, 30));g.fillRect(0, 450, getWidth(), 150);g.setColor(new Color(110, 70, 40));for(int i=0; i<getWidth(); i+=30){g.fillRect(i, 450, 15, 10);g.fillRect(i+15, 460, 15, 10);}for (Platform platform : platforms) {platform.draw(g);}p1.draw(g);p2.draw(g);for (Bullet bullet : bullets) {bullet.draw(g);}drawHealthBar(g, p1, 20, 20);drawHealthBar(g, p2, getWidth() - 220, 20);if (gameOver) {g.setColor(new Color(255, 255, 255, 200));g.fillRect(0, 0, getWidth(), getHeight());g.setColor(Color.BLACK);g.setFont(new Font("微软雅黑", Font.BOLD, 48));String winner = p1.getHealth() <= 0 ? "红方胜利!" : "蓝方胜利!";g.drawString(winner, getWidth()/2 - 120, getHeight()/2);restartButton.setVisible(true);exitButton.setVisible(true);}}private void drawHealthBar(Graphics g, Player p, int x, int y) {g.setColor(Color.BLACK);g.fillRect(x, y, 200, 25);g.setColor(p.getColor());g.fillRect(x + 2, y + 2, (int)(196 * (p.getHealth() / 100.0)), 21);}@Overridepublic void actionPerformed(ActionEvent e) {if (!gameOver && gameStarted) {handleInput();updatePlayers();updateBullets();checkCollisions();checkGameOver();}repaint();}private void handleInput() {p1.setMovingLeft(keys[p1.getLeftKey()]);p1.setMovingRight(keys[p1.getRightKey()]);if (keys[p1.getJumpKey()] && p1.isOnGround()) {p1.jump();}if (keys[p1.getAttackKey()] && p1.canAttack()) {bullets.add(p1.shoot());}p2.setMovingLeft(keys[p2.getLeftKey()]);p2.setMovingRight(keys[p2.getRightKey()]);if (keys[p2.getJumpKey()] && p2.isOnGround()) {p2.jump();}if (keys[p2.getAttackKey()] && p2.canAttack()) {bullets.add(p2.shoot());}}private void updatePlayers() {p1.update(getWidth(), platforms);p2.update(getWidth(), platforms);}private void updateBullets() {List<Bullet> toRemove = new ArrayList<>();for (Bullet bullet : bullets) {bullet.update();if (bullet.x < -10 || bullet.x > getWidth() + 10) {toRemove.add(bullet);}}bullets.removeAll(toRemove);}private void checkCollisions() {List<Bullet> toRemove = new ArrayList<>();for (Bullet bullet : bullets) {for (Platform platform : platforms) {if (bullet.hitsPlatform(platform)) {toRemove.add(bullet);break;}}Player target = bullet.shooter == p1 ? p2 : p1;if (bullet.hitsPlayer(target)) {target.takeDamage(10);toRemove.add(bullet);}}bullets.removeAll(toRemove);}private void checkGameOver() {if (p1.getHealth() <= 0 || p2.getHealth() <= 0) {gameOver = true;timer.stop();}}@Overridepublic void keyPressed(KeyEvent e) {if (e.getKeyCode() < keys.length) {keys[e.getKeyCode()] = true;}}@Overridepublic void keyReleased(KeyEvent e) {if (e.getKeyCode() < keys.length) {keys[e.getKeyCode()] = false;}}@Overridepublic void keyTyped(KeyEvent e) {}
}class Player {private static final int GRAVITY = 1;private static final int JUMP_FORCE = -15;private static final int ATTACK_COOLDOWN = 30;private static final int SPEED = 5;private static final int BULLET_SPEED = 10;private int x, y;private int width = 40, height = 80;private int dx, dy;private int health = 100;private Color color;private boolean onGround = false;private int attackTimer = 0;private boolean movingLeft = false;private boolean movingRight = false;private boolean facingRight = true;private int leftKey, rightKey, jumpKey, attackKey;public Player(int x, int y, Color color, int leftKey, int rightKey, int jumpKey, int attackKey) {this.x = x;this.y = y;this.color = color;this.leftKey = leftKey;this.rightKey = rightKey;this.jumpKey = jumpKey;this.attackKey = attackKey;}public void update(int screenWidth, List<Platform> platforms) {// 处理水平移动dx = 0;if (movingLeft) {dx -= SPEED;facingRight = false;}if (movingRight) {dx += SPEED;facingRight = true;}// 保存移动前的坐标int xPrev = x;x += dx;x = Math.max(0, Math.min(screenWidth - width, x));// 水平碰撞检测Rectangle playerRect = getCollisionBounds();for (Platform platform : platforms) {Rectangle platformRect = platform.getBounds();if (playerRect.intersects(platformRect)) {if (dx > 0) { // 向右移动碰撞x = platformRect.x - width;} else if (dx < 0) { // 向左移动碰撞x = platformRect.x + platformRect.width;}break;}}// 处理垂直移动dy += GRAVITY;int yPrev = y;y += dy;// 垂直碰撞检测boolean isFalling = dy > 0;onGround = false;if (isFalling) {// 下落碰撞检测int playerBottomAfter = y + height;int playerBottomBefore = yPrev + height;Platform landingPlatform = null;int highestPlatformY = Integer.MIN_VALUE;for (Platform platform : platforms) {Rectangle platformRect = platform.getBounds();int platformTop = platformRect.y;int platformBottom = platformTop + platformRect.height;boolean xOverlap = (x < platformRect.x + platformRect.width) &&(x + width > platformRect.x);if (xOverlap &&playerBottomBefore <= platformTop &&playerBottomAfter >= platformTop) {if (platformTop > highestPlatformY) {highestPlatformY = platformTop;landingPlatform = platform;}}}if (landingPlatform != null) {y = landingPlatform.getY() - height;dy = 0;onGround = true;} else {// 检查地面碰撞if (playerBottomAfter >= 450) {y = 450 - height;dy = 0;onGround = true;}}} else if (dy < 0) {// 上升碰撞检测(头部碰撞)int playerTopAfter = y;int playerTopBefore = yPrev;Platform headPlatform = null;int lowestPlatformBottom = Integer.MAX_VALUE;for (Platform platform : platforms) {Rectangle platformRect = platform.getBounds();int platformBottom = platformRect.y + platformRect.height;boolean xOverlap = (x < platformRect.x + platformRect.width) &&(x + width > platformRect.x);if (xOverlap &&playerTopBefore >= platformBottom &&playerTopAfter <= platformBottom) {if (platformBottom < lowestPlatformBottom) {lowestPlatformBottom = platformBottom;headPlatform = platform;}}}if (headPlatform != null) {y = headPlatform.getY() + headPlatform.getHeight();dy = 0;}}// 更新攻击计时器if (attackTimer > 0) {attackTimer--;}}public Bullet shoot() {attackTimer = ATTACK_COOLDOWN;int bulletX = facingRight ? x + width : x - 10;int bulletY = y + height/2 - Bullet.SIZE/2;return new Bullet(bulletX, bulletY, facingRight ? BULLET_SPEED : -BULLET_SPEED, this);}public void jump() {if (onGround) {dy = JUMP_FORCE;onGround = false;}}public void takeDamage(int damage) {health = Math.max(0, health - damage);}public void draw(Graphics g) {g.setColor(color);g.fillRect(x, y, width, height);}public Rectangle getCollisionBounds() {return new Rectangle(x + 5, y + 10, width - 10, height - 20);}public int getX() { return x; }public int getY() { return y; }public int getHealth() { return health; }public Color getColor() { return color; }public boolean isOnGround() { return onGround; }public void setMovingLeft(boolean moving) { movingLeft = moving; }public void setMovingRight(boolean moving) { movingRight = moving; }public boolean canAttack() { return attackTimer <= 0; }public int getLeftKey() { return leftKey; }public int getRightKey() { return rightKey; }public int getJumpKey() { return jumpKey; }public int getAttackKey() { return attackKey; }
}class Bullet {int x, y;int speed;Player shooter;static final int SIZE = 10;public Bullet(int x, int y, int speed, Player shooter) {this.x = x;this.y = y;this.speed = speed;this.shooter = shooter;}public void update() {x += speed;}public void draw(Graphics g) {g.setColor(Color.YELLOW);g.fillOval(x, y, SIZE, SIZE);}public boolean hitsPlayer(Player player) {Rectangle bulletRect = new Rectangle(x, y, SIZE, SIZE);return bulletRect.intersects(player.getCollisionBounds());}public boolean hitsPlatform(Platform platform) {Rectangle bulletRect = new Rectangle(x, y, SIZE, SIZE);return bulletRect.intersects(platform.getBounds());}
}class Platform {private int x, y, width, height;public Platform(int x, int y, int width, int height) {this.x = x;this.y = y;this.width = width;this.height = height;}public void draw(Graphics g) {g.setColor(new Color(100, 100, 100));g.fillRect(x, y, width, height);g.setColor(new Color(120, 120, 120));g.fillRect(x, y, width, 3);g.fillRect(x, y + height - 3, width, 3);}public Rectangle getBounds() {return new Rectangle(x, y, width, height);}public int getY() { return y; }public int getHeight() { return height; }
}
相关文章:
Java课程设计(双人对战游戏)持续更新......
少废话,当然借助了ai,就这么个实力,后续会逐渐完善...... 考虑添加以下功能: 选将,选图,技能,天赋,道具,防反,反重力,物理反弹,击落…...
c++第三课(基础c)
1.前文 2.break 3.continue 4.return 0 1.前文 上次写文章到现在,有足足这么多天(我也不知道,自己去数吧) 开始吧 2.break break是结束循环的意思 举个栗子 #include<bits/stdc.h> using namespace std; int main(…...
Windows 图形显示驱动开发-WDDM 2.4功能-GPU 半虚拟化(十一)
注册表设置 GPU虚拟化标志 GpuVirtualizationFlags 注册表项用于设置半虚拟化 GPU 的行为。 密钥位于: DWORD HKLM\System\CurrentControlSet\Control\GraphicsDrivers\GpuVirtualizationFlags 定义了以下位: 位描述0x1 为所有硬件适配器强制设置…...
Android在KSP中简单使用Room
Android在KSP中简单使用Room 最近下载了最新版Studio,好多依赖和配置都需要升级,之前使用过room封装数据库工具类,最近在整理ksp相关,于是把room也升级了,简单记录一下升级过程,直接上代码。 1.添加KSP依…...
Maven 构建配置文件详解
Maven 构建配置文件详解 引言 Maven 是一个强大的项目管理和构建自动化工具,广泛应用于 Java 开发领域。在 Maven 项目中,配置文件扮演着至关重要的角色。本文将详细介绍 Maven 构建配置文件的相关知识,包括配置文件的作用、结构、配置方法等,帮助读者更好地理解和应用 M…...
精确截图工具:基于 Tkinter 和 PyAutoGUI 的实现
在日常工作中,截图是一个非常常见的需求。虽然 Windows 自带截图工具,但有时我们需要更精确的截图方式,比如选取特定区域、快速保存截图并进行预览。本篇博客将介绍一个使用 Python 结合 Tkinter 和 PyAutoGUI 开发的精确截图工具。 C:\pytho…...
Linux练习——有关硬盘、联网、软件包的管理
1、将你的虚拟机的网卡模式设置为nat模式,给虚拟机网卡配置三个主机位分别为100、200、168的ip地址 #使用nmtui打开文本图形界面配置网络 [rootrhcsa0306 ~]# nmtui #使用命令激活名为 ens160 的 NetworkManager 网络连接 [rootrhcsa0306 ~]# nmcli c up ens160 #通…...
【C++】 —— 笔试刷题day_12
一、删除公共字符 题目解析 题目给了两个字符串(其中包含空格),让我们在第一个字符串中删除第二个字符串中的字符。 我们要输出删除后的字符串。 算法思路 这道题,如果直接按照题目中的要求去第一个字符串中删除字符,…...
家乡旅游景点小程序(源码+部署教程)
运行环境 家乡旅游景点小程序运行环境如下: • 前端:小程序 • 后端:无 • IDE工具:微信开发者工具 • 技术栈:小程序 注意:此项目为纯静态项目,无后端 主要功能 家乡旅游景点微信小程序主…...
SQL Server:当在删除数据库时因为存在触发器而无法删除
当在删除数据库时因为存在触发器而无法删除,你可以通过禁用触发器来解决这个问题。下面为你介绍在 SQL Server 里禁用和启用触发器的方法。 禁用数据库中所有表的触发器 你可以使用系统视图 sys.triggers 来查询数据库里所有的触发器,然后生成禁用这些…...
多人协同进行qt应用程序开发应该注意什么2?
在多人协同开发Qt应用程序时,为了确保高效协作、代码一致性和项目可维护性,需要特别注意以下关键点: 1. 版本控制与协作流程 统一版本控制工具:使用Git并规范分支策略(如Git Flow),通过.gitign…...
js关于for of 与for in
for…of for-of循环用于遍历可迭代对象,如数组、字符串、Map、Set等。它直接访问每个元素的值,而不是键名。 const arr [3,5,6,7,0] for(let item of arr){console.log(item); } // 3 // 5 // 6 // 7 // 0只有部署了Iterator接口的数据结构才能使用fo…...
Python Excel
一、Python读Excel——xlrd -*- coding: utf-8 -*- import xlrddef read_excel():打开文件workbook xlrd.open_workbook(rD:\demo1.xlsx)获取所有sheetprint(workbook.sheet_names()) 列表形式返回sheet1_name workbook.sheet_names()[0]根据sheet索引或者名称获取sheet内容…...
前端全局编程和模块化编程
1. 全局编程 <!DOCTYPE html> <html> <head><title>OpenLayers 示例</title><style>.map {width: 100%;height: 400px;}</style><script src"https://cdn.jsdelivr.net/npm/olv7.4.0/dist/ol.js"></script>&…...
随机2级域名引导页HTML源码
源码介绍 随机2级域名引导页HTML源码,每次点进去都随机一个域名前缀。 修改跳转域名在 350 行代码,源码由HTMLCSSJS组成,记事本打开源码文件可以进行内容文字之类的修改,双击html文件可以本地运行 效果预览 源码免费获取 随机2级域名引导页…...
Latex的各种数学公式
Latex的各种数学公式 简介公式1、 A 、 A ‾ \neg A\text{、}\overline{A} A、A2、 、 \text{、} 、3、 ⋅ 、 ∙ \cdot \text{、} \bullet ⋅、∙ 4、表格 简介 这里会随时更新我需要用到的数学公式,以csdn中写作格式为主,可能过时了,不适合…...
稻壳模板下载器(Windows):免费获取WPS稻壳模板的利器
稻壳模板下载器(Win) 稻壳模板下载器是一款功能强大的工具,能够帮助用户免费下载WPS稻壳儿中的各种模板,无需开通VIP会员。它支持多种模板类型,包括PPT、Word、Excel等,极大地提升了用户的办公效率。 依托…...
BeanDefinition和Beanfactory实现一个简单的bean容器
目录 什么是 Springbean 容器 设计思路 图解 参考文章 开源地址 BeanDefinition 类 BeanFactory 类 测试类 什么是 Springbean 容器 Spring 包含并管理应用对象的配置和生命周期,在这个意义上它是一种用于承载对象的容器,你可以配置你的每个 Bea…...
Mybatis的resultMap标签介绍
说明:在Mybatis中,resultMap 标签可以用于SQL查询后的封装数据,本文用两个场景介绍 resultMap 标签的使用。 搭建环境 先搭一个Demo,pom如下: <?xml version"1.0" encoding"UTF-8"?> &…...
jarvisoj API调用 [JSON格式变XXE]
http://web.jarvisoj.com:9882/ 题目要求:请设法获得目标机器 /home/ctf/flag.txt 中的flag值 抓包得到: POST /api/v1.0/try HTTP/1.1 Host: web.jarvisoj.com:9882 Content-Length: 36 Accept-Language: zh-CN,zh;q0.9 User-Agent: Mozilla/5.0 (W…...
论坛系统的测试
项目背景 论坛系统采用前后端分离的方式来实现,同时使用数据库 来处理相关的数据,同时将其部署到服务器上。前端主要有7个页面组成:登录页,列表页,论坛详情页,编辑页,个人信息页,我…...
RK3588使用笔记:纯linux系统下基础功能配置(不定期更新)
一、前言 用于记录使用RK3588这个平台在纯linux系统下的一些功能配置,RK3588只是一个芯片,linux只是一个系统,但是linux系统可以运行在无数的芯片上,也都大同小异,本编文章主要记录linux系统环境的一些常用的基础功能…...
yum install 报错(CentOS换源):
yum instally yum utils device mapper persistent-data lvm2 报错: 排查错误原因:centos7 系统停止维护了 解决方案:换源(更换操作系统) //1.备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-…...
HTTP常见状态码分析
当浏览者访问一个网页时,浏览者的浏览器会想网页所在的服务器发出请求,当浏览器接收并显示网页前,此网页所在的服务器会返回一个包含 HTTP 状态码的信息头(server header)用以响应浏览器的请求。 常见的状态码…...
Python与Web 3.0支付系统:技术融合与未来展望
Python与Web 3.0支付系统:技术融合与未来展望 随着区块链技术的不断发展,Web 3.0支付系统正逐步成为数字经济的重要组成部分。Python作为一种高效、易用的编程语言,在Web 3.0支付系统的开发中扮演着不可或缺的角色。本文将从技术背景、Python的应用、代码示例以及未来发展趋…...
Linux命令-sed指令
sed命令参数: 基本参数 -n:抑制默认输出,只显示匹配的行。 -e:指定 sed 脚本。 -i:直接修改文件内容。 -f:指定包含 sed 脚本的文件。 -r:启用扩展正则表达式。 常用操作 s:替换字符…...
Unbantu24.04配置-软件安装
Ubantu24.04配置—环境安装 最近在笔记本安装了双系统,这次在这里回顾一下,本章节主要是一些软件的注意点,大多数都是在网上有一定的教程的 1.搜狗输入法 1.1 删除其他框架 sudo apt purge ibus sudo apt remove fcitx5* sudo apt pur…...
八股总结(Java)实时更新!
八股总结(java) ArrayList和LinkedList有什么区别 ArrayList底层是动态数组,LinkedList底层是双向链表;前者利于随机访问,后者利于头尾插入;前者内存连续分配,后者通过指针连接多块不连续的内存…...
NVIDIA TensorRT 10 [TAR]安装教程
平台信息 操作系统:Ubuntu 20.04.6 LTSCPU架构:x86_64GPU:Tesla T4 x 2驱动信息: NVIDIA-SMI:535.104.05Driver Version: 535.104.05CUDA Version: 12.2 步骤 预备步骤 安装驱动和CUDA 假设已经成功安装好驱动&a…...
深入探索 iOS 卡顿优化
认识卡顿 一些概念 FPS:Frames Per Second,表示每秒渲染的帧数,通过用于衡量画面的流畅度,数值越高则表示画面越流畅。CPU:负责对象的创建和销毁、对象属性的调整、布局计算、文本的计算和排版、图片的格式转换和解码…...
【C/C++算法】从浅到深学习---分治算法之快排思想(图文兼备 + 源码详解)
绪论:冲击蓝桥杯一起加油!! 每日激励:“不设限和自我肯定的心态:I can do all things。 — Stephen Curry” 绪论:本章是针对快速排序进行的优化和再次理解快排思想,将会通过4道题目带你再次…...
精通React JS中的API调用:示例指南
精通React JS中的API调用:示例指南 推荐超级课程: 本地离线DeepSeek AI方案部署实战教程【完全版】Docker快速入门到精通Kubernetes入门到大师通关课AWS云服务快速入门实战目录 精通React JS中的API调用:示例指南为什么在React JS中进行API调用?在React JS中制作API调用:…...
浅谈Thread类及常见方法与线程的状态(多线程编程篇2)
目录 前言 1.Thread类及常见方法 Thread类中常见的属性 1. getId() 2. getName() 3. getState() 4. getPriority() 5. isDaemon() 6. isAlive() 7. isInterrupted() 2.Thread类中常见的方法 Thread.interrupt() (中断线程) Thread.start()(启动线程) 1. 覆写 run…...
算法刷题记录——LeetCode篇(1.2) [第11~20题](持续更新)
更新时间:2025-03-29 LeetCode题解专栏:实战算法解题 (专栏)技术博客总目录:计算机技术系列目录页 优先整理热门100及面试150,不定期持续更新,欢迎关注! 17. 电话号码的字母组合 给定一个仅包含数字 2-9…...
基于HTML5和CSS3实现3D旋转相册效果
基于HTML5和CSS3实现3D旋转相册效果 这里写目录标题 基于HTML5和CSS3实现3D旋转相册效果项目介绍技术栈核心功能实现原理1. HTML结构2. CSS样式设计2.1 基础样式设置2.2 容器样式2.3 图片样式 3. JavaScript实现4. 交互功能实现4.1 触摸和鼠标拖拽4.2 播放控制 项目亮点技术难点…...
unity中Xcharts图表鼠标悬浮表现异常
鼠标悬浮在面板附近,只显示单独的一个项目 而且无论鼠标如何移动,根本没有效果。 解决方案: 需要在对应的Canvas上绑定主相机才可以 鼠标移动到项目上就有信息展示了...
Unity程序嵌入Qt后点击UI按钮Button没有反应
一、前言 在一次项目中,需要将Unity程序嵌入qt中,并在主界面显示,根据网络资料与相关代码,成功将unity程序嵌入,但是在点击Unity的Button按钮时却没有响应,在查找相关资料后,解决问题ÿ…...
Linux安装Cmake (Centos 7.9)
cmake安装 这个虽然已经更新到了4.0.0版本了,但是我们要用3.5版本的,因为这个比较稳定 官方地址:https://github.com/Kitware/CMake/releases/tag/v3.5.0,选择那个cmake-3.5.0-Linux-x86_64.tar.gz下载, 首先解压文…...
31天Python入门——第14天:异常处理
你好,我是安然无虞。 文章目录 异常处理1. Python异常2. 异常捕获try-except语句捕获所有的异常信息获取异常对象finally块 3. raise语句4. 自定义异常5. 函数调用里面产生的异常补充练习 异常处理 1. Python异常 Python异常指的是在程序执行过程中发生的错误或异…...
Linux使用集群服务器查看已安装conda环境,且环境名无显示、系统环境混乱等问题
一、问题 在使用集群服务器前可以查看导入,module load不需要安装。我都是自己重新下载Anaconda3-2024.10-1-Linux-x86_64.sh,然后安装,导致混乱。下面是情况 1.创建的环境名跑到目录下了 2.多个base,且有个base无显示 二、解决办法 1.删…...
【Linux】B站黑马程序视频学习笔记(一)
一、Linux内核与发行版 注意:下图程序指向内核的箭头用的是“调用”,内核指向硬件用的是“调度”。 Linux内核代码下载网站:https://www.kernel.org/ 二、虚拟机-VMware 学习Linux可以借助虚拟机(其使用到的CPU、内存、硬盘都是…...
HarmonyOS NEXT——【鸿蒙原生应用加载Web页面】
鸿蒙客户端加载Web页面: 在鸿蒙原生应用中,我们需要使用前端页面做混合开发,方法之一是使用Web组件直接加载前端页面,其中WebView提供了一系列相关的方法适配鸿蒙原生与web之间的使用。 效果 web页面展示: Column()…...
【软件工程】习题及答案
目录 第一章 习题第一章 习题答案第二章 习题第二章 习题答案第三章 习题第三章 习题答案第四章 习题第四章 习题答案第五章 习题第五章 习题答案第六章 习题第六章 习题答案第七章 习题第七章 习题答案 第一章 习题 一、选择题 1.关于引起软件危机的原因ÿ…...
css选择最后结尾的元素DOM
前言 选中最后一个元素,实际使用非常频繁。 解决方案 使用 CSS 提供的选择器,即可完成。 如下代码示例,两种选择器均可实现。 <p>...</p>p:last-child{ background:#ff0000; }p:nth-last-child(1){background:#ff0000; }p&…...
【AI论文】挑战推理的边界:大型语言模型的数学基准测试
摘要:近年来,大型推理模型的迅猛发展导致现有用于评估数学推理能力的基准测试趋于饱和,这凸显出迫切需要更具挑战性和严谨性的评估框架。为填补这一空白,我们推出了OlymMATH,这是一项全新的奥林匹克级数学基准测试&…...
使用 Python包管理工具 uv 完成 Open WebUI 的安装
uv 是一个极其快速的 Python 包安装器和解析器,用 Rust 编写,旨在作为 pip 和 pip-tools 工作流的替代品 使用 uv 安装(推荐) macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | shWindows: po…...
【区块链安全 | 第三篇】主流公链以太坊运行机制
文章目录 1. 以太坊账户类型2. 以太坊网络架构2.1 节点类型2.2 交易流程 3. 共识机制4. Gas 机制4.1 Gas 计算方式4.2 以太坊 EIP-1559 交易机制 5. EVM(以太坊虚拟机)5.1 EVM 结构5.2 EVM 指令5.3 EVM 运行机制 6. 智能合约7. ERC 代币标准7.1 ERC-207.…...
C# 字符串(String)
C# 字符串(String) 引言 在C#编程语言中,字符串(String)是处理文本数据的基础。字符串是字符的有序集合,用于存储和处理文本信息。C#的字符串类型是System.String,它是一个引用类型࿰…...
Unity Shader 学习18:Shader书写基本功整理
1. Drawer [HideInInspector]:面板上隐藏[NoScaleOffset]:隐藏该纹理贴图的TillingOffset[Normal]:检查该纹理是否设为法线贴图[HDR]:将颜色类型设为高动态范围颜色(摄像机也要开启HDR才有效果)[PowerSlid…...
构建第一个SpringBoot程序
第一种方式: 注,构建过程中一定要联网 new module -->选择spring Initializr 选择Web --> 勾选Spring Web --> create 构建好的项目如下 这里的 .mvn .git* HELP.md mvnw* 都可以删除 编辑好controller 之后 点击即可运行第一个springbo…...