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

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++实现老鼠走迷宫

老鼠形象可以辨认&#xff0c;可以用上下左右操纵老鼠;正确检测结果&#xff0c;若老鼠在规定的时间内走到粮仓&#xff0c;提示成功&#xff0c;否则提示失败。代码分为3个文件&#xff1a;main.cpp、play.h、play.cpp。 main.cpp: #include <iostream> #include <…...

[Linux]文件基础-如何管理文件

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

bat 查找文件所在

脚本 在批处理文件&#xff08;.bat&#xff09;中查找文件所在的目录&#xff0c;你可以使用dir命令结合循环和条件语句来实现。以下是一个简单的示例&#xff0c;演示如何在批处理文件中查找指定文件并输出其所在目录&#xff1a; echo off setlocal enabledelayedexpansio…...

程序员的守护神:为何电脑永不熄灭?

在这个信息时代&#xff0c;程序员成了推动社会进步的“隐形英雄”。他们通宵达旦&#xff0c;手指在键盘上跳跃&#xff0c;创造出一个个令人惊叹的数字世界。有趣的是&#xff0c;你可能注意到了一个现象&#xff1a;程序员似乎总是不关电脑。这并非他们对电脑上瘾&#xff0…...

Kafka快速实战以及基本原理详解

Kafka快速实战以及基本原理详解 基本概念 Kafka是一个分布式、支持分区、多副本&#xff0c;基于ZK的分布式消息系统&#xff0c;最大的特性就是可以实时的处理大量数据以满足各种需求场景&#xff0c;比如Hadoop的批处理系统、低延迟的实时系统、Storm/Spark流式处理引擎、日…...

微信小程序(4)- 事件系统和模板语法

1. 事件系统 1.1 事件绑定和事件对象 小程序中绑定事件与在网页开发中绑定事件几乎一致&#xff0c;只不过在小程序不能通过 on 的方式绑定事件&#xff0c;也没有 click 等事件&#xff0c;小程序中绑定事件使用 bind 方法&#xff0c;click 事件也需要使用 tap 事件来进行代…...

【Java多线程】对线程池的理解并模拟实现线程池

目录 1、池 1.1、线程池 2、ThreadPoolExecutor 线程池类 3、Executors 工厂类 4、模拟实现线程池 1、池 “池”这个概念见到非常多&#xff0c;例如常量池、数据库连接池、线程池、进程池、内存池。 所谓“池”的概念就是&#xff1a;&#xff08;提高效率&#xff09; 1…...

python连接mysql数据库

连接MySQL数据库&#xff0c;通常我们会使用Python的mysql-connector-python库。下面是一个基本的示例来展示如何使用Python连接到MySQL数据库。 首先&#xff0c;确保你已经安装了mysql-connector-python库。如果没有&#xff0c;你可以使用pip来安装它&#xff1a; pip ins…...

docker用法

首先需要去docker官网注册你的账号&#xff0c;记住账号名称和密码&#xff1b; 然后在本地执行&#xff1a; docker login登录OK。 把ubuntu下载到本地&#xff1a; sudo docker pull ubuntusudo docker images输出&#xff1a; REPOSITORY TAG …...

DIcom调试Planar configuration

最近和CBCT组同事调dicom图像 这边得图像模块老不兼容对方得dicom文件。 vtk兼容&#xff0c;自己写得原生解析不兼容。 给对方调好了格式&#xff0c;下次生成文件还会有错。 简单记录下&#xff0c;日后备查。 今天对方又加了 个字段&#xff1a;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 测试就是在测试活动中&#xff0c;对于某些不容易构造或者不容易获取的数据/场景&#xff0c;用一个Mock对象来创建以便测试的测试方法。 Mock测试常见场景 无法控制第三方系统接口的返回&#xff0c;返回的数据不满足要求依赖的接口还未开发完成&#…...

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&#xff0c;但是对于git bash会有一些Linux下广泛使用的命令的缺失&#xff0c;比如wget命令。 1、下载wget.exe&#xff0c;地址&#xff1a;https://eternallybored.org/misc/wget/ 2、将wget.exe 拷贝到C:\Program Files\Git\ming…...

BlackberryQ10 是可以安装 Android 4.3 应用的,Web UserAgent 版本信息

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

JS前端高频面试

JS数据类型有哪些&#xff0c;区别是什么 js数据类型分为原始数据类型和引用数据类型。 原始数据类型包括&#xff1a;number&#xff0c;string&#xff0c;boolean&#xff0c;null&#xff0c;undefined&#xff0c;和es6新增的两种类型&#xff1a;bigint 和 symbol。&am…...

