当前位置: 首页 > news >正文

网站建设 康盛设计/沈阳疫情最新消息

网站建设 康盛设计,沈阳疫情最新消息,广州优化网站建设,郑州树标网站建设C#三人飞行棋 #region 1控制台设置int w 50, h 30; ConsoleInit(w, h); #endregion#region 2 场景选择实例//声明一个表示场景标识的变量 E_SceneType nowSceneType new E_SceneType(); while (true) {switch (nowSceneType){case E_SceneType.Begion://开始场景逻辑Consol…

C#三人飞行棋

#region 1控制台设置int w = 50, h = 30;
ConsoleInit(w, h);
#endregion#region 2 场景选择实例//声明一个表示场景标识的变量
E_SceneType nowSceneType = new E_SceneType();
while (true)
{switch (nowSceneType){case E_SceneType.Begion://开始场景逻辑Console.Clear();BeginOrEndScene(w, h,ref nowSceneType);break;case E_SceneType.Game://游戏场景逻辑Console.Clear();GameScene(w, h,ref nowSceneType);break;case E_SceneType.End://结束场景逻辑Console.Clear();BeginOrEndScene(w, h, ref nowSceneType);break;default:break;}
}#endregion#region 1 控制台初始化
static void ConsoleInit(int w, int h)
{//基础设置//光标设置Console.CursorVisible = false;//舞台大小Console.SetWindowSize(w, h);Console.SetBufferSize(w, h);
}#endregion#region 3 开始场景逻辑static void BeginOrEndScene(int w, int h, ref E_SceneType nowSceneType)
{Console.ForegroundColor = ConsoleColor.White;Console.SetCursorPosition(nowSceneType == E_SceneType.Begion ? w / 2 - 3 : w / 2 - 4, 8);Console.Write(nowSceneType==E_SceneType.Begion ? "飞行棋" : "结束游戏");//默认开始游戏int nowSelIndex = 0;bool isQuitBegin = false;while (true){Console.SetCursorPosition(nowSceneType == E_SceneType.Begion ? w / 2 - 4 : w / 2 - 5, 13);Console.ForegroundColor = nowSelIndex == 0 ? ConsoleColor.Red : ConsoleColor.White;Console.Write(nowSceneType == E_SceneType.Begion ? "开始游戏" : "游戏主菜单");Console.ForegroundColor = nowSelIndex == 1 ? ConsoleColor.Red : ConsoleColor.White;Console.SetCursorPosition(w / 2 - 4, 15);Console.Write("退出游戏");//通过Readkey可以得到一个输入的枚举类型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:if (nowSelIndex == 0){nowSceneType = nowSceneType == E_SceneType.Begion ? E_SceneType.Game : E_SceneType.Begion;isQuitBegin = true;}else{Environment.Exit(0);}break;}if (isQuitBegin){break;}}
}
#endregion#region 4 游戏场景逻辑
static void GameScene(int w, int h,ref E_SceneType nowSceneType)
{DrawWall(w, h);//Grid grid = new Grid(5,5,E_Grid_Type.Boom);//grid.Draw();//绘制地图Map map = new Map(10,3,111);map.Draw();//绘制玩家Player player1 = new Player(0,E_Player_Type.Player1);Player player2 = new Player(0,E_Player_Type.Player2);Player computer =new Player(0,E_Player_Type.Computer);DrawPlayer(player1,player2,computer,map);bool isGameOver=false;while (true){Console.ReadKey(true);isGameOver = RandomMove(w,h,ref player1,ref player2,ref computer,map);map.Draw();DrawPlayer(player1, player2, computer, map);if (isGameOver){Console.ReadKey(true);nowSceneType = E_SceneType.End;break;}Console.ReadKey(true);isGameOver = RandomMove(w, h, ref player2, ref player1, ref computer, map);map.Draw();DrawPlayer(player1, player2, computer, map);if (isGameOver){Console.ReadKey(true);nowSceneType = E_SceneType.End;break;}Console.ReadKey(true);isGameOver = RandomMove(w, h, ref computer, ref player1, ref player2, map);map.Draw();DrawPlayer(player1, player2, computer, map);if (isGameOver){Console.ReadKey(true);nowSceneType = E_SceneType.End;break;}}
}#endregion#region 4 绘制不变内容(红墙 提示等)static void DrawWall(int w, int h)
{Console.ForegroundColor = ConsoleColor.Red;for (int i = 0; i < w; i += 2){Console.SetCursorPosition(i, 0);Console.Write("■");Console.SetCursorPosition(i, h - 1);Console.Write("■");Console.SetCursorPosition(i, h-6);Console.Write("■");Console.SetCursorPosition(i, h-11);Console.Write("■");}for (int i = 0; i < h; i++){Console.SetCursorPosition(0, i);Console.Write("■");Console.SetCursorPosition(w - 2, i);Console.Write("■");}//样式●■★◎ ▲ ◆ ⊙ ¤Console.ForegroundColor = ConsoleColor.White;Console.SetCursorPosition(2,h-10);Console.Write("□:普通格子");Console.ForegroundColor = ConsoleColor.Gray  ;Console.SetCursorPosition(22, h - 10);Console.Write("◆:玩家3");Console.ForegroundColor = ConsoleColor.Blue;Console.SetCursorPosition(2, h - 9);Console.Write("⊙:暂停,一回合不动");Console.ForegroundColor = ConsoleColor.DarkRed;Console.SetCursorPosition(26, h - 9);Console.Write("●:炸弹,倒退5格");Console.ForegroundColor = ConsoleColor.White;Console.SetCursorPosition(2, h - 8);Console.Write("¤:时空隧道,随机倒退,前进,暂停");Console.ForegroundColor = ConsoleColor.Cyan;Console.SetCursorPosition(2, h - 7);Console.Write("★:玩家");Console.ForegroundColor = ConsoleColor.Magenta;Console.SetCursorPosition(12, h - 7);Console.Write("▲:玩家2");///Console.ForegroundColor = ConsoleColor.Yellow;Console.SetCursorPosition(22, h - 7);Console.Write("◎:玩家和电脑重合");Console.ForegroundColor = ConsoleColor.White;Console.SetCursorPosition(2, h - 5);Console.Write("按任意键开始扔骰子");}#endregion#region 8 扔骰子 函数
static void ClearInfo(int w,int h)
{Console.SetCursorPosition(2, h - 5);Console.Write("                                        ");Console.SetCursorPosition(2, h - 4);Console.Write("                                        ");Console.SetCursorPosition(2, h - 3);Console.Write("                                        ");Console.SetCursorPosition(2, h - 2);Console.Write("                                        ");
}
static bool RandomMove(int w, int h, ref Player p, ref Player p2,ref Player c, Map map)
{ClearInfo(w,h);if (p.type == E_Player_Type.Player1){Console.ForegroundColor = ConsoleColor.Cyan;}else if (p.type == E_Player_Type.Player2){Console.ForegroundColor = ConsoleColor.Magenta;}else{Console.ForegroundColor = ConsoleColor.Gray;}if (p.isPause){Console.SetCursorPosition(2,h-5);if (p.type == E_Player_Type.Player1){Console.Write("玩家1处于暂停点,玩家1需要暂停一回合");}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2处于暂停点,玩家2需要暂停一回合");}else{Console.Write("玩家3处于暂停点,玩家3需要暂停一回合");}p.isPause = false;return false;}Random r = new Random();int randomNum = r.Next(1, 7);p.nowIndex += randomNum;Console.SetCursorPosition(2,h-5);if (p.type == E_Player_Type.Player1){Console.Write("玩家1扔出的点数为:"+randomNum);}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2扔出的点数为:"+randomNum);}else{Console.Write("玩家3扔出的点数为:" + randomNum);}if (p.nowIndex >= map.grids.Length - 1){p.nowIndex = map.grids.Length - 1;Console.SetCursorPosition(2, h - 4);if (p.type == E_Player_Type.Player1){Console.Write("玩家1获胜");Console.SetCursorPosition(2, h - 3);Console.Write("按任意键结束游戏");return true;}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2获胜");Console.SetCursorPosition(2, h - 3);Console.Write("按任意键结束游戏");return true;}else{Console.Write("玩家3获胜");Console.SetCursorPosition(2, h - 3);Console.Write("按任意键结束游戏");return true;}return true;}else{Grid grid = map.grids[p.nowIndex];switch (grid.type){case E_Grid_Type.Normal:Console.SetCursorPosition(2,h-4);if (p.type == E_Player_Type.Player1){Console.Write("玩家1处于安全位置");}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2处于安全位置");}else{Console.Write("玩家3处于安全位置");}Console.SetCursorPosition(2, h - 3);if (p.type == E_Player_Type.Player1){Console.Write("请按任意键,玩家2开始仍骰子");}else if (p.type == E_Player_Type.Player2){Console.Write("请按任意键,玩家3开始仍骰子");}else{Console.Write("请按任意键,玩家1开始仍骰子");}break;case E_Grid_Type.Boom://炸弹退格p.nowIndex -= 5;if (p.nowIndex < 0){p.nowIndex = 0;}Console.SetCursorPosition(2, h - 4);if (p.type == E_Player_Type.Player1){Console.Write("玩家1踩到了炸弹,退后5格");}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2踩到了炸弹,退后5格");}else{Console.Write("玩家3踩到了炸弹,退后5格");}Console.SetCursorPosition(2, h - 3);if (p.type == E_Player_Type.Player1){Console.Write("请按任意键,玩家2开始仍骰子");}else if (p.type == E_Player_Type.Player2){Console.Write("请按任意键,玩家3开始仍骰子");}else{Console.Write("请按任意键,玩家1开始仍骰子");}break;case E_Grid_Type.Pause://暂停一回合p.isPause = true;Console.SetCursorPosition(2, h - 4);if (p.type == E_Player_Type.Player1){Console.Write("玩家1暂停一回合");}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2暂停一回合");}else{Console.Write("玩家3暂停一回合");}Console.SetCursorPosition(2, h - 3);if (p.type == E_Player_Type.Player1){Console.Write("请按任意键,玩家2开始仍骰子");}else if (p.type == E_Player_Type.Player2){Console.Write("请按任意键,玩家3开始仍骰子");}else{Console.Write("请按任意键,玩家1开始仍骰子");}break;case E_Grid_Type.Tunnel:Console.SetCursorPosition(2, h - 4);if (p.type == E_Player_Type.Player1){Console.Write("玩家1进入了时空隧道");}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2进入了时空隧道");}else{Console.Write("玩家3进入了时空隧道");}//随机randomNum = r.Next(1,91);if (randomNum<30){p.nowIndex -= 5;if(p.nowIndex < 0){p.nowIndex = 0;}Console.SetCursorPosition(2, h - 3);if (p.type == E_Player_Type.Player1){Console.Write("玩家1退5格");}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2退5格");}else{Console.Write("玩家3退5格");}}else if (randomNum <= 60){p.isPause = true;Console.SetCursorPosition(2, h - 3);if (p.type == E_Player_Type.Player1){Console.Write("玩家1暂停一回合");}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2暂停一回合");}else{Console.Write("玩家3暂停一回合");}}else{p.nowIndex += 3;if(p.nowIndex >= map.grids.Length - 1){p.nowIndex = map.grids.Length - 2;}Console.SetCursorPosition(2, h - 3);if (p.type == E_Player_Type.Player1){Console.Write("玩家1前进格3格");}else if (p.type == E_Player_Type.Player2){Console.Write("玩家2前进格3格");}else{Console.Write("玩家3前进格3格");}}Console.SetCursorPosition(2, h - 2);if (p.type == E_Player_Type.Player1){Console.Write("请按任意键,玩家2开始仍骰子");}else if (p.type == E_Player_Type.Player2){Console.Write("请按任意键,玩家3开始仍骰子");}else{Console.Write("请按任意键,玩家1开始仍骰子");}break;default:break;}}return false;
}#endregion#region 7 绘制玩家
static void DrawPlayer(Player player1,Player player2,Player computer,Map map)
{if (player1.nowIndex == computer.nowIndex && player1.nowIndex == player2.nowIndex && player2.nowIndex == computer.nowIndex){Grid grid = map.grids[player2.nowIndex];Console.ForegroundColor = ConsoleColor.Yellow;Console.SetCursorPosition(grid.pos.x, grid.pos.y);Console.Write("◎");}else if (player1.nowIndex == computer.nowIndex){Grid grid = map.grids[player1.nowIndex];Console.ForegroundColor = ConsoleColor.Yellow;Console.SetCursorPosition(grid.pos.x, grid.pos.y);Console.Write("◎");player2.Draw(map);}else if (player1.nowIndex == player2.nowIndex){Grid grid = map.grids[player1.nowIndex];Console.ForegroundColor = ConsoleColor.Yellow;Console.SetCursorPosition(grid.pos.x, grid.pos.y);Console.Write("◎");computer.Draw(map);}else if (player2.nowIndex == computer.nowIndex){Grid grid = map.grids[player2.nowIndex];Console.ForegroundColor = ConsoleColor.Yellow;Console.SetCursorPosition(grid.pos.x, grid.pos.y);Console.Write("◎");player1.Draw(map);}else{player1.Draw(map);player2.Draw(map);computer.Draw(map);}
}
#endregion#region 2 场景选择设置
/// <summary>
/// 游戏场景枚举类型
/// </summary>
enum E_SceneType
{/// <summary>/// 开始场景/// </summary>Begion,/// <summary>/// 游戏场景/// </summary>Game,/// <summary>/// 结束场景/// </summary>End,
}
#endregion#region 5 格子结构体和格子枚举
/// <summary>
/// 格子类型 枚举
/// </summary>
enum E_Grid_Type
{/// <summary>/// 普通格子/// </summary>Normal,/// <summary>/// 炸弹/// </summary>Boom,/// <summary>/// 暂停/// </summary>Pause,/// <summary>/// 时空隧道/// </summary>Tunnel,
}struct Vector2
{public int x;public int y;public Vector2(int x, int y){this.x = x; this.y = y;}
}
struct Grid
{//格子类型public E_Grid_Type type;//格子位置public Vector2 pos;//初始化构造函数public Grid(int x,int y,E_Grid_Type type){pos.x = x; pos.y = y;this.type = type;}public void Draw(){Console.SetCursorPosition(pos.x, pos.y);switch (type){case E_Grid_Type.Normal:Console.ForegroundColor= ConsoleColor.White;Console.Write("□");break;case E_Grid_Type.Boom:Console.ForegroundColor = ConsoleColor.DarkRed;Console.Write("●");break;case E_Grid_Type.Pause:Console.ForegroundColor = ConsoleColor.Blue;Console.Write("⊙");break;case E_Grid_Type.Tunnel:Console.ForegroundColor = ConsoleColor.White;Console.Write("¤");break;default:break;}}
}#endregion#region 6 地图结构体struct Map
{public Grid[] grids;public Map(int x,int y,int num){grids = new Grid[num];//用于位置改变计数的变量int indexX = 0, indexY = 0, stepNum = 2;    //x的步长Random random = new Random();int randomNum;for (int i = 0; i < num; i++){randomNum = random.Next(0, 101);if (randomNum < 85 || i == 0 || i == num - 1){grids[i].type = E_Grid_Type.Normal;}else if (randomNum>=85 && randomNum<90){grids[i].type = E_Grid_Type.Boom;}else if (randomNum >=90 && randomNum<95){grids[i].type = E_Grid_Type.Pause;}else{grids[i].type = E_Grid_Type.Tunnel;}grids[i].pos = new Vector2(x, y);if (indexX ==14){y += 1;++indexY;if (indexY ==2){indexX = 0;indexY = 0;stepNum = -stepNum; //反向步长}}else{x += stepNum;++indexX;}}}public void Draw(){for (int i = 0; i < grids.Length; i++){grids[i].Draw();}}
}#endregion#region 7 玩家枚举和玩家结构体
enum E_Player_Type
{/// <summary>/// 玩家1/// </summary>Player1,/// <summary>/// 玩家2/// </summary>Player2,/// <summary>/// 电脑/// </summary>Computer,
}struct Player
{public E_Player_Type type;public int nowIndex;public bool isPause; public Player(int index,E_Player_Type type){nowIndex = index;this.type = type;isPause = false;}public void Draw(Map mapInfo){Grid grid = mapInfo.grids[nowIndex];Console.SetCursorPosition(grid.pos.x, grid.pos.y);switch (type){case E_Player_Type.Player1:Console.ForegroundColor = ConsoleColor.Cyan;Console.Write("★");break;case E_Player_Type.Player2:Console.ForegroundColor = ConsoleColor.Magenta;Console.Write("▲");break;case E_Player_Type.Computer:Console.ForegroundColor = ConsoleColor.Gray;Console.Write("◆");break;default:break;}}
}
#endregion

相关文章:

C#三人飞行棋

C#三人飞行棋 #region 1控制台设置int w 50, h 30; ConsoleInit(w, h); #endregion#region 2 场景选择实例//声明一个表示场景标识的变量 E_SceneType nowSceneType new E_SceneType(); while (true) {switch (nowSceneType){case E_SceneType.Begion://开始场景逻辑Consol…...

Notes for the missing semester. Useful and basic knowledge about Linux.

The Shell Contents The first course is to introduce some simple commands. I’ll list some commands that I’m not familiar with: # --silent means dont give log info, # --head means we only want the http head. curl --head --silent bing.com.cn# cut --deli…...

【信息系统项目管理师知识点速记】资源管理基础

项目团队 执行项目工作,实现项目目标的一组人员。成员具备不同技能,可全职或兼职,随项目进展而变化。参与项目规划和决策,贡献专业技能,增强对项目的责任感。项目管理团队 直接参与项目管理活动的成员,负责项目管理和领导。负责项目各阶段的启动、规划、执行、监督、控制…...

Android性能优化面试题汇总

Android的性能优化涉及多个方面,如启动优化、稳定性优化、内存优化、网络优化、电量优化、安全优化等方面。 一、稳定性优化 1.1 你们做了哪些稳定性方面的优化 随着项目的逐渐成熟,用户基数逐渐增多,DAU持续升高,我们遇到了很多稳定性方面的问题,对于我们技术同学遇到…...

Ansible 自动化运维工具 - 了解和模块应用

目录 一. Ansible 的相关知识 1.1 Ansible 工具的简介 1.2 Ansible的四大组件 1.3 运维自动化工具 1.4 Ansible 和其它自动化运维工具对比 1.5 Ansible 的优缺点 二. Ansible 环境安装部署 2.1 管理端安装 ansible 2.2 配置主机清单 三. ansible 命令行模块 3.1 comm…...

AI神助攻!小白也能制作自动重命名工具~

我们平时从网上下载一些文件&#xff0c;文件名很多都是一大串字母和数字&#xff0c;不打开看看&#xff0c;根本不知道里面是什么内容。 我想能不能做个工具&#xff0c;把我们一个文件夹下面的所有word、excel、ppt、pdf文件重命名为文件内容的第一行。 我们有些朋友可能不会…...

(读书笔记-大模型) LLM Powered Autonomous Agents

目录 智能体系统的概念 规划组件 记忆组件 工具组件 案例研究 智能体系统的概念 在大语言模型&#xff08;LLM&#xff09;赋能的自主智能体系统中&#xff0c;LLM 充当了智能体的大脑&#xff0c;其三个关键组件分别如下&#xff1a; 首先是规划&#xff0c;它又分为以下…...

超分辨率重建——BSRN网络训练自己数据集并推理测试(详细图文教程)

目录 一、BSRN网络总结二、源码包准备三、环境准备3.1 报错KeyError: "No object named BSRN found in arch registry!"3.2 安装basicsr源码包3.3 参考环境 四、数据集准备五、训练5.1 配置文件参数修改5.2 启动训练5.2.1 命令方式训练5.2.2 配置Configuration方式训…...

C语言实现贪吃蛇

目录 前言一 . 游戏背景1. 背景介绍2. 项目目标3. 技术要点 二 . 效果演示三 . 游戏的设计与分析1. 核心逻辑2. 设计与分析游戏开始Gamestart()函数游戏运行Gamerun()函数游戏结束Gameend()函数 四 . 参考代码五 . 总结 前言 本文旨在使用C语言和基础数据结构链表来实现贪吃蛇…...

高可用系列四:loadbalancer 负载均衡

负载均衡可以单独使用&#xff0c;也常常与注册中心结合起来使用&#xff0c;其需要解决的问题是流量分发&#xff0c;这是就需要定义分发策略&#xff0c;当然也包括了故障切换的能力。 故障切换 故障切换是负载均衡的基本能力&#xff0c;和注册中心结合时比较简单&#xf…...

Ruby递归目录文件的又一种方法

经常派得上用场&#xff0c;记录一下。 递归文件做一些操作 #encoding:utf-8require pathnamedef recursive_enum_files(from_path)from_path Pathname.new(from_path)raise ArgumentError,must start at a directory. unless from_path.directory?from_path.enum_for(:fin…...

【爬虫】爬取A股数据写入数据库(一)

1. 对东方财富官网的分析 步骤&#xff1a; 通过刷新网页&#xff0c;点击等操作&#xff0c;我们发现https://datacenter-web.eastmoney.com/api/data/v1/get?请求后面带着一些参数即可以获取到相应数据。我们使用python来模拟这个请求即可。 我们以如下选择的页面为切入点…...

1-38 流资源类结构

一 简介 1. Java中所说的流资源--IO流 2.为什么学习留资源&#xff1f; --要操作文件中的数据 将数据写入指定的文件 将数据从指定的文件读取 3.分类 -- 四大基流 , 八大子流 (重点) 按照流向分 : 输入流 和输出流 按照操作数据资源的类型划分 字符流 (重点) Reader -- 字符…...

nginx的前世今生(二)

书接上回&#xff1a; 上回书说到&#xff0c;nginx的前世今生&#xff0c;这回我们继续说 3.缓冲秘籍&#xff0c;洪流控水 Nginx的缓冲区是其处理数据传输和提高性能的关键设计之一&#xff0c;主要用于暂存和管理进出的数据流&#xff0c;以应对不同组件间速度不匹配的问题…...

浏览器跨域详解

一、什么是跨域 浏览器跨域是指当一个Web应用程序试图访问另一个协议、主机或端口不同的资源时&#xff0c;所发生的情况。这主要是由于浏览器的同源策略造成的&#xff0c;它是为了网站的安全而设置的安全限制&#xff0c;防止一个网站恶意访问另一个网站的资源。当然这是比较…...

华为5700配置

恢复出厂设置&#xff0c;清空配置 1、更改名字 system-view sysname tp-10-50-01-04 2、配置管理接口 int vlan 1 ip add 10.50.1.4 255.255.254.0 quit 2、链路汇聚 interface eth-trunk 1 mode lacp quit 3、绑定端口 interface eth-trunk 1 trunkport gigabitethernet …...

使用Axios从前端上传文件并且下载后端返回的文件

前端代码&#xff1a; function uploadAndDownload(){showLoading();const fileInput document.querySelector(#uploadFile);const file fileInput.files[0];const formData new FormData()formData.append(file, file)return new Promise((resolve, reject) > {axios({…...

open 函数到底做了什么

使用设备之前我们通常都需要调用 open 函数&#xff0c;这个函数一般用于设备专有数据的初始化&#xff0c;申请相关资源及进行设备的初始化等工作&#xff0c;对于简单的设备而言&#xff0c;open 函数可以不做具体的工作&#xff0c;你在应用层通过系统调用 open 打开设备…...

ue引擎游戏开发笔记(32)——为游戏添加新武器装备

1.需求分析&#xff1a; 游戏中角色不会只有一种武器&#xff0c;不同武器需要不同模型&#xff0c;甚至可能需要角色持握武器的不同位置&#xff0c;因此需要添加专门的武器类&#xff0c;方便武器后续更新&#xff0c;建立一个武器类。 2.操作实现&#xff1a; 1.在ue5中新建…...

【个人博客搭建】(17)使用FluentValidation 参数校验

FluentValidation 是一个用于 .NET 的开源验证库&#xff0c;它提供了一种流畅的接口和强类型验证规则&#xff0c;使得验证逻辑表达得更加清晰和简洁。&#xff08;Apache-2.0&#xff09; FluentValidation 的主要作用包括&#xff1a; 提高代码可读性&#xff1a;通过使用 F…...

数据结构===散列表

文章目录 概要散列思想散列函数散列冲突开放寻址法装载因子 链表法 代码Java小结 概要 散列表是一种很有趣的数据结构。 散列表是一个很有用的数据结构。它是数组演练而来的&#xff0c;又是一个基于数组的扩展的数据结构。接下来看看。 散列思想 散列表用的是数组支持按照下…...

10G MAC层设计系列-(2)MAC RX模块

一、概述 MAC RX模块的需要进行解码、对齐、CRC校验。 因为在空闲的时候10G PCS/PMA会一直向外吐空闲符&#xff08;x07&#xff09;所以需要根据开始符、结束符将有效数据从码流中截取&#xff0c;也就是解码。 因为开始字符的所在位置有两种形式&#xff0c;而结束字符的位…...

解码Starknet Verifier:深入逆向工程之旅

1. 引言 Sandstorm为&#xff1a; 能提交独立proof给StarkWare的Ethereum Verifier&#xff0c;的首个开源的STARK prover。 开源代码见&#xff1a; https://github.com/andrewmilson/sandstorm&#xff08;Rust&#xff09; L2Beat 提供了以太坊上Starknet的合约架构图&…...

【C++语言】类和对象--默认成员函数 (中)

文章目录 前言类的六个默认成员函数&#xff1a;1. 构造函数概念特性做了什么&#xff1f;易错注意&#xff1a;显式定义和默认构造函数 2. 析构函数概念特征做了什么?注意事项&#xff1a; 3.拷贝构造函数概念特征做了什么&#xff1f;注意事项&#xff1a; 4.赋值运算符重载…...

前端递归常见应用

概览 在 JavaScript 中&#xff0c;递归是一种编程技术&#xff0c;指的是函数直接或间接调用自身的过程。 递归通常用于解决可以分解为相同子问题的问题。通过不断地将问题分解成更小的、相似的子问题&#xff0c;直到达到某种基本情况&#xff08;不再需要进一步递归的简单情…...

AI工具如何改变我们的工作与生活

AI工具在当今社会中扮演着越来越重要的角色&#xff0c;它们已经开始改变着我们的工作方式和生活方式。在接下来的2000字篇幅中&#xff0c;我将详细探讨AI工具如何影响我们的工作和生活。 AI工具在工作中的影响&#xff1a; 自动化和智能化生产流程&#xff1a; AI工具可以通…...

深入了解C/C++的内存区域划分

&#x1f525;个人主页&#xff1a;北辰水墨 &#x1f525;专栏&#xff1a;C学习仓 本节我们来讲解C/C的内存区域划分&#xff0c;文末会附加一道题目来检验成果&#xff08;有参考答案&#xff09; 一、大体有哪些区域&#xff1f;分别存放什么变量开辟的空间&#xff1f; …...

C++构造函数和析构函数的调用顺序

一般情况下&#xff0c;调用析构函数的次序正好与调用构造函数的次序相反&#xff0c;也就是最先被调用的构造函数&#xff0c;其对应的析构函数最后被调用&#xff0c;而最后被调用的构造函数&#xff0c;其对应的析构函数最先被调用。 当然对象的构造函数和析构函数调用时机和…...

智能家居1 -- 实现语音模块

项目整体框架: 监听线程4&#xff1a; 1. 语音监听线程:用于监听语音指令&#xff0c; 当有语音指令过来后&#xff0c; 通过消息队列的方式给消息处理线程发送指令 2. 网络监听线程&#xff1a;用于监听网络指令&#xff0c;当有网络指令过来后&#xff0c; 通过消息队列的方…...

Leetcode 3139. Minimum Cost to Equalize Array

Leetcode 3139. Minimum Cost to Equalize Array 1. 解题思路2. 代码实现 题目链接&#xff1a;3139. Minimum Cost to Equalize Array 1. 解题思路 这一题是一道hard的题目&#xff0c;而且看了一下答出率低的离谱&#xff0c;就一开始被吓到了&#xff0c;不过实际做了一下…...