C/C++实现老鼠走迷宫
老鼠形象可以辨认,可以用上下左右操纵老鼠;正确检测结果,若老鼠在规定的时间内走到粮仓,提示成功,否则提示失败。代码分为3个文件:main.cpp、play.h、play.cpp。
main.cpp:
#include <iostream>
#include <windows.h>
#include "play.h"
#include <stdio.h>
using namespace std;
/* run this program using the console pauser or add your own _getch, system("pause") or input loop */
int main()
{
int Count = 0;
cout << "欢迎使用自制迷宫游戏,Are you ready?";
Sleep(500);
cout << ".";
Sleep(500);
cout << ".";
Sleep(500);
cout << ".";
// system("cls");
// cout<<"\t\t*************************************************"<<endl;
// cout<<"\t\t* *"<<endl;
// cout<<"\t\t* 1.开始游戏 *"<<endl;
// cout<<"\t\t* *"<<endl;
// cout<<"\t\t* 2.编辑游戏 *"<<endl;
// cout<<"\t\t* *"<<endl;
// cout<<"\t\t* 3.退出游戏 *"<<endl;
// cout<<"\t\t* *"<<endl;
// cout<<"\t\t*************************************************"<<endl;
Player play_1(11, 11);
Player play_2(13, 13);
Player play_3(15, 15);
int Menu;
while (1)
{
if (Count < 1)
{
system("cls");
cout << "\t\t*************************************************" << endl;
cout << "\t\t* *" << endl;
cout << "\t\t* 1.开始游戏 *" << endl;
cout << "\t\t* *" << endl;
cout << "\t\t* 2.编辑游戏 *" << endl;
cout << "\t\t* *" << endl;
cout << "\t\t* 3.查看最短路径与所有路径 *" << endl;
cout << "\t\t* *" << endl;
cout << "\t\t* 4.退出游戏 *" << endl;
cout << "\t\t* *" << endl;
cout << "\t\t*************************************************" << endl;
}
else if (Count >= 1)
{
system("cls");
cout << "\t\t*************************************************" << endl;
cout << "\t\t* *" << endl;
cout << "\t\t* 1.开始游戏 *" << endl;
cout << "\t\t* *" << endl;
cout << "\t\t* 2.编辑游戏 *" << endl;
cout << "\t\t* *" << endl;
cout << "\t\t* 3.退出游戏 *" << endl;
cout << "\t\t* *" << endl;
cout << "\t\t*************************************************" << endl;
}
cin >> Menu;
system("cls");
if (Menu == 1)
{
cout << "*******************************游戏说明*****************************" << endl;
cout << "请使用键盘↑↓←→移动老鼠,在规定时间内用尽量少的步骤帮老鼠找到粮仓" << endl;
system("cls");
cout << "\t\t 第一关 " << endl;
Sleep(500);
play_1.show_Map();
play_1.Move();
play_1.KeepMap();
cout << "\t\t 请进行你的选择 " << endl;
cout << "\t\t 1.继续游戏 " << endl;
cout << "\t\t 2.结束游戏 " << endl;
int choice, choice2;
cin >> choice;
if (choice == 1)
{
cout << "\t\t 第二关 " << endl;
Sleep(500);
play_2.show_Map();
play_2.Move();
play_2.KeepMap();
cout << "\t\t 请进行你的选择 " << endl;
cout << "\t\t 1.继续游戏 " << endl;
cout << "\t\t 2.结束游戏 " << endl;
cin >> choice2;
if (choice2 == 1)
{
cout << "\t\t 第三关 " << endl;
cout << "\t\t 请进行你的选择 " << endl;
cout << "\t\t 1.继续游戏 " << endl;
cout << "\t\t 2.结束游戏 " << endl;
Sleep(500);
play_3.show_Map();
play_3.Move();
play_3.KeepMap();
cout << "您已通关,感谢使用" << endl;
break;
}
else if (choice2 == 2)
{
cout << "游戏结束,感谢使用" << endl;
break;
}
}
else if (choice == 2)
{
cout << "游戏结束,感谢使用" << endl;
break;
}
}
else if (Menu == 2)
{
cout << "\t 请选择想要编辑的关卡 " << endl;
cout << "\t\t 1.第一关 " << endl;
cout << "\t\t 2.第二关 " << endl;
cout << "\t\t 3.第三关 " << endl;
int choice3;
cin >> choice3;
if (choice3 == 1)
{
play_1.EditorMap();
}
else if (choice3 == 2)
{
play_2.EditorMap();
}
else if (choice3 == 3)
{
play_3.EditorMap();
}
system("cls");
}
else if (Menu == 3)
{
cout << "亲,您只有一次查看机会哦╭●★★●╰。。。";
Sleep(2000);
if (Count < 1)
{
Count++;
cout << "\t\t 请输入想要查看的关卡 " << endl;
cout << "\t\t 1.第一关 " << endl;
cout << "\t\t 2.第二关 " << endl;
cout << "\t\t 3.第三关 " << endl;
int Choice;
cin >> Choice;
if (Choice == 1)
{
play_1.Pre_Short();
}
else if (Choice == 2)
{
play_2.Pre_Short();
}
else if (Choice == 3)
{
play_3.Pre_Short();
}
}
}
if (Count < 1)
{
if (Menu == 4)
{
cout << "感谢使用" << endl;
break;
}
}
else if (Count > 1)
{
if (Menu == 3)
{
cout << "感谢小主的使用" << endl;
break;
}
}
}
return 0;
}
play.cpp:
#include <iostream>
#include "play.h"
#include <windows.h>
#include <conio.h>
#include <time.h>
using namespace std;
void Player::Push()
{
front = rear + 1;
rear = 0;
top = -1;
top++;
Mp[top] = MpQueue[front - 1];
int direc1[4][2] = { 1,0,0,1,0,-1,-1,0 }; //定义方向
while (front != rear)
{
front--;
for (int j = 0; j < 4; j++)
{
if (Mp[top].x + direc1[j][0] == MpQueue[front - 1].x && Mp[top].y + direc1[j][1] == MpQueue[front - 1].y)
{
top++;
Mp[top] = MpQueue[front - 1];
}
}
}
}
void Player::show()
{
cout << "鼠";
for (int i = 0; i <= top; i++)
{
cout << "(" << Mp[i].x << "," << Mp[i].y << ")"
<< "->";
}
cout << "仓";
system("pause>nul");
}
void Player::Move()
{
time_t Start;
time_t Over;
int Count = 100;
char Enter;
int Time = 30;
int a, b = 0, c = Map_Length / 2, d = Map_Width / 2, i, j;
Start = time(NULL);
while (Time >= 0)
{
Over = time(NULL);
a = Over - Start;
if (_kbhit() == 0)
{
if (b != a)
{
system("cls");
for (i = 1; i <= Map_Length; i++)
{
for (j = 1; j <= Map_Length; j++)
{
if (Map[i][j].data == 1)
{
cout << "■";
}
else if (Map[i][j].data == 0)
{
cout << " ";
}
else if (Map[i][j].data == 2)
{
cout << "鼠";
}
else if (Map[i][j].data == 3)
{
cout << "仓";
}
else if (Map[i][j].data == 4)
{
cout << " ";
}
}
cout << endl;
}
cout << "剩余时间" << Time-- << "秒" << endl;
b = a;
if (Time == -1)
{
system("cls");
cout << "闯关失败" << endl;
exit(1);
break;
}
}
}
if (_kbhit() != 0)
{
Enter = _getch();
system("cls");
if (Enter == -32)
{
Enter = _getch();
if (Enter == 75)
{
if (Map[c][d - 1].data == 1)
{
cout << "老鼠不能穿墙" << endl;
}
else
{
Map[c][d - 1].data = 2;
Map[c][d].data = 4;
d = d - 1;
Count--;
}
}
else if (Enter == 77)
{
if (Map[c][d + 1].data == 1)
{
cout << "老鼠不能穿墙" << endl;
}
else
{
Map[c][d + 1].data = 2;
Map[c][d].data = 4;
d = d + 1;
Count--;
}
}
else if (Enter == 72)
{
if (Map[c - 1][d].data == 1)
{
cout << "老鼠不能穿墙" << endl;
}
else
{
Map[c - 1][d].data = 2;
Map[c][d].data = 4;
c = c - 1;
Count--;
}
}
else if (Enter == 80)
{
if (Map[c + 1][d].data == 1)
{
cout << "老鼠不能穿墙" << endl;
}
else
{
Map[c + 1][d].data = 2;
Map[c][d].data = 4;
c = c + 1;
Count--;
}
}
}
for (i = 1; i <= Map_Length; i++)
{
for (j = 1; j <= Map_Length; j++)
{
if (Map[i][j].data == 1)
{
cout << "■";
}
else if (Map[i][j].data == 0)
{
cout << " ";
}
else if (Map[i][j].data == 2)
{
cout << "鼠";
}
else if (Map[i][j].data == 3)
{
cout << "仓";
}
else if (Map[i][j].data == 4)
{
cout << " ";
}
}
cout << endl;
}
if (Map[Map_Length - 1][Map_Length - 1].data != 3)
{
system("cls");
cout << "闯关成功" << endl;
cout << "您的积分为" << Count << endl;
break;
}
}
}
}
void Player::KeepMap() //保存老鼠走过的路径
{
for (int i = 1; i <= Map_Length; i++)
{
for (int j = 1; j <= Map_Width; j++)
{
if (Map[i][j].data == 0)
{
cout << " ";
}
else if (Map[i][j].data == 1)
{
cout << "■";
}
else if (Map[i][j].data == 2)
{
cout << "鼠";
}
else if (Map[i][j].data == 3)
{
cout << "仓";
}
else if (Map[i][j].data == 4)
{
cout << "◇";
}
}
cout << endl;
}
}
void Player::show_Map() //编辑地图
{
int i, j;
//srand((unsigned)time(NULL)); //如果不适用随机数种子,那么每次程序启动生成的随机数(rand)都是一样的
GenerateMap(2 * (rand() % (Map_Length / 2 + 1)), 2 * (rand() % (Map_Width / 2 + 1)));
Map[Map_Length / 2][Map_Width / 2].data = 2; //初始化鼠 当二维数组的值为2时,代表鼠
Map[Map_Length - 1][Map_Width - 1].data = 3; //初始化仓 当二维数组的值为3时,代表仓
for (i = 1; i <= Map_Length; i++)
{
for (j = 1; j <= Map_Width; j++)
{
if (Map[i][j].data == 1)
{
cout << "■";
}
else if (Map[i][j].data == 0)
{
cout << " ";
}
else if (Map[i][j].data == 2)
{
cout << "鼠";
}
else if (Map[i][j].data == 3)
{
cout << "仓";
}
}
cout << endl;
}
}
void Player::Pre_Short()
{
rear = front = -1;
for (int i = 1; i <= Map_Length + 1; i++) //1-Map_Length才是想要的
{
for (int j = 1; j <= Map_Width + 1; j++)
{
if (i == 0 || i == Map_Length + 1 || j == 0 || j == Map_Width + 1)
{
Map[i][j].data = 0;
}
else
{
Map[i][j].data = 1;
}
}
}
for (int i = 0; i <= Map_Length; i++)
{
for (int j = 0; j < Map_Width; j++)
{
Map[i][j].visited = 0;
}
}
show_Map();
system("cls");
int m = Map_Length - 1, n = Map_Width - 1;
MapPoint p;
p.x = m, p.y = n, p.visited = 1;
p.data = 3;
ShortMap(p);
show();
while (top != -1)
{
top--;
}
}
void Player::EditorMap()
{
int c = Map_Length / 2;
int d = Map_Width / 2;
show_Map();
system("cls");
char Enter;
while (1)
{
for (int i = 1; i <= Map_Length; i++)
{
for (int j = 1; j <= Map_Length; j++)
{
if (Map[i][j].data == 1)
{
cout << "■";
}
else if (Map[i][j].data == 0)
{
cout << " ";
}
else if (Map[i][j].data == 2)
{
cout << "鼠";
}
else if (Map[i][j].data == 3)
{
cout << "仓";
}
else if (Map[i][j].data == 4)
{
cout << " ";
}
}
cout << endl;
}
cout << "输入回车键保存修改" << endl;
Enter = _getch();
system("cls");
if (Enter == -32)
{
Enter = _getch();
if (Enter == 75)
{
if (Map[c][d - 1].data == 1)
{
cout << "老鼠不能穿墙" << endl;
}
else
{
Map[c][d - 1].data = 2;
Map[c][d].data = 4;
d = d - 1;
}
}
else if (Enter == 77)
{
if (Map[c][d + 1].data == 1)
{
cout << "老鼠不能穿墙" << endl;
}
else
{
Map[c][d + 1].data = 2;
Map[c][d].data = 4;
d = d + 1;
}
}
else if (Enter == 72)
{
if (Map[c - 1][d].data == 1)
{
cout << "老鼠不能穿墙" << endl;
}
else
{
Map[c - 1][d].data = 2;
Map[c][d].data = 4;
c = c - 1;
}
}
else if (Enter == 80)
{
if (Map[c + 1][d].data == 1)
{
cout << "老鼠不能穿墙" << endl;
}
else
{
Map[c + 1][d].data = 2;
Map[c][d].data = 4;
c = c + 1;
}
}
}
if (Enter == 97)
{
if (Map[c][d - 1].data == 1)
{
Map[c][d - 1].data = 0;
}
else if (Map[c][d - 1].data == 0 || Map[c][d - 1].data == 4)
{
Map[c][d - 1].data = 1;
}
}
else if (Enter == 119)
{
if (Map[c - 1][d].data == 1)
{
Map[c - 1][d].data = 0;
}
else if (Map[c - 1][d].data == 0 || Map[c - 1][d].data == 4)
{
Map[c - 1][d].data = 1;
}
}
else if (Enter == 100)
{
if (Map[c][d + 1].data == 1)
{
Map[c][d + 1].data = 0;
}
else if (Map[c][d + 1].data == 0 || Map[c][d + 1].data == 4)
{
Map[c][d + 1].data = 1;
}
}
else if (Enter == 115)
{
if (Map[c + 1][d].data == 1)
{
Map[c + 1][d].data = 0;
}
else if (Map[c + 1][d].data == 0 || Map[c + 1][d].data == 4)
{
Map[c + 1][d].data = 1;
}
}
else if (Enter == 0x0D)
{
Map[c][d].data = 0;
break;
}
}
}
void Player::ShortMap(MapPoint& M)
{
M.visited = 1;
for (int i = 1; i <= Map_Length; i++)
{
for (int j = 1; j <= Map_Length; j++)
{
if (Map[i][j].data == 1)
{
cout << "■";
}
else if (Map[i][j].data == 0)
{
cout << " ";
}
else if (Map[i][j].data == 2)
{
cout << "鼠";
}
else if (Map[i][j].data == 3)
{
cout << "仓";
}
else if (Map[i][j].data == 4)
{
cout << " ";
}
}
cout << endl;
}
front = rear = -1;
rear++;
MpQueue[rear] = M;
int direc1[4][2] = { 1, 0, 0, 1, 0, -1, -1, 0 }; //d定义四个方向
while (front != rear)
{
front++;
for (int j = 0; j < 4; j++)
{
if ((Map[MpQueue[front].x + direc1[j][0]][MpQueue[front].y + direc1[j][1]].data == 0 || Map[MpQueue[front].x + direc1[j][0]][MpQueue[front].y + direc1[j][1]].data == 2 || Map[MpQueue[front].x + direc1[j][0]][MpQueue[front].y + direc1[j][1]].data == 4) && Map[MpQueue[front].x + direc1[j][0]][MpQueue[front].y + direc1[j][1]].visited == 0 && MpQueue[front].x < Map_Width && MpQueue[front].x >= 1 && MpQueue[front].y < Map_Length && MpQueue[front].y >= 1)
{
rear++;
MpQueue[rear].x = MpQueue[front].x + direc1[j][0];
MpQueue[rear].y = MpQueue[front].y + direc1[j][1];
Map[MpQueue[front].x + direc1[j][0]][MpQueue[front].y + direc1[j][1]].visited = 1;
if (MpQueue[rear].x == (Map_Length / 2) && MpQueue[rear].y == (Map_Width / 2))
{
flag = 1;
break;
}
}
}
if (flag == 1)
{
break;
}
}
Push();
}
void Player::GenerateMap(int x, int y)
{
int direction[4][2] = { 1,0,0,1,0,-1,-1,0 }; //定义方向
int i, j, temp;
for (i = 0; i < 4; i++) //打乱方向
{
j = rand() % 4; //随机选取方向
temp = direction[i][0];
direction[i][0] = direction[j][0];
direction[j][0] = temp;
temp = direction[i][1];
direction[i][1] = direction[j][1];
direction[j][1] = temp;
}
Map[x][y].data = 0;
for (i = 0; i < 4; i++) //任何两个空的地方都有路可走
{
if (Map[x + 2 * direction[i][0]][y + 2 * direction[i][1]].data == 1)
{
Map[x + direction[i][0]][y + direction[i][1]].data = 0; //打通墙
GenerateMap(x + 2 * direction[i][0], y + 2 * direction[i][1]);
}
}
}
Player::Player(int m, int n)
{
int i, j;
Map_Length = m, Map_Width = n;
for (i = 1; i <= Map_Length + 1; i++) //1-Map_Length才是想要的
{
for (j = 1; j <= Map_Width + 1; j++)
{
if (i == 0 || i == Map_Length + 1 || j == 0 || j == Map_Width + 1)
{
Map[i][j].data = 0;
}
else
{
Map[i][j].data = 1;
}
}
}
for (int i = 0; i < Size; i++)
{
for (int j = 0; j < Size; j++)
{
Map[i][j].visited = 0;
}
}
flag = 0;
front = rear = -1;
top = -1;
}
play.h:
#ifndef PLAY_H
#define PLAY_H
const int Size = 100;
struct MapPoint
{
int data;
int x, y; //保存路径的x与y坐标
int visited; //是否访问过的标签
};
class Player
{
private:
int top;
int flag;
int x, y;
int rear;
int front;
int Mouse_x, Mouse1_y; //老鼠的位置
int Map_Length, Map_Width;
MapPoint Mp[Size]; //栈
MapPoint MpQueue[230]; //队列
public:
Player(int m, int n);
void Push(); //入栈操作
void show();
void Move(); //老鼠移动
void KeepMap(); //保存路径
void PlayGame(); //开始游戏
void show_Map(); //显示地图
void Pre_Short();
void EditorMap(); //编辑地图
void ShortMap(MapPoint& M); //计算最短路径
void GenerateMap(int x, int y); //生成地图
MapPoint Map[Size][Size]; //地图数组
};
#endif
相关文章:
C/C++实现老鼠走迷宫
老鼠形象可以辨认,可以用上下左右操纵老鼠;正确检测结果,若老鼠在规定的时间内走到粮仓,提示成功,否则提示失败。代码分为3个文件:main.cpp、play.h、play.cpp。 main.cpp: #include <iostream> #include <…...