Flask数据库操作-Flask-SQLAlchemy

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

H5获取手机相机或相册图片两种方式-Android通过webview传递多张照片给H5

需求目的&#xff1a; 手机机通过webView展示H5网页&#xff0c;在特殊场景下&#xff0c;需要使用相机拍照或者从相册获取照片&#xff0c;上传后台。 完整流程效果&#xff1a; 如下图 一、H5界面样例代码 使用html文件格式&#xff0c;文件直接打开就可以展示布局&#…...

【kafka】Golang实现分布式Masscan任务调度系统

要求&#xff1a; 输出两个程序&#xff0c;一个命令行程序&#xff08;命令行参数用flag&#xff09;和一个服务端程序。 命令行程序支持通过命令行参数配置下发IP或IP段、端口、扫描带宽&#xff0c;然后将消息推送到kafka里面。 服务端程序&#xff1a; 从kafka消费者接收…...

《Qt C++ 与 OpenCV:解锁视频播放程序设计的奥秘》

引言:探索视频播放程序设计之旅 在当今数字化时代,多媒体应用已渗透到我们生活的方方面面,从日常的视频娱乐到专业的视频监控、视频会议系统,视频播放程序作为多媒体应用的核心组成部分,扮演着至关重要的角色。无论是在个人电脑、移动设备还是智能电视等平台上,用户都期望…...

2021-03-15 iview一些问题

1.iview 在使用tree组件时&#xff0c;发现没有set类的方法&#xff0c;只有get&#xff0c;那么要改变tree值&#xff0c;只能遍历treeData&#xff0c;递归修改treeData的checked&#xff0c;发现无法更改&#xff0c;原因在于check模式下&#xff0c;子元素的勾选状态跟父节…...

自然语言处理——循环神经网络

自然语言处理——循环神经网络 循环神经网络应用到基于机器学习的自然语言处理任务序列到类别同步的序列到序列模式异步的序列到序列模式 参数学习和长程依赖问题基于门控的循环神经网络门控循环单元&#xff08;GRU&#xff09;长短期记忆神经网络&#xff08;LSTM&#xff09…...

安全突围:重塑内生安全体系:齐向东在2025年BCS大会的演讲

文章目录 前言第一部分&#xff1a;体系力量是突围之钥第一重困境是体系思想落地不畅。第二重困境是大小体系融合瓶颈。第三重困境是“小体系”运营梗阻。 第二部分&#xff1a;体系矛盾是突围之障一是数据孤岛的障碍。二是投入不足的障碍。三是新旧兼容难的障碍。 第三部分&am…...

FFmpeg avformat_open_input函数分析

函数内部的总体流程如下&#xff1a; avformat_open_input 精简后的代码如下&#xff1a; int avformat_open_input(AVFormatContext **ps, const char *filename,ff_const59 AVInputFormat *fmt, AVDictionary **options) {AVFormatContext *s *ps;int i, ret 0;AVDictio…...

WEB3全栈开发——面试专业技能点P4数据库

一、mysql2 原生驱动及其连接机制 概念介绍 mysql2 是 Node.js 环境中广泛使用的 MySQL 客户端库&#xff0c;基于 mysql 库改进而来&#xff0c;具有更好的性能、Promise 支持、流式查询、二进制数据处理能力等。 主要特点&#xff1a; 支持 Promise / async-await&#xf…...

ArcPy扩展模块的使用(3)

管理工程项目 arcpy.mp模块允许用户管理布局、地图、报表、文件夹连接、视图等工程项目。例如&#xff0c;可以更新、修复或替换图层数据源&#xff0c;修改图层的符号系统&#xff0c;甚至自动在线执行共享要托管在组织中的工程项。 以下代码展示了如何更新图层的数据源&…...

算法250609 高精度

加法 #include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> using namespace std; char input1[205]; char input2[205]; int main(){while(scanf("%s%s",input1,input2)!EOF){int a[205]…...

【题解-洛谷】P10480 可达性统计

题目&#xff1a;P10480 可达性统计 题目描述 给定一张 N N N 个点 M M M 条边的有向无环图&#xff0c;分别统计从每个点出发能够到达的点的数量。 输入格式 第一行两个整数 N , M N,M N,M&#xff0c;接下来 M M M 行每行两个整数 x , y x,y x,y&#xff0c;表示从 …...