QT翻金币

QT翻金币

在B站跟着视频进行QT学习,现把代码全部贴上来,备忘
整体解决方案文件结构如下:
在这里插入图片描述
chooselevelscene.h

#ifndef CHOOSELEVELSCENE_H
#define CHOOSELEVELSCENE_H#include <QMainWindow>
#include"playscene.h"class ChooseLevelScene : public QMainWindow
{Q_OBJECT
public:explicit ChooseLevelScene(QWidget *parent = nullptr);void  paintEvent(QPaintEvent *event);playscene *play = NULL;signals:void chooseSceneBack();
};#endif // CHOOSELEVELSCENE_H

dataconfig.h

#ifndef DATACONFIG_H
#define DATACONFIG_H#include <QObject>
#include<QMap>
#include<QVector>class DataConfig : public QObject
{Q_OBJECT
public:explicit DataConfig(QObject *parent = nullptr);public:QMap<int, QVector <QVector<int>>>mData;
signals:
};#endif // DATACONFIG_H

mainwindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACEclass MainWindow : public QMainWindow
{Q_OBJECTpublic:MainWindow(QWidget *parent = nullptr);~MainWindow();void paintEvent(QPaintEvent *event);private slots:void on_actiontuichu_triggered();private:Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

mycoin.h.h

#ifndef MYCOIN_H
#define MYCOIN_H#include <QPushButton>>
#include<QTimer>
class MyCoin : public QPushButton
{Q_OBJECT
public://explicit MyCoin(QWidget *parent = nullptr);MyCoin(QString btnImage);void  mousePressEvent(QMouseEvent * e);int posX;int posY;bool flag;void changeFlag();QTimer *time1;QTimer *time2;int min;int max;bool isAnimation = false;bool iswin = false;signals:
};#endif // MYCOIN_H

mypushbutton.h

#ifndef MYPUSHBUTTON_H
#define MYPUSHBUTTON_H#include <QWidget>
#include<QPushButton>class MyPushButton : public QPushButton
{Q_OBJECT
public:MyPushButton(QString p_naormalimage , QString p_pressimage="");void zoom1();void zoom2();QString m_NormalImagePath;QString m_PressImagePath;void mousePressEvent(QMouseEvent *e) ;void mouseReleaseEvent(QMouseEvent *e) ;
signals:
};#endif // MYPUSHBUTTON_H

playscene.h

#ifndef PLAYSCENE_H
#define PLAYSCENE_H#include <QMainWindow>
#include"mycoin.h"class playscene : public QMainWindow
{Q_OBJECT
public:void  paintEvent(QPaintEvent *event);playscene(int levelnumber);int levelindex;//记住所选的关卡bool isWin();bool  SetWin();int gameArray[4][4];MyCoin *coinBtn[4][4];bool iswin;
signals:void playSceneBack();
};#endif // PLAYSCENE_H

chooselevelscene.cpp

#include "chooselevelscene.h"
#include<QMenuBar>
#include<QPainter>
#include"mypushbutton.h"
#include<QDebug>
#include<qtimer.h>
#include<QLabel>
#include<playscene.h>
ChooseLevelScene::ChooseLevelScene(QWidget *parent): QMainWindow{parent}
{setWindowIcon(QPixmap(":/res/Coin0001.png"));this->setFixedSize(320 , 588);setWindowTitle("选择关卡");QMenuBar *bar = menuBar();setMenuBar(bar);QMenu *startbar = bar->addMenu("开始");QAction * quitAction = startbar->addAction("退出");connect(quitAction , &QAction::triggered,[=](){this->close();});MyPushButton *backBtn = new MyPushButton(":/res/BackButton.png",":/res/BackButtonSelected.png");backBtn->setParent(this);backBtn->move(this->width()-backBtn->width() , this->height()-backBtn->height());connect(backBtn , &QPushButton::clicked,[=](){QTimer::singleShot(200,this,[=](){emit this->chooseSceneBack();});});//选择关卡按钮for(int i=0;i<20;++i){MyPushButton *menubtn = new MyPushButton(":/res/LevelIcon.png");menubtn->setParent(this);menubtn->move(25+i%4*70 , 130+i/4*70);connect(menubtn , &QPushButton::clicked,[=](){qDebug()<<"kaishiguanqia";play = new playscene(i+1);connect(play , &playscene::playSceneBack,[=](){this->show();play->hide();});this->hide();play->show();});QLabel *label = new QLabel;label->setParent(this);label->setFixedSize(menubtn->width() , menubtn->height());label->setText(QString::number(i+1));label->move(25+i%4*70 , 130+i/4*70);label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);label->setAttribute(Qt::WA_TransparentForMouseEvents);}}void ChooseLevelScene:: paintEvent(QPaintEvent *event)
{QPainter painter(this);QPixmap pix;pix.load(":/res/OtherSceneBg.png");painter.drawPixmap(0 ,0 , this->width() , this->height(),pix);pix.load(":/res/Title.png");pix = pix.scaled(pix.width()/2 , pix.height()/2);painter.drawPixmap(10 ,30 , pix);}

dataconfig.cpp

//dataconfig.cpp
#include "dataconfig.h"
#include <QDebug>
DataConfig::DataConfig(QObject *parent) : QObject(parent)//构造函数
{//二维数组int array1[4][4] = {{1, 1, 1, 1},{1, 1, 0, 1},{1, 0, 0, 0},{1, 1, 0, 1} } ;QVector< QVector<int>> v;  //一个动态数组的 二维数组for(int i = 0 ; i < 4;i++){QVector<int>v1;//一个一维数组的动态数组for(int j = 0 ; j < 4;j++){v1.push_back(array1[i][j]);//把数据写入到动态数组}v.push_back(v1);//把一维数组计入到二维数组}mData.insert(1,v);//把二维数组 计入到之前的 map  地图中  key =1  value = vint array2[4][4] = { {1, 0, 1, 1},{0, 0, 1, 1},{1, 1, 0, 0},{1, 1, 0, 1}} ;v.clear();//清除二维数组。for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array2[i][j]);}v.push_back(v1);}mData.insert(2,v);int array3[4][4] = {  {0, 0, 0, 0},{0, 1, 1, 0},{0, 1, 1, 0},{0, 0, 0, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array3[i][j]);}v.push_back(v1);}mData.insert(3,v);int array4[4][4] = {   {0, 1, 1, 1},{1, 0, 0, 1},{1, 0, 1, 1},{1, 1, 1, 1}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array4[i][j]);}v.push_back(v1);}mData.insert(4,v);int array5[4][4] = {  {1, 0, 0, 1},{0, 0, 0, 0},{0, 0, 0, 0},{1, 0, 0, 1}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array5[i][j]);}v.push_back(v1);}mData.insert(5,v);int array6[4][4] = {   {1, 0, 0, 1},{0, 1, 1, 0},{0, 1, 1, 0},{1, 0, 0, 1}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array6[i][j]);}v.push_back(v1);}mData.insert(6,v);int array7[4][4] = {   {0, 1, 1, 1},{1, 0, 1, 1},{1, 1, 0, 1},{1, 1, 1, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array7[i][j]);}v.push_back(v1);}mData.insert(7,v);int array8[4][4] = {  {0, 1, 0, 1},{1, 0, 0, 0},{0, 0, 0, 1},{1, 0, 1, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array8[i][j]);}v.push_back(v1);}mData.insert(8,v);int array9[4][4] = {   {1, 0, 1, 0},{1, 0, 1, 0},{0, 0, 1, 0},{1, 0, 0, 1}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array9[i][j]);}v.push_back(v1);}mData.insert(9,v);int array10[4][4] = {  {1, 0, 1, 1},{1, 1, 0, 0},{0, 0, 1, 1},{1, 1, 0, 1}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array10[i][j]);}v.push_back(v1);}mData.insert(10,v);int array11[4][4] = {  {0, 1, 1, 0},{1, 0, 0, 1},{1, 0, 0, 1},{0, 1, 1, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array11[i][j]);}v.push_back(v1);}mData.insert(11,v);int array12[4][4] = {  {0, 1, 1, 0},{0, 0, 0, 0},{1, 1, 1, 1},{0, 0, 0, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array12[i][j]);}v.push_back(v1);}mData.insert(12,v);int array13[4][4] = {    {0, 1, 1, 0},{0, 0, 0, 0},{0, 0, 0, 0},{0, 1, 1, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array13[i][j]);}v.push_back(v1);}mData.insert(13,v);int array14[4][4] = {    {1, 0, 1, 1},{0, 1, 0, 1},{1, 0, 1, 0},{1, 1, 0, 1}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array14[i][j]);}v.push_back(v1);}mData.insert(14,v);int array15[4][4] = {   {0, 1, 0, 1},{1, 0, 0, 0},{1, 0, 0, 0},{0, 1, 0, 1}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array15[i][j]);}v.push_back(v1);}mData.insert(15,v);int array16[4][4] = {   {0, 1, 1, 0},{1, 1, 1, 1},{1, 1, 1, 1},{0, 1, 1, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array16[i][j]);}v.push_back(v1);}mData.insert(16,v);int array17[4][4] = {  {0, 1, 1, 1},{0, 1, 0, 0},{0, 0, 1, 0},{1, 1, 1, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array17[i][j]);}v.push_back(v1);}mData.insert(17,v);int array18[4][4] = { {0, 0, 0, 1},{0, 0, 1, 0},{0, 1, 0, 0},{1, 0, 0, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array18[i][j]);}v.push_back(v1);}mData.insert(18,v);int array19[4][4] = {   {0, 1, 0, 0},{0, 1, 1, 0},{0, 0, 1, 1},{0, 0, 0, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array19[i][j]);}v.push_back(v1);}mData.insert(19,v);int array20[4][4] = {  {0, 0, 0, 0},{0, 0, 0, 0},{0, 0, 0, 0},{0, 0, 0, 0}} ;v.clear();for(int i = 0 ; i < 4;i++){QVector<int>v1;for(int j = 0 ; j < 4;j++){v1.push_back(array20[i][j]);}v.push_back(v1);}mData.insert(20,v);
}

main.cpp

#include "mainwindow.h"#include <QApplication>int main(int argc, char *argv[])
{QApplication a(argc, argv);MainWindow w;w.show();return a.exec();
}

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QDebug>
#include<QPainter>
#include"mypushbutton.h"
#include<qthread.h>
#include<qtimer.h>
#include<chooselevelscene.h>
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{ui->setupUi(this);//配置主场景setFixedSize(320 , 588);setWindowIcon(QIcon(":/res/Coin0001.png"));setWindowTitle("翻金币主场景");//退出// connect(ui->actiontuichu , &QAction::triggered , [=](){//     this->close();// });MyPushButton *startbutton = new MyPushButton(":/res/MenuSceneStartButton.png");startbutton->setParent(this);startbutton->move(this->width()/2-startbutton->width()/2 , this->height()*0.7);ChooseLevelScene *choosesceen = new ChooseLevelScene;connect(choosesceen , &ChooseLevelScene::chooseSceneBack,[=](){this->show();choosesceen->hide();});connect(startbutton , &QPushButton::clicked , [=](){startbutton->zoom1();startbutton->zoom2();QTimer::singleShot(200 , this , [=](){this->hide();choosesceen->show();});});}MainWindow::~MainWindow()
{delete ui;
}void MainWindow:: paintEvent(QPaintEvent *event)
{QPainter painter(this);QPixmap pix;pix.load(":/res/PlayLevelSceneBg.png");painter.drawPixmap(0 ,0 , this->width() , this->height(),pix);pix.load(":/res/Title.png");pix = pix.scaled(pix.width()/2 , pix.height()/2);painter.drawPixmap(10 ,30 , pix);}void MainWindow::on_actiontuichu_triggered()
{qDebug()<<"退出程序";this->close();
}

mycoin.cpp

#include "mycoin.h"
#include<QPixmap>MyCoin::MyCoin(QString btnImage)
{QPixmap pix;bool ret = pix.load(btnImage);if(ret!=true){qDebug()<<"图片加载失败";}this->setFixedSize(QSize(pix.width() , pix.height()));//设置不规则样式this->setStyleSheet("QPushButton{border:0px;}");this->setIcon(pix);this->setIconSize(QSize(pix.width() , pix.height()));time1 = new QTimer();time2 = new QTimer();max = 8;min = 1;connect(time1 , &QTimer::timeout,[=](){QPixmap pix;QString str = QString(":/res/Coin000%1").arg(min++);pix.load(str);this->setFixedSize(QSize(pix.width() , pix.height()));//设置不规则样式this->setStyleSheet("QPushButton{border:0px;}");this->setIcon(pix);this->setIconSize(QSize(pix.width() , pix.height()));if(min>max){min=1;this->isAnimation = false;time1->stop();}});connect(time2 , &QTimer::timeout,[=](){QPixmap pix;QString str = QString(":/res/Coin000%1").arg(max--);pix.load(str);this->setFixedSize(QSize(pix.width() , pix.height()));//设置不规则样式this->setStyleSheet("QPushButton{border:0px;}");this->setIcon(pix);this->setIconSize(QSize(pix.width() , pix.height()));if(max<min){max=8;this->isAnimation = false;time2->stop();}});
}
void MyCoin:: mousePressEvent(QMouseEvent * e)
{if((this->isAnimation==true) || (this->iswin==true)  ){return;}else{QPushButton::mousePressEvent(e);}}void MyCoin::changeFlag()
{if(this->flag==1){isAnimation = true;time1->start(30);this->flag = 0;}else{isAnimation = true;time2->start(30);this->flag = 1;}}

mypushbutton.cpp

#include "mypushbutton.h"
#include<QDebug>
#include<qpropertyanimation.h>MyPushButton::MyPushButton(QString p_naormalimage , QString p_pressimage)
{this-> m_NormalImagePath = p_naormalimage;this-> m_PressImagePath = p_pressimage;QPixmap pix;bool ret = pix.load(p_naormalimage);if(ret!=true){qDebug()<<"图片加载失败";}this->setFixedSize(QSize(pix.width() , pix.height()));//设置不规则样式this->setStyleSheet("QPushButton{border:0px;}");this->setIcon(pix);this->setIconSize(QSize(pix.width() , pix.height()));}void MyPushButton::zoom1()
{QPropertyAnimation *animationl = new QPropertyAnimation(this , "geometry");animationl->setDuration(200);animationl->setStartValue(QRect(this->x() , this->y() , this->width() , this->height()));animationl->setEndValue(QRect(this->x() , this->y()+10 , this->width() , this->height()));animationl->setEasingCurve(QEasingCurve::OutBounce);animationl->start();}
void MyPushButton::zoom2()
{QPropertyAnimation *animationl = new QPropertyAnimation(this , "geometry");animationl->setDuration(200);animationl->setStartValue(QRect(this->x() , this->y()+10 , this->width() , this->height()));animationl->setEndValue(QRect(this->x() , this->y() , this->width() , this->height()));animationl->setEasingCurve(QEasingCurve::OutBounce);animationl->start();
}
void MyPushButton:: mousePressEvent(QMouseEvent *e)
{if(this->m_PressImagePath.length()!=0){QPixmap pix;bool ret = pix.load(m_PressImagePath);if(ret!=true){qDebug()<<"图片加载失败";}this->setFixedSize(QSize(pix.width() , pix.height()));//设置不规则样式this->setStyleSheet("QPushButton{border:0px;}");this->setIcon(pix);this->setIconSize(QSize(pix.width() , pix.height()));}return QPushButton::mousePressEvent(e);
}
void MyPushButton:: mouseReleaseEvent(QMouseEvent *e)
{if(this->m_PressImagePath.length()!=0){QPixmap pix;bool ret = pix.load(m_NormalImagePath);if(ret!=true){qDebug()<<"图片加载失败";}this->setFixedSize(QSize(pix.width() , pix.height()));//设置不规则样式this->setStyleSheet("QPushButton{border:0px;}");this->setIcon(pix);this->setIconSize(QSize(pix.width() , pix.height()));}return QPushButton::mouseReleaseEvent(e);
}

playscene.cpp

#include "playscene.h"
#include<QDebug>
#include<QMenuBar>
#include<QPainter>
#include"mypushbutton.h"
#include<QTimer>
#include<QLabel>
#include"mycoin.h"
#include<QDebug>
#include<QRect>
#include"dataconfig.h"
#include<QPropertyAnimation>
playscene::playscene(int levelnumber)
{QString str = QString("进入了第 %1 关").arg(levelnumber);qDebug()<<str;this->levelindex = levelnumber;//初始化场景QMenuBar *bar = menuBar();setMenuBar(bar);QMenu *startbar = bar->addMenu("开始");QAction * quitAction = startbar->addAction("退出");connect(quitAction , &QAction::triggered,[=](){this->close();});setWindowIcon(QPixmap(":/res/Coin0001.png"));this->setFixedSize(320 , 588);setWindowTitle("选择关卡");MyPushButton *backBtn = new MyPushButton(":/res/BackButton.png",":/res/BackButtonSelected.png");backBtn->setParent(this);backBtn->move(this->width()-backBtn->width() , this->height()-backBtn->height());connect(backBtn , &QPushButton::clicked,[=](){QTimer::singleShot(200,this,[=](){emit this->playSceneBack();});});QFont font;font.setFamily("微软雅黑");font.setPointSize(20);QLabel *lable = new QLabel;lable->setParent(this);lable->setText("Level "+QString::number(this->levelindex));lable->setGeometry(30 , this->height()-50 , 120 ,50);lable->setFont(font);DataConfig config;//初始化关卡数组for(int i=0;i<4;++i){for(int j=0;j<4;++j){this->gameArray[i][j] = config.mData[this->levelindex][i][j];}}QLabel *winLabel = new QLabel;QPixmap tmpPix;tmpPix.load(":/res/LevelCompletedDialogBg.png");winLabel->setGeometry(0,0,tmpPix.width() , tmpPix.height());winLabel->setPixmap(tmpPix);winLabel->setParent(this);winLabel->move((this->width()-tmpPix.width())/2, -tmpPix.height());//显示金币背景图案for(int i=0;i<4;++i){for(int j=0;j<4;++j){QLabel *lable = new QLabel;lable->setGeometry(0,0,50,50);lable->setPixmap(QPixmap(":/res/BoardNode.png"));lable->setParent(this);lable->move(57+i*50 , 200+j*50);QString str_tep;if(this->gameArray[i][j]==1){str_tep = ":/res/Coin0001.png";}else{str_tep = ":/res/Coin0008.png";}MyCoin *btn = new MyCoin(str_tep);btn->setGeometry(0,0,50,50);btn->setParent(this);btn->move(59+i*50 , 204+j*50);btn->posX = i;btn->posY = j;btn->flag = this->gameArray[i][j];coinBtn[i][j] = btn;connect(btn , &QPushButton::clicked,[=](){btn->changeFlag();this->gameArray[i][j] = this->gameArray[i][j]==0 ? 1:0;//开始翻转周围QTimer::singleShot(100,this , [=](){//右侧if(btn->posX+1<=3){this->coinBtn[btn->posX+1][j]->changeFlag();this->gameArray[btn->posX+1][j] = this->gameArray[btn->posX+1][j]==0 ? 1:0;}//左侧if(btn->posX-1>=0){this->coinBtn[btn->posX-1][j]->changeFlag();this->gameArray[btn->posX-1][j] = this->gameArray[btn->posX-1][j]==0 ? 1:0;}//下if(btn->posY+1<=3){this->coinBtn[btn->posX][btn->posY+1]->changeFlag();this->gameArray[btn->posX][btn->posY+1] = this->gameArray[btn->posX][btn->posY+1]==0 ? 1:0;}//上if(btn->posY-1>=0){this->coinBtn[btn->posX][btn->posY-1]->changeFlag();this->gameArray[btn->posX][btn->posY-1] = this->gameArray[btn->posX][btn->posY-1]==0 ? 1:0;}//开始判断是否胜利if(true == isWin()){qDebug()<<"shengli";SetWin();//开始显示胜利图片QPropertyAnimation *animation1 = new QPropertyAnimation(winLabel , "geometry");animation1->setDuration(500);animation1->setStartValue(QRect(winLabel->x() , winLabel->y() ,winLabel->width() , winLabel->height()));animation1->setEndValue(QRect(winLabel->x() , winLabel->y()+114 ,winLabel->width() , winLabel->height()));animation1->setEasingCurve(QEasingCurve::OutBounce);animation1->start();}});});}}
}bool playscene:: isWin()
{for(int i=0;i<4;++i){for(int j=0;j<4;++j){if(coinBtn[i][j]->flag == 0){return false;}}}return true;}bool playscene:: SetWin()
{for(int i=0;i<4;++i){for(int j=0;j<4;++j){coinBtn[i][j]->iswin = true;}}return true;}void playscene:: paintEvent(QPaintEvent *event)
{QPainter painter(this);QPixmap pix;pix.load(":/res/PlayLevelSceneBg.png");painter.drawPixmap(0 ,0 , this->width() , this->height(),pix);pix.load(":/res/Title.png");pix = pix.scaled(pix.width()/2 , pix.height()/2);painter.drawPixmap(10 ,30 , pix);}

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

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

相关文章

【Linux操作系统】探秘Linux奥秘:shell 编程的解密与实战

&#x1f308;个人主页&#xff1a;Sarapines Programmer&#x1f525; 系列专栏&#xff1a;《操作系统实验室》&#x1f516;诗赋清音&#xff1a;柳垂轻絮拂人衣&#xff0c;心随风舞梦飞。 山川湖海皆可涉&#xff0c;勇者征途逐星辉。 目录 &#x1fa90;1 初识Linux OS &…

windows下使用PowerShell切割大数据文件

测试文件为24.4G文件 打开PowerShell窗口&#xff0c;使用以下命令 $filePath 为指向文件路径 $outputPath 输出到指定文件夹 $chunkSize 单个文件控制切割大小 将命令修改完后&#xff0c;直接粘贴到powershell窗口&#xff0c;点击回车即可进行切割 $filePath "D:\…

C#编程-使用集合

使用集合 您学习了如何使用数组来有效地存储和操作相似类型额数据。但是,以下限制于数组的使用相关联: 您必须在声明时定义数组的大小。您必须编写代码以对数组执行标准操作,如排序。让我们思考一个示例。假设您想要存储在组织工作的五个雇员的姓名。您可以使用以下语句来声…

使用OHOS SDK构建assimp

参照OHOS IDE和SDK的安装方法配置好开发环境。 从github下载源码。 执行如下命令&#xff1a; git clone https://github.com/assimp/assimp.git进入源码所在的目录&#xff0c;创建批处理文件ohos_build.cmd&#xff0c;内容如下&#xff1a; echo off setlocalset OHOS_S…

多级缓存、OpenResty缓存、Redis分布式缓存、进程缓存

目录标题 一、预期表现二、环境配置1、nginx环境2、OpenResty环境3、redis环境3.1 安装redis3.2 配置启动命令3.3 配置主从3.4 哨兵 4、进程缓存环境 三 、主要编码工作3.1、缓存主要问题解决3.1.1 缓存穿透3.1.2 缓存雪崩3.1.3 缓存击穿 3.2、OpenResty编码3.2.1 openresty/ng…

RabbitMQ快速入门(详细)

RabbitMQ 消息中间件/消息队列 1、消息中间件 1、简介 **消息中间件也可以称消息队列&#xff0c;是指用高效可靠的消息传递机制进行与平台无关的数据交流&#xff0c;并基于数据通信来进行分布式系统的集成。**通过提供消息传递和消息队列模型&#xff0c;可以在分布式环境…

13. 强化学习编程实验1-在格子世界中寻宝(1)

文章目录 1.实验目的2.任务描述3.任务分析3.1 待求问题是多步决策问题否3.2 问题求解过程是一个马尔科夫决策过程3.3 状态空间S的确定3.4 动作空间A的确定3.5 状态转移概率P的确定3.6 立即回报R的确定3.7 折扣 γ \gamma γ的确定 4. 编程架构4.1 程序中有哪些对象和类4.2 环境…

深入理解Word Embeddings:Word2Vec技术与应用

目录 前言1 Word2Vec概述2 CBOW模型2.1 CBOW模型简介2.2 基于词袋&#xff08;bag of word&#xff09;的假设2.3 One-hot向量编码2.4 分类问题 3 Skip-gram模型3.1 Skip-gram模型简介3.2 目标词预测上下文3.3 词语关联性的捕捉 4 优化Word2Vec模型的方法4.1 负采样和分层softm…

MyBatis-Plus框架学习笔记

先赞后看&#xff0c;养成习惯&#xff01;&#xff01;&#xff01;❤️ ❤️ ❤️ 文章码字不易&#xff0c;如果喜欢可以关注我哦&#xff01; ​如果本篇内容对你有所启发&#xff0c;欢迎访问我的个人博客了解更多内容&#xff1a;链接地址 MyBatisPlus &#xff08;简称…

获取线程池中任务执行数量

获取线程池中任务执行数量 通过线程池进行任务处理&#xff0c;有时我们需要知道线程池中任务的执行状态。通过ThreadPoolExecutor的相关API实时获取线程数量&#xff0c;排队任务数量&#xff0c;执行完成线程数量等信息。 实例 private static ExecutorService es new Thr…

Spring Boot 生产就绪中文文档-下

本文为官方文档直译版本。原文链接 由于篇幅较长&#xff0c;遂分两篇。上半部分中文文档 Spring Boot 生产就绪中文文档-下 度量标准入门受支持的监控系统AppOpticsAtlasDatadogDynatracev2 API自动配置手动配置 v1 API (旧版)与版本无关的设置 ElasticGangliaGraphiteHumioIn…

AUTOSAR从入门到精通-漫谈autosar软件架构(五)

目录 前言 原理 Autosar软件架构 BSW层中的四个分层 虚拟功能总线VFB及运行环境RTE

推荐几个免费的HTTP接口Mock网站和工具

在前后端分离开发架构下&#xff0c;经常遇到调用后端数据API接口进行测试、集成、联调等需求&#xff0c;比如&#xff1a; &#xff08;1&#xff09;前端开发人员很快开发完成了UI界面&#xff0c;但后端开发人员的API接口还没有完成&#xff0c;不能进行前后端数据接口对接…

Java内存泄漏问题分析

内存泄漏也是一个老八股文了&#xff0c;下面来看看实际项目中内存泄漏的场景分析 时间回到9月某一天 分析阶段一 现象&#xff1a;在当时各种请求在那段时间响应很慢&#xff0c;特别是 kafka异步消费线程 不足点&#xff1a;当时主业务基本不可用&#xff0c;有点急&#…

线特征_LSD直线检测算法和LBD直线描述子

目录 1. 线特征简介 2. LSD直线检测算法 3. LBD直线描述算法 主要参考:2022 硕士论文 南京邮电大学 点线融合的单目语义视觉SLAM 郭强 1. 线特征简介 线特征优点: 线特征在于具有天然的光照及视角不变性,同时更高级的特征也使追踪的鲁棒性和准确性有所提高。特别是在特…

负责任的人工智能与人机环境系统智能

负责任的人工智能是指在人工智能系统的设计、开发、管理、使用和维护过程中&#xff0c;所有相关的角色&#xff08;包括设计者、开发者、管理者、使用者、维护者等等&#xff09;都承担其行为的道义、法律和社会责任。这意味着这些角色需要确保人工智能系统的设计与使用符合伦…

Mathtype7.4安装与嵌入WPS

文章目录 Mathtype安装教程&#xff08;7.4&#xff09;Mathtype简介Mathtype下载安装软件下载软件安装运行MathType.exe运行注册表 Mathtype嵌入wps Mathtype安装教程&#xff08;7.4&#xff09; Mathtype简介 MathType是一款强大的数学公式编辑器&#xff0c;适用于教育教…

mysql之数据类型、建表以及约束

目录 一. CRUD 1.1 什么是crud 1.2 select(查询) 1.3 INSERT(新增) 1.4 UPDATE(修改&#xff09; 1.5 DELETE(删除) 二. 函数 2.1 常见函数 2.2 流程控制函数 2.3聚合函数 三. union与union all 3.1 union 3.2 union all 3.3 具体不同 3.4 结论 四、思维导图 一. CRUD 1.1…

七、HTML 文本格式化

一、HTML 文本格式化 加粗文本斜体文本电脑自动输出 这是 下标 和 上标 <!DOCTYPE html> <html><head><meta charset"utf-8"><title>HTML文本格式化</title> </head><body><b>加粗文本</b><br>…

计算机网络——应用层(1)

计算机网络——应用层&#xff08;1&#xff09; 小程一言专栏链接: [link](http://t.csdnimg.cn/ZUTXU) 协议原理内容原理小结体系结构分类——重点已标注 进程通信常见形式 因特网运输服务TCP&#xff08;传输控制协议&#xff09;UDP&#xff08;用户数据报协议&#xff09;…