[Linux]文件基础-如何管理文件
回顾C语言之 - 文件如何被写入 fopen fwrite fread fclose fseek … 这一系列函数都是C语言中对文件进行的操作: int main() {FILE* fpfopen("text","w");char str[20]"write into text";fputs(str,fp);fclose(fp);return 0; }而上…...

bat 查找文件所在
脚本 在批处理文件(.bat)中查找文件所在的目录,你可以使用dir命令结合循环和条件语句来实现。以下是一个简单的示例,演示如何在批处理文件中查找指定文件并输出其所在目录: echo off setlocal enabledelayedexpansio…...
程序员的守护神:为何电脑永不熄灭?
在这个信息时代,程序员成了推动社会进步的“隐形英雄”。他们通宵达旦,手指在键盘上跳跃,创造出一个个令人惊叹的数字世界。有趣的是,你可能注意到了一个现象:程序员似乎总是不关电脑。这并非他们对电脑上瘾࿰…...

Kafka快速实战以及基本原理详解
Kafka快速实战以及基本原理详解 基本概念 Kafka是一个分布式、支持分区、多副本,基于ZK的分布式消息系统,最大的特性就是可以实时的处理大量数据以满足各种需求场景,比如Hadoop的批处理系统、低延迟的实时系统、Storm/Spark流式处理引擎、日…...
微信小程序(4)- 事件系统和模板语法
1. 事件系统 1.1 事件绑定和事件对象 小程序中绑定事件与在网页开发中绑定事件几乎一致,只不过在小程序不能通过 on 的方式绑定事件,也没有 click 等事件,小程序中绑定事件使用 bind 方法,click 事件也需要使用 tap 事件来进行代…...

