C#【进阶】俄罗斯方块

news/2024/7/20 8:36:22/文章来源:https://blog.csdn.net/AMrss/article/details/139229623

俄罗斯方块

文章目录

      • Test1_场景切换相关
        • BeginScene.cs
        • BegionOrEndScene.cs
        • EndScene.cs
        • Game.cs
        • GameScene.cs
        • ISceneUpdate.cs
      • Test2_绘制对象基类和枚举信息
        • DrawObject.cs
        • IDraw.cs
        • Position.cs
      • Test3_地图相关
        • Map.cs
      • Test4_坐标信息类
        • BlockInfo.cs
      • Test5_板砖工人类
        • BlockWorker.cs
      • Test6_输入模块
        • InputThread.cs
      • Program.cs

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

Test1_场景切换相关

BeginScene.cs
namespace CSharp俄罗斯方块
{internal class BeginScene : BegionOrEndScene{public BeginScene(){strTitle = "俄罗斯方块";strOne = "开始游戏";}public override void EnterJDoSomthing(){if (nowSelIndex == 0){Game.ChangeScene(E_SceneType.Game);}else{Environment.Exit(0);}}}
}
BegionOrEndScene.cs
namespace CSharp俄罗斯方块
{abstract internal class BegionOrEndScene : ISceneUpdate{protected int nowSelIndex = 0;protected string strTitle;protected string strOne;public abstract void EnterJDoSomthing();public void Update(){Console.ForegroundColor = ConsoleColor.White;Console.SetCursorPosition(Game.w / 2 - strTitle.Length, 5);Console.Write(strTitle);Console.SetCursorPosition(Game.w / 2 - strOne.Length, 8);Console.ForegroundColor = nowSelIndex == 0 ? ConsoleColor.Red : ConsoleColor.White;Console.Write(strOne);Console.SetCursorPosition(Game.w / 2 - 4, 10);Console.ForegroundColor = nowSelIndex == 1 ? ConsoleColor.Red : ConsoleColor.White;Console.Write("结束游戏");switch(Console.ReadKey(true).Key){case ConsoleKey.W:nowSelIndex--;if (nowSelIndex < 0){nowSelIndex = 1;}break;case ConsoleKey.S:nowSelIndex++;if (nowSelIndex > 1){nowSelIndex = 0;}break;case ConsoleKey.J:EnterJDoSomthing();break;}}}
}
EndScene.cs
namespace CSharp俄罗斯方块
{internal class EndScene : BegionOrEndScene{public EndScene(){strTitle = "结束游戏";strOne = "回到开始界面";}public override void EnterJDoSomthing(){if(nowSelIndex == 0){Game.ChangeScene(E_SceneType.Begin);}else{Environment.Exit(0);}}}
}
Game.cs
namespace CSharp俄罗斯方块
{enum E_SceneType{Begin,Game,End,}internal class Game{public const int w = 50;public const int h = 35;public static ISceneUpdate nowScene;public Game(){Console.CursorVisible = false;Console.SetWindowSize(w, h);Console.SetBufferSize(w, h);ChangeScene(E_SceneType.Begin);}public void start(){while (true){if (nowScene != null){nowScene.Update();}}}public static  void ChangeScene(E_SceneType type){Console.Clear();switch (type){case E_SceneType.Begin:nowScene = new BeginScene();break;case E_SceneType.Game:nowScene = new GameScene();break;case E_SceneType.End:nowScene = new EndScene();break;}}}}
GameScene.cs
namespace CSharp俄罗斯方块
{internal class GameScene : ISceneUpdate{Map map;BlockWorker blockWorker;//bool isRunning;//新开线程//Thread inputThread;public GameScene(){map = new Map(this);blockWorker = new BlockWorker();InputThread.Instance.inputEvent += CheckInputThread;//isRunning = true;//inputThread = new Thread(CheckInputThread);设置成后台线程(生命周期随主线程)//inputThread.IsBackground = true;开启线程//inputThread.Start();}public void StopThread(){//isRunning = false;//inputThread = null;//移除输入事件监听InputThread.Instance.inputEvent -= CheckInputThread;}private void CheckInputThread(){//while (isRunning)//{//检测输入,防止输入卡程序if (Console.KeyAvailable){//避免影响主线程,在输入后加锁lock (blockWorker){switch (Console.ReadKey(true).Key){case ConsoleKey.LeftArrow://判断变形if (blockWorker.CanChange(E_Change_Type.Left, map))blockWorker.Change(E_Change_Type.Left);break;case ConsoleKey.RightArrow:if (blockWorker.CanChange(E_Change_Type.Right, map))blockWorker.Change(E_Change_Type.Right);break;case ConsoleKey.A:if (blockWorker.CanMoveR_L(E_Change_Type.Left, map))blockWorker.MoveR_L(E_Change_Type.Left);break;case ConsoleKey.D:if (blockWorker.CanMoveR_L(E_Change_Type.Right, map))blockWorker.MoveR_L(E_Change_Type.Right);break;case ConsoleKey.S:if (blockWorker.CanDown(map))blockWorker.AutoMove();break;}}}//}}public void Update(){lock (blockWorker){map.Draw();blockWorker.Draw();if (blockWorker.CanDown(map))blockWorker.AutoMove();}//线程休眠减速Thread.Sleep(100);}}
}
ISceneUpdate.cs
namespace CSharp俄罗斯方块
{/// <summary>/// 场景更新接口/// </summary>internal interface ISceneUpdate{void Update();}
}

Test2_绘制对象基类和枚举信息

DrawObject.cs
namespace CSharp俄罗斯方块
{/// <summary>/// 绘制类型/// </summary>enum E_DrawType{/// <summary>/// 墙壁/// </summary>Wall,/// <summary>/// 正方形方块/// </summary>Cube,/// <summary>/// 直线/// </summary>Line,/// <summary>/// 坦克/// </summary>Tank,/// <summary>/// 左梯子/// </summary>Left_Ladder,/// <summary>/// 右梯子/// </summary>Right_Ladder,/// <summary>/// 左长梯子/// </summary>Left_Long_ladder,/// <summary>/// 右长梯子/// </summary>Right_Long_ladder,}internal class DrawObject : IDraw{public Position pos;public E_DrawType type;public DrawObject(E_DrawType type){this.type = type;}public DrawObject(E_DrawType type, int x, int y) : this(type){pos = new Position(x, y);}public void Draw(){if (pos.y < 0)return;Console.SetCursorPosition(pos.x, pos.y);switch (type){case E_DrawType.Wall:Console.ForegroundColor = ConsoleColor.Red;break;case E_DrawType.Cube:Console.ForegroundColor = ConsoleColor.Blue;break;case E_DrawType.Line:Console.ForegroundColor = ConsoleColor.Green;break;case E_DrawType.Tank:Console.ForegroundColor = ConsoleColor.Cyan;break;case E_DrawType.Left_Ladder:case E_DrawType.Right_Ladder:Console.ForegroundColor = ConsoleColor.Magenta;break;case E_DrawType.Left_Long_ladder:case E_DrawType.Right_Long_ladder:Console.ForegroundColor = ConsoleColor.Yellow;break;}Console.Write("■");}//擦除public void ClearDraw(){if (pos.y < 0)return;Console.SetCursorPosition(pos.x, pos.y);Console.Write("  ");}/// <summary>/// 附着墙壁方法/// </summary>/// <param name="type"></param>public void ChangeType(E_DrawType type){this.type = type;}}
}
IDraw.cs
namespace CSharp俄罗斯方块
{internal interface IDraw{void Draw();}
}
Position.cs
namespace CSharp俄罗斯方块
{internal struct Position{public int x;public int y;public Position(int x, int y){this.x = x;this.y = y;}public static bool operator ==(Position left, Position right){if (left.x == right.x && left.y == right.y) { return true; }return false;}public static bool operator !=(Position left, Position right){if (left.x == right.x && left.y == right.y) { return false; }return true;}public static Position operator +(Position left, Position right){return new Position(left.x + right.x, left.y + right.y);}}}

Test3_地图相关

Map.cs
namespace CSharp俄罗斯方块
{internal class Map : IDraw{//固定墙壁private List<DrawObject> walls = new List<DrawObject>();//动态墙壁public List<DrawObject> dynamicWalls = new List<DrawObject>();private GameScene nowGameScene;//为了外部能快速得到地图边界//动态墙壁的宽容量,小方块横向个数public int w;public int h;//记录每一行有多少个小方块的容器,索引就是行号private int[] recordInfo;public Map(GameScene scene){nowGameScene = scene;h = Game.h - 6;recordInfo = new int[h];w = 0;//绘制横向墙壁for (int i = 0; i < Game.w; i += 2){walls.Add(new DrawObject(E_DrawType.Wall, i, h));w++;}w -= 2;for (int i = 0; i < h; i++){walls.Add(new DrawObject(E_DrawType.Wall, 0, i));walls.Add(new DrawObject(E_DrawType.Wall, Game.w - 2, i));}}public void Draw(){for (int i = 0; i < walls.Count; i++){walls[i].Draw();}for (int i = 0; i < dynamicWalls.Count; i++){dynamicWalls[i].Draw();}}public void ClearDraw(){for (int i = 0; i < dynamicWalls.Count; i++){dynamicWalls[i].ClearDraw();}}public void AddWalls(List<DrawObject> walls){for (int i = 0; i < walls.Count; i++){//掉下来的方块变成墙壁类型walls[i].ChangeType(E_DrawType.Wall);dynamicWalls.Add(walls[i]);if (walls[i].pos.y<=0){nowGameScene.StopThread();Game.ChangeScene(E_SceneType.End);return;}//进行添加动态墙壁行的计数recordInfo[h - walls[i].pos.y - 1]++;}ClearDraw();CheckClear();Draw();}/// <summary>/// 检测是否跨层/// </summary>public void CheckClear(){//遍历时安全移除,添加待移除数组List<DrawObject> delList = new List<DrawObject>();//要选择记录行中有多少个方块的容器//数组判断这一行是否满//遍历数组,检测数组里面存的数是不是w-2for (int i = 0; i < recordInfo.Length; i++){//如果这行满了需要移除if (recordInfo[i] == w){//1、这一行的所有方块移除for (int j = 0; j < dynamicWalls.Count; j++){//通过动态方块的y计算它在哪一行if (i == h - dynamicWalls[j].pos.y - 1){//待移除添加到记录列表delList.Add(dynamicWalls[j]);}//2、要这一行之上的所有方块下移else if (h - dynamicWalls[j].pos.y - 1 > i){dynamicWalls[j].pos.y++;}}//移除待删小方块for (int j = 0;j < delList.Count; j++){dynamicWalls.Remove(delList[j]);}//3、记录小方块数量的数组从上到下迁移for (int j = i; j < recordInfo.Length-1; j++){recordInfo[j] = recordInfo[j + 1];}//置空最顶层recordInfo[recordInfo.Length - 1] = 0;//利用递归,一层一层检测CheckClear();break;}}}}
}

Test4_坐标信息类

在这里插入图片描述
在这里插入图片描述

BlockInfo.cs
namespace CSharp俄罗斯方块
{internal class BlockInfo{private List<Position[]> list;public BlockInfo(E_DrawType type){list = new List<Position[]>();switch (type){case E_DrawType.Cube:list.Add(new Position[3] { new Position(2, 0), new Position(0, 1), new Position(2, 1) });break;case E_DrawType.Line:list.Add([new Position(0, -1), new Position(0, 1), new Position(0, 2)]);list.Add([new Position(-4, 0), new Position(-2, 0), new Position(2, 0)]);list.Add([new Position(0, -2), new Position(0, -1), new Position(0, 1)]);list.Add([new Position(-2, 0), new Position(2, 0), new Position(4, 0)]);break;case E_DrawType.Tank:list.Add([new Position(-2, 0), new Position(2, 0), new Position(0, 1)]);list.Add([new Position(0, -1), new Position(-2, 0), new Position(0, 1)]);list.Add([new Position(0, -1), new Position(-2, 0), new Position(2, 0)]);list.Add([new Position(0,-1), new Position(2, 0), new Position(0, 1)]);break;case E_DrawType.Left_Ladder:list.Add([new Position(0, -1), new Position(2, 0), new Position(2, 1)]);list.Add([new Position(2, 0), new Position(-2, 1), new Position(0, 1)]);list.Add([new Position(-2, -1), new Position(-2, 0), new Position(0, 1)]);list.Add([new Position(0, -1), new Position(2, -1), new Position(-2, 0)]);break;case E_DrawType.Right_Ladder:list.Add([new Position(0, -1), new Position(-2, 0), new Position(-2, 1)]);list.Add([new Position(-2, -1), new Position(0, -1), new Position(2, 0)]);list.Add([new Position(2, -1), new Position(2, 0), new Position(0, 1)]);list.Add([new Position(-2, 0), new Position(0, 1), new Position(2, 1)]);break;case E_DrawType.Left_Long_ladder:list.Add([new Position(-2, -1), new Position(0, -1), new Position(0, 1)]);list.Add([new Position(2, 1), new Position(-2, 0), new Position(2, 0)]);list.Add([new Position(0, -1), new Position(0, 1), new Position(2, 1)]);list.Add([new Position(-2, 0), new Position(2, 0), new Position(-2, 1)]);break;case E_DrawType.Right_Long_ladder:list.Add([new Position(0, -1), new Position(2, -1), new Position(0, 1)]);list.Add([new Position(-2, 0), new Position(2, 1), new Position(2, 0)]);list.Add([new Position(0, -1), new Position(0, 1), new Position(-2, 1)]);list.Add([new Position(-2, 0), new Position(2, 0), new Position(-2, -1)]);break;default:break;}}public Position[] this[int index]{get{if (index < 0)return list[0];else if (index >= list.Count)return list[list.Count - 1];elsereturn list[index];}}public int Count { get => list.Count; }}
}

Test5_板砖工人类

BlockWorker.cs
namespace CSharp俄罗斯方块
{enum E_Change_Type{Left,Right,}internal class BlockWorker : IDraw{//方块们private List<DrawObject> blocks;//用Dictionary方便查找private Dictionary<E_DrawType, BlockInfo> blockInfoDic;//随机创建的方块具体形态信息private BlockInfo nowBlockInfo;//当前形态的索引private int nowInfoIndex;public BlockWorker(){blockInfoDic = new Dictionary<E_DrawType, BlockInfo>(){{ E_DrawType.Cube,new BlockInfo(E_DrawType.Cube)},{ E_DrawType.Line,new BlockInfo(E_DrawType.Line)},{ E_DrawType.Tank,new BlockInfo(E_DrawType.Tank)},{ E_DrawType.Left_Ladder,new BlockInfo(E_DrawType.Left_Ladder)},{ E_DrawType.Right_Ladder,new BlockInfo(E_DrawType.Right_Ladder)},{ E_DrawType.Left_Long_ladder,new BlockInfo(E_DrawType.Left_Long_ladder)},{ E_DrawType.Right_Long_ladder,new BlockInfo(E_DrawType.Right_Long_ladder)},};RandomCreatBlock();}public void Draw(){for (int i = 0; i < blocks.Count; i++){blocks[i].Draw();}}/// <summary>/// 随机创建方块/// </summary>public void RandomCreatBlock(){Random r = new Random();E_DrawType type = (E_DrawType)r.Next(1, 8);blocks = new List<DrawObject>(){new DrawObject(type),new DrawObject(type),new DrawObject(type),new DrawObject(type),};//定义0,0相对坐标blocks[0].pos = new Position(24, -5);nowBlockInfo = blockInfoDic[type];//随机当前形态nowInfoIndex = r.Next(0, nowBlockInfo.Count);//取出原点坐标信息Position[] pos = nowBlockInfo[nowInfoIndex];for (int i = 0; i < pos.Length; i++){//通过原点坐标信息绘制四个方块blocks[i + 1].pos = pos[i] + blocks[0].pos;}}//擦除方法public void ClearDraw(){for (int i = 0; i < blocks.Count; i++){blocks[i].ClearDraw();}}/// <summary>/// 方块变形/// </summary>/// <param name="type">左,右</param>public void Change(E_Change_Type type){//擦除之前的方块ClearDraw();switch (type){case E_Change_Type.Left:nowInfoIndex--;if (nowInfoIndex < 0)nowInfoIndex = nowBlockInfo.Count - 1;break;case E_Change_Type.Right:nowInfoIndex++;if (nowInfoIndex >= nowBlockInfo.Count)nowInfoIndex = 0;break;}//得到索引,取出来Position[] pos = nowBlockInfo[nowInfoIndex];for (int i = 0; i < pos.Length; i++){blocks[i + 1].pos = pos[i] + blocks[0].pos;}//擦除之后绘制Draw();}/// <summary>/// 判断能否变形/// </summary>/// <param name="type">地图方向</param>/// <param name="map">地图墙壁</param>/// <returns></returns>public bool CanChange(E_Change_Type type, Map map){//临时变量用来模拟int nowIndex = nowInfoIndex;switch (type){case E_Change_Type.Left:nowIndex--;if (nowIndex < 0)nowIndex = nowBlockInfo.Count - 1;break;case E_Change_Type.Right:nowIndex++;if (nowIndex >= nowBlockInfo.Count)nowIndex = 0;break;}//临时索引信息判断是否和墙壁重合Position[] nowPos = nowBlockInfo[nowIndex];//判断是否超出地图边界Position tempPos;for (int i = 0; i < nowPos.Length; i++){tempPos = blocks[0].pos + nowPos[i];if (tempPos.x < 2 || tempPos.x >= Game.w - 2 || tempPos.y >= map.h){return false;}}//判断是否和其他方块重合for (int i = 0; i < nowPos.Length; i++){tempPos = blocks[0].pos + nowPos[i];for (int j = 0; j < map.dynamicWalls.Count; j++){if (tempPos == map.dynamicWalls[j].pos){return false;}}}return true;}/// <summary>/// 方块左右移动/// </summary>/// <param name="type">左,右</param>public void MoveR_L(E_Change_Type type){//移动之前擦除ClearDraw();//根据传入的类型,决定左右移动,得到偏移位置Position movePos = new Position(type == E_Change_Type.Left ? -2 : 2, 0);for (int i = 0; i < blocks.Count; i++){blocks[i].pos += movePos;}//移动之后绘制Draw();}/// <summary>/// 判断能否移动/// </summary>/// <param name="type">左,右移动</param>/// <returns></returns>public bool CanMoveR_L(E_Change_Type type, Map map){Position movePos = new Position(type == E_Change_Type.Left ? -2 : 2, 0);//左右边界重合,预判断posPosition pos;for (int i = 0; i < blocks.Count; i++){pos = blocks[i].pos + movePos;if (pos.x < 2 || pos.x >= Game.w - 2)return false;}//动态方块重合for (int i = 0; i < blocks.Count; i++){pos = blocks[i].pos + movePos;for (int j = 0; j < map.dynamicWalls.Count; j++){if (pos == map.dynamicWalls[j].pos)return false;}}return true;}//方块自动下落public void AutoMove(){ClearDraw();Position downMove = new Position(0, 1);for (int i = 0; i < blocks.Count; i++){blocks[i].pos += downMove;}Draw();}public bool CanDown(Map map){Position downPos = new Position(0, 1);//预下落位置Position pos;//边界for (int i = 0; i < blocks.Count; i++){pos = blocks[i].pos + downPos;if (pos.y >= map.h){//碰到地图,此时变成地图的一部分map.AddWalls(blocks);//创建新的随机方块RandomCreatBlock();return false;}}//动态方块for (int i = 0; i < blocks.Count; i++){pos = blocks[i].pos + downPos;for (int j = 0; j < map.dynamicWalls.Count; j++){if (pos == map.dynamicWalls[j].pos){//碰到方块,此时变成地图的一部分map.AddWalls(blocks);RandomCreatBlock();return false;}}}return true;}}
}

Test6_输入模块

InputThread.cs
namespace CSharp俄罗斯方块
{internal class InputThread{//线程成员变量Thread inputThread;//输入检测事件public event Action inputEvent;private static InputThread instance = new InputThread();public static InputThread Instance{get{return instance;}}private InputThread(){ inputThread = new Thread(InputCheck);inputThread.IsBackground = true;inputThread.Start();}private void InputCheck(){while (true){inputEvent?.Invoke();}}}
}

Program.cs

using CSharp俄罗斯方块;Game game = new Game();
game.start();

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

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

相关文章

04_前端三大件JS

文章目录 JavaScript1.JS的组成部分2.JS引入2.1 直接在head中通过一对script标签定义脚本代码2.2创建JS函数池文件&#xff0c;所有html文件共享调用 3.JS的数据类型和运算符4.分支结构5.循环结构6.JS函数的声明7.JS中自定义对象8.JS_JSON在客户端使用8.1JSON串格式8.2JSON在前…

Python与OpenCV:图像处理与计算机视觉实战指南

前言 OpenCV&#xff08;Open Source Computer Vision Library&#xff09;是一个开源的计算机视觉和机器学习软件库&#xff0c;它包含了数百种计算机视觉算法&#xff0c;包括图像处理、视频分析、物体检测、面部识别等。结合Python语言的强大功能&#xff0c;OpenCV可以用于…

java医院管理系统源码(springboot+vue+mysql)

风定落花生&#xff0c;歌声逐流水&#xff0c;大家好我是风歌&#xff0c;混迹在java圈的辛苦码农。今天要和大家聊的是一款基于springboot的医院管理系统。项目源码以及部署相关请联系风歌&#xff0c;文末附上联系信息 。 项目简介&#xff1a; 医院管理系统的主要使用者分…

【AJAX前端框架】Asynchronous Javascript And Xml

1 传统请求及缺点 传统的请求都有哪些&#xff1f; 直接在浏览器地址栏上输入URL。点击超链接提交form表单使用JS代码发送请求 window.open(url)document.location.href urlwindow.location.href url… 传统请求存在的问题 页面全部刷新导致了用户的体验较差。传统的请求导…

Android15 Beta更新速览

Android15 Beta更新速览 前台服务变更 前台服务使应用保持活动状态&#xff0c;以便它们可以执行关键且对用户可见的操作&#xff0c;通常以牺牲电池寿命为代价。在 Android 15 Beta 2 中&#xff0c;dataSync 和 mediaProcessing 前台服务类型现在具有约 6 小时的超时时间&a…

Python 植物大战僵尸

文章目录 效果图项目结构实现思路源代码 效果图 项目结构 实现思路 下面是代码的实现思路&#xff1a; 导入必要的库和模块&#xff1a;首先&#xff0c;我们导入了Python的os、time库以及pygame库&#xff0c;还有植物大战僵尸游戏中用到的各个植物和僵尸的类。 初始化游戏和…

AI写作工具的革命:AIGC如何提升内容生产效率

AIGC&#xff0c;即人工智能生成内容&#xff0c;是一种新兴的内容生产方式&#xff0c;它利用人工智能技术来自动生成文本、图像、音频、视频等多种形式的内容即进入实际应用层面。 所以AI不再是高深的、让人望尘莫及的算力算法&#xff0c;而是真实地贴近了我们的生活&#…

VectorDBBench在windows的调试

VectorDBBench在windows的调试 VectorDBBench是一款向量数据库基准测试工具&#xff0c;支持milvus、Zilliz Cloud、Elastic Search、Qdrant Cloud、Weaviate Cloud 、 PgVector、PgVectorRS等&#xff0c;可以测试其QPS、时延、recall。 VectorDBBench是一款使用python编写的…

鸿蒙ArkUI-X跨语言调用说明:【平台桥接(@arkui-x.bridge)】

平台桥接(arkui-x.bridge) 简介 平台桥接用于客户端&#xff08;ArkUI&#xff09;和平台&#xff08;Android或iOS&#xff09;之间传递消息&#xff0c;即用于ArkUI与平台双向数据传递、ArkUI侧调用平台的方法、平台调用ArkUI侧的方法。 以Android平台为例&#xff0c;Ark…

OM电商系统asp.net

OM电商系统&#xff0c;可以让顾客全面了解商品的详细信息&#xff0c;消除网上购物的信息不对称问题。通过商品分类来组织众多的商品&#xff0c;方便顾客找到所需要的商品。提供客服顾客互动机制&#xff0c;提高顾客的参与度。通过设计合理的订单处理流程&#xff0c;提高顾…

第一个Flutter3项目

配置flutter国内源 首先&#xff0c;配置flutter的国内源&#xff1a; env:PUB_HOSTED_URL"https://pub.flutter-io.cn"; env:FLUTTER_STORAGE_BASE_URL"https://storage.flutter-io.cn"配置gradle国内源 修改gradle\wrapper\gradle-wrapper.properties…

使用Python操作Jenkins

大家好&#xff0c;Python作为一种简洁、灵活且功能丰富的编程语言&#xff0c;可以与各种API轻松集成&#xff0c;Jenkins的API也不例外。借助于Python中的python-jenkins模块&#xff0c;我们可以轻松地编写脚本来连接到Jenkins服务器&#xff0c;并执行各种操作&#xff0c;…

MySQL触发器实战:自动执行的秘密

欢迎来到我的博客&#xff0c;代码的世界里&#xff0c;每一行都是一个故事 &#x1f38f;&#xff1a;你只管努力&#xff0c;剩下的交给时间 &#x1f3e0; &#xff1a;小破站 MySQL触发器实战&#xff1a;自动执行的秘密 前言触发器的定义和作用触发器的定义和作用触发器的…

PostgreSQL发展史

PostgreSQL是一个开源的对象-关系型数据库管理系统&#xff08;ORDBMS&#xff09;&#xff0c;其历史可以追溯到上世纪80年代。以下是对PostgreSQL发展史的深入解析&#xff1a; 1980年代&#xff1a;起源 1.Ingres 项目 1977年&#xff0c;Michael Stonebraker 和他的团队…

怎样消除工人们对六西格玛培训的抵触情绪?

近年来&#xff0c;企业为了提高产品质量、优化生产流程&#xff0c;纷纷引入了六西格玛管理方法。然而&#xff0c;在实施过程中&#xff0c;不少企业却遭遇了工人们对六西格玛培训的抵触情绪。这种情绪的存在不仅阻碍了六西格玛的推广和应用&#xff0c;也影响了企业的整体运…

Java | Leetcode Java题解之第102题二叉树的层序遍历

题目&#xff1a; 题解&#xff1a; class Solution {public List<List<Integer>> levelOrder(TreeNode root) {Queue<TreeNode> queue new LinkedList<>();List<List<Integer>> res new ArrayList<>();if (root ! null) queue.a…

1104. 二叉树寻路

1104. 二叉树寻路 原题链接&#xff1a;完成情况&#xff1a;解题思路&#xff1a;参考代码&#xff1a;_1104二叉树寻路 错误经验吸取 原题链接&#xff1a; 1104. 二叉树寻路 https://leetcode.cn/problems/path-in-zigzag-labelled-binary-tree/description/ 完成情况&a…

【系统架构师】-案例篇(十五)SOA、微服务与数据库

1、可复用构件应具备哪些属性 可用性&#xff1a;构件必须易于理解和使用。 质量&#xff1a;构件及其变形必须能正确工作。 适应性&#xff1a;构件应该易于通过参数化等方式在不同语境中进行配置。 可移植性&#xff1a;构件应能在不同的硬件运行平台和软件环境中工作。 可变…

用WPS将多张图片生成一个pdf文档,注意参数设置

目录 1 新建一个docx格式的文档 2 向文档中插入图片 3 设置页边距 4 设置图片大小 5 导出为pdf格式 需要把十几张图片合并为一个pdf文件&#xff0c;本以为很简单&#xff0c;迅速从网上找到两个号称免费的在线工具&#xff0c;结果浪费了好几分钟时间&#xff0c;发现需要…

文本匹配.grep与Select-String用法对比

Linux Shell与PowerShell上匹配字符串 grep与Select-String用法对比 - 文章信息 - Author: 李俊才 (jcLee95) Visit me at CSDN: https://jclee95.blog.csdn.netMy WebSite&#xff1a;http://thispage.tech/Email: 291148484163.com. Shenzhen ChinaAddress of this article…