【Java多线程】对线程池的理解并模拟实现线程池
目录 1、池 1.1、线程池 2、ThreadPoolExecutor 线程池类 3、Executors 工厂类 4、模拟实现线程池 1、池 “池”这个概念见到非常多,例如常量池、数据库连接池、线程池、进程池、内存池。 所谓“池”的概念就是:(提高效率) 1…...
python连接mysql数据库
连接MySQL数据库,通常我们会使用Python的mysql-connector-python库。下面是一个基本的示例来展示如何使用Python连接到MySQL数据库。 首先,确保你已经安装了mysql-connector-python库。如果没有,你可以使用pip来安装它: pip ins…...
docker用法
首先需要去docker官网注册你的账号,记住账号名称和密码; 然后在本地执行: docker login登录OK。 把ubuntu下载到本地: sudo docker pull ubuntusudo docker images输出: REPOSITORY TAG …...

DIcom调试Planar configuration
最近和CBCT组同事调dicom图像 这边得图像模块老不兼容对方得dicom文件。 vtk兼容,自己写得原生解析不兼容。 给对方调好了格式,下次生成文件还会有错。 简单记录下,日后备查。 今天对方又加了 个字段:Planar configuration 查…...

C#与VisionPro联合开发——跳转页面
1、跳转页面并打开相机 From1 所有代码展示 using System; using System.IO; using System.Windows.Forms; //引入VisionPro命名空间 using Cognex.VisionPro;namespace ConnectCamera {public partial class Form1 : Form {public Form1() {InitializeComponent();}CogAcqFif…...

服务端测试开发必备技能:Mock测试
什么是mock测试 Mock 测试就是在测试活动中,对于某些不容易构造或者不容易获取的数据/场景,用一个Mock对象来创建以便测试的测试方法。 Mock测试常见场景 无法控制第三方系统接口的返回,返回的数据不满足要求依赖的接口还未开发完成&#…...

vue3中ref创建变量取值时自动补充 .value 插件 volar
插件 TypeScript Vue Plugin (Volar) 设置中配置...
clickhouse的docker部署与springboot整合
注意:镜像bitnami/clickhouse包含服务端和客户端,yandex版本需要使用yandex/clickhouse-server,yandex/clickhouse-server docker启动命令(允许空密码 -e ALLOW_EMPTY_PASSWORD=yes),clickhouse版本不同,配置文件在的位置也会不一样/etc/clickhouse-server/config.xml d…...
Node.js_基础知识(计算机硬件基础)
主机的基本组成 CPU:Central Processing Unit,即中央处理器,是计算机的核心部件。是一块集成电路芯片,能够执行计算机指令并控制计算机的各种操作,负责运算和处理数据内存:是电脑硬件中的一块电路板,用于暂时存储CPU中的运算数据,是计算机与CPU进行沟通的桥梁,负责存储…...
git bash :download.sh: line 1: wget: command not found(已解决)
Windows中git bash完全可以替代原生的cmd,但是对于git bash会有一些Linux下广泛使用的命令的缺失,比如wget命令。 1、下载wget.exe,地址:https://eternallybored.org/misc/wget/ 2、将wget.exe 拷贝到C:\Program Files\Git\ming…...

BlackberryQ10 是可以安装 Android 4.3 应用的,Web UserAgent 版本信息
BlackberryQ10 是可以安装 Android 4.3 应用的 最近淘了个 Q10 手机,非常稀罕它,拿着手感一流。这么好的东西,就想给它装点东西,但目前所有的应用都已经抛弃这个安卓版本了。 一、开发环境介绍 BlackBerry Q10 的 安卓版本是 4.…...

JS前端高频面试
JS数据类型有哪些,区别是什么 js数据类型分为原始数据类型和引用数据类型。 原始数据类型包括:number,string,boolean,null,undefined,和es6新增的两种类型:bigint 和 symbol。&am…...

Flask数据库操作-Flask-SQLAlchemy
Flask中一般使用flask-sqlalchemy来操作数据库。flask-sqlalchemy的使用介绍如下: 一、SQLAlchemy SQLALchemy 实际上是对数据库的抽象,让开发者不用直接和 SQL 语句打交道,而是通过 Python 对象来操作数据库,在舍弃一些性能开销…...

H5获取手机相机或相册图片两种方式-Android通过webview传递多张照片给H5
需求目的: 手机机通过webView展示H5网页,在特殊场景下,需要使用相机拍照或者从相册获取照片,上传后台。 完整流程效果: 如下图 一、H5界面样例代码 使用html文件格式,文件直接打开就可以展示布局&#…...
生成xcframework
打包 XCFramework 的方法 XCFramework 是苹果推出的一种多平台二进制分发格式,可以包含多个架构和平台的代码。打包 XCFramework 通常用于分发库或框架。 使用 Xcode 命令行工具打包 通过 xcodebuild 命令可以打包 XCFramework。确保项目已经配置好需要支持的平台…...

7.4.分块查找
一.分块查找的算法思想: 1.实例: 以上述图片的顺序表为例, 该顺序表的数据元素从整体来看是乱序的,但如果把这些数据元素分成一块一块的小区间, 第一个区间[0,1]索引上的数据元素都是小于等于10的, 第二…...
Admin.Net中的消息通信SignalR解释
定义集线器接口 IOnlineUserHub public interface IOnlineUserHub {/// 在线用户列表Task OnlineUserList(OnlineUserList context);/// 强制下线Task ForceOffline(object context);/// 发布站内消息Task PublicNotice(SysNotice context);/// 接收消息Task ReceiveMessage(…...

大型活动交通拥堵治理的视觉算法应用
大型活动下智慧交通的视觉分析应用 一、背景与挑战 大型活动(如演唱会、马拉松赛事、高考中考等)期间,城市交通面临瞬时人流车流激增、传统摄像头模糊、交通拥堵识别滞后等问题。以演唱会为例,暖城商圈曾因观众集中离场导致周边…...
【位运算】消失的两个数字(hard)
消失的两个数字(hard) 题⽬描述:解法(位运算):Java 算法代码:更简便代码 题⽬链接:⾯试题 17.19. 消失的两个数字 题⽬描述: 给定⼀个数组,包含从 1 到 N 所有…...

高等数学(下)题型笔记(八)空间解析几何与向量代数
目录 0 前言 1 向量的点乘 1.1 基本公式 1.2 例题 2 向量的叉乘 2.1 基础知识 2.2 例题 3 空间平面方程 3.1 基础知识 3.2 例题 4 空间直线方程 4.1 基础知识 4.2 例题 5 旋转曲面及其方程 5.1 基础知识 5.2 例题 6 空间曲面的法线与切平面 6.1 基础知识 6.2…...

跨链模式:多链互操作架构与性能扩展方案
跨链模式:多链互操作架构与性能扩展方案 ——构建下一代区块链互联网的技术基石 一、跨链架构的核心范式演进 1. 分层协议栈:模块化解耦设计 现代跨链系统采用分层协议栈实现灵活扩展(H2Cross架构): 适配层…...
Caliper 配置文件解析:fisco-bcos.json
config.yaml 文件 config.yaml 是 Caliper 的主配置文件,通常包含以下内容: test:name: fisco-bcos-test # 测试名称description: Performance test of FISCO-BCOS # 测试描述workers:type: local # 工作进程类型number: 5 # 工作进程数量monitor:type: - docker- pro…...
BLEU评分:机器翻译质量评估的黄金标准
BLEU评分:机器翻译质量评估的黄金标准 1. 引言 在自然语言处理(NLP)领域,衡量一个机器翻译模型的性能至关重要。BLEU (Bilingual Evaluation Understudy) 作为一种自动化评估指标,自2002年由IBM的Kishore Papineni等人提出以来,…...
6个月Python学习计划 Day 16 - 面向对象编程(OOP)基础
第三周 Day 3 🎯 今日目标 理解类(class)和对象(object)的关系学会定义类的属性、方法和构造函数(init)掌握对象的创建与使用初识封装、继承和多态的基本概念(预告) &a…...