基于51单片机俄罗斯方块小游戏

news2024/10/8 22:11:33

基于51单片机俄罗斯方块游戏

(仿真+程序)

功能介绍

具体功能:

1.用LCD12864显示游戏界面;

2.用四个按键控制游戏(左、右移、下移、翻转);

3.游戏规则和平时玩的俄罗斯方块一样;

​演示视频:

基于51单片机俄罗斯方块游戏 

添加图片注释,不超过 140 字(可选)

程序

#include <AT89X51.H>
/***公众号:木子单片机****/
#define DOWNTIME 30
#define MAXHANG 20
#define MAXLIE  16
#define MAXPIX  3
#define PUSHON  50

#define LCD P2
#define EN  P3_0
#define RW  P3_1
#define RS  P3_2
#define CS1 P3_3
#define CS2 P3_4

#define KEYLEFT P1_0
#define KEYDOWN P1_7
#define KEYRIGH P1_6
#define KEYROTATION P1_1

unsigned char gkey=0xff,keystate=0,t0ms1=0,t0ms=0,downtimegap=0;
unsigned char miao=0,fen=0;
unsigned char downok;
bit keyflag,timeupdate,fashionupdate;
unsigned char idata cubeMap[MAXHANG][2];
typedef struct{
               unsigned char code * box;
 			   unsigned char cube : 4;
			   unsigned char state : 4;
			   char row;
			   char column;
			   } block;
block this;
unsigned int score=0;
unsigned char speed=1;
unsigned char code bittable[8]={1,2,4,8,0x10,0x20,0x40,0x80};
unsigned char code cube[]=
{
/*  ■
  ■■■
*/
0,4,0xe,0,  0,2,6,2,     0,7,2,0,     4,6,4,0,

/*■
  ■■■ 
*/
0,8,0xe,0,  0,4,4,0xc,   0,0,0xe,2,   0,6,4,4,
/*■■■
  ■    
*/
0,0xe,8,0,  0,4,4,6,     0,1,7,0,     6,2,2,0,
/*■■
    ■■
*/
0,0xc,6,0,  0,2,6,4,     0,6,3,0,     2,6,4,0,
/*  ■■
  ■■  
*/
0,6,0xc,0,  0,4,6,2,     0,3,6,0,     4,6,2,0,
/*■■■■ 
*/
0,0xf,0,0,  4,4,4,4,     0,0,0xf,0,   2,2,2,2,
/*■■
  ■■ 
*/
0,6,6,0,    0,6,6,0,     0,6,6,0,     0,6,6,0
}; 
unsigned char code asii[]=
{
    0x3E,0x51,0x49,0x45,0x3E, // -0-
    0x00,0x42,0x7F,0x40,0x00, // -1-
    0x62,0x51,0x49,0x49,0x46, // -2-
    0x21,0x41,0x49,0x4D,0x33, // -3-
    0x18,0x14,0x12,0x7F,0x10, // -4-
    0x27,0x45,0x45,0x45,0x39, // -5-
    0x3C,0x4A,0x49,0x49,0x31, // -6-
    0x01,0x71,0x09,0x05,0x03, // -7-
    0x36,0x49,0x49,0x49,0x36, // -8-
    0x46,0x49,0x49,0x29,0x1E, // -9-
    0x00,0x36,0x36,0x00,0x00, // -:-10
//next
    0x7F,0x04,0x08,0x10,0x7F, // -N-11
    0x7F,0x49,0x49,0x49,0x41, // -E-12
    0x63,0x14,0x08,0x14,0x63, // -X-13
    0x01,0x01,0x7F,0x01,0x01, // -T-14
//speed
    0x26,0x49,0x49,0x49,0x32, // -S-15
    0x7F,0x09,0x09,0x09,0x06, // -P-16
    0x7F,0x49,0x49,0x49,0x41, // -E-17
    0x7F,0x41,0x41,0x41,0x3E, // -D-18
//score
    0x3E,0x41,0x41,0x41,0x22, // -C-19   
    0x3E,0x41,0x41,0x41,0x3E, // -O-20
    0x7F,0x09,0x19,0x29,0x46, // -R-21
    0x00,0x00,0x00,0x00,0x00,  // - -22
//GAME OVER
    0x3E,0x41,0x51,0x51,0x72, // -G-23
    0x7C,0x12,0x11,0x12,0x7C, // -A-24
    0x7F,0x02,0x0C,0x02,0x7F, // -M-25
    0x1F,0x20,0x40,0x20,0x1F, // -V-26
//TIME
//  0x00,0x41,0x7F,0x41,0x00  // -I-27
};

void lcdCmd(unsigned char cmd)
{
 bit ea;
 ea=EA;
 EA=0;
 EN=0;
 RW=0;
 RS=0;
 LCD=cmd;
 EN=1;
 EN=1;
 EN=0;
 EA=ea;
}
//-------------------------------------------------------------------------------
void lcdWriteByte(unsigned char ch)
{
 EN=0;
 RS=1;
 RW=0;
 LCD=ch;
 EN=1;
 EN=1;
 EN=0;
}
//--------------------------------------------------------------------------------
void lcdSetPage(unsigned char page)
{
  page &=0x7;
  page +=0xb8;
  lcdCmd(page);
}
//--------------------------------------------------------------------------------
void lcdSetColumn(unsigned char column)
{
  column &=0x3f;
  column +=0x40;
  lcdCmd(column);
}
//--------------------------------------------------------------------------------
//character fron=5*8
void lcdPlayChar(unsigned char index,unsigned char page,unsigned char colume)
{
 unsigned char i,temp;
 unsigned int p;
 p=5*index;
 for(i=colume;i<colume+5;i++)
  {
    if(i<64)
	 {
	  CS1=1;
	  CS2=0;
	  temp=i;
	 }
	else
	 {
	  CS1=0;
	  CS2=1;
	  temp=i-64;
	 }
	lcdSetPage(page);
	lcdSetColumn(temp);
	lcdWriteByte(asii[p++]);
  }
}
//---------------------------------------------------------------------------------
//rectangle(3,0,50,60)
void rectangle(void)
{
  unsigned char i,page;
  CS1=1;
  CS2=0;
  lcdSetPage(0);  
  lcdSetColumn(2); 
  EN=0;
  RS=1;
  RW=0;
  LCD=0xff;
  EN=1;
  EN=1;
  EN=0;
  for(i=3;i<51;i++)
   {
     EN=0;
     RS=1;
     RW=0;
     LCD=0x1;
     EN=1;
     EN=1;
     EN=0;   
   }
  EN=0;
  RS=1;
  RW=0;
  LCD=0xff;
  EN=1;
  EN=1;
  EN=0;
//---------------------------
for(page=1;page<7;page++)
 { 
  lcdSetPage(page);  
  lcdSetColumn(2); 
  EN=0;
  RS=1;
  RW=0;
  LCD=0xff;
  EN=1;
  EN=1;
  EN=0;
  for(i=3;i<51;i++)
   {
     EN=0;
     RS=1;
     RW=0;
     LCD=0x0;
     EN=1;
     EN=1;
     EN=0;   
   }
  EN=0;
  RS=1;
  RW=0;
  LCD=0xff;
  EN=1;
  EN=1;
  EN=0;
 }
//---------------------------
  lcdSetPage(7);  
  lcdSetColumn(2); 
  EN=0;
  RS=1;
  RW=0;
  LCD=0x1f;
  EN=1;
  EN=1;
  EN=0;
  for(i=3;i<51;i++)
   {
     EN=0;
     RS=1;
     RW=0;
     LCD=0x10;
     EN=1;
     EN=1;
     EN=0;   
   }
  EN=0;
  RS=1;
  RW=0;
  LCD=0x1f;
  EN=1;
  EN=1;
  EN=0;
}
//--------------------------------------------------------------------
//x:列;y行,页 3*3
void lcdPutPix(unsigned char x, unsigned char y,unsigned char flag)
{
  unsigned char i,dat,bitmask,nextbit;
  bit bflag,pflag,ea;
  x=x*MAXPIX;
  y=y*MAXPIX;
  bflag=0;
  pflag=0;
  i=y%8;
  if(i==0)
   bitmask=0x7;
  else if(i==1)
   bitmask=0xe;
  else if(i==2)
   bitmask=0x1c;
  else if(i==3)
   bitmask=0x38;
  else if(i==4)
   bitmask=0x70;
  else if(i==5)
   bitmask=0xe0;
  else if(i==6)
   {
    bflag=1;
    bitmask=0xc0;
    nextbit=1;
   }
  else if(i==7)
   {
    bflag=1;
    bitmask=0x80;
    nextbit=3;
   }
  if(x<62)
   {
    CS1=1;
    CS2=0; 
   }
  else if(x>63)
   {
    x-=64;
    CS1=0;
    CS2=1;
   }
  else
   pflag=1;
  lcdSetPage(y/8);
  for(i=x;i<x+MAXPIX;i++)
   {
    if(pflag)
     {
      if(i==62 || i==63)
       {
         CS1=1;
         CS2=0;
         lcdSetPage(y/8);
        }
      else if(pflag && i==64)
       {
        CS1=0;
        CS2=1;
        lcdSetPage(y/8);
       }
      } 
     lcdSetColumn(i); 
     ea=EA;
     EA=0;
     EN=0;
     LCD=0xff;
     RS=1;
     RW=1; 
     EN=1; 
     EN=0;
 
     EN=1; 
     dat=LCD;
     EN=0;
     if(flag==1)
       dat|=bitmask;
     else
       dat&=~bitmask;
     lcdSetColumn(i);  
 
     EN=0;
     RW=0;
     RS=1;
     LCD=dat;
     EN=1;
     EN=1;
     EN=0;
     EA=ea;
   }
 if(bflag)
  {
   lcdSetPage(y/8+1);
   for(i=x;i<x+MAXPIX;i++)
   {
    if(pflag)
     {
      if(i==62 || i==63)
       {
        CS1=1;
        CS2=0;
        lcdSetPage(y/8+1);
       }
      else if(pflag && i==64)
       {
        CS1=0;
        CS2=1;
        lcdSetPage(y/8+1);
       }
      } 
     lcdSetColumn(i); 
     ea=EA;
     EA=0;
     EN=0;
     LCD=0xff;
     RS=1;
     RW=1; 
     EN=1; 
     EN=0;
 
     EN=1; 
     dat=LCD;
     EN=0;
     if(flag==1)
       dat|=nextbit;
     else
       dat&=~nextbit;
     lcdSetColumn(i);  
 
     EN=0;
     RW=0;
     RS=1;
     LCD=dat;
     EN=1;
     EN=1;
     EN=0;
     EA=ea;  
  }
 }
}
//------------------------------------------------------------------
void lcdClear(void)
{
  unsigned char i,page;
  CS1=1;
  CS2=0;
  for(page=0;page<8;page++)
   {
    lcdSetPage(page);
    lcdSetColumn(0);
    for(i=0;i<64;i++)
	   lcdWriteByte(0);
   }
  CS1=0;
  CS2=1;
  for(page=0;page<8;page++)
   {
    lcdSetPage(page);
    lcdSetColumn(0);
    for(i=0;i<64;i++)
	   lcdWriteByte(0);
   }
}
//-----------------------------------------------------------------
#define STAR 53
#define WIDE 6
void lcdIni(void)
{
 lcdCmd(0x3f);
 lcdCmd(0xc0);
 lcdClear();
 rectangle();
//NEXT
 lcdPlayChar(11,0,STAR);
 lcdPlayChar(12,0,STAR+1*WIDE);
 lcdPlayChar(13,0,STAR+2*WIDE);
 lcdPlayChar(14,0,STAR+3*WIDE);
//SPEED
 lcdPlayChar(15,3,STAR);
 lcdPlayChar(16,3,STAR+1*WIDE);
 lcdPlayChar(17,3,STAR+2*WIDE);
 lcdPlayChar(17,3,STAR+3*WIDE);
 lcdPlayChar(18,3,STAR+4*WIDE);
//01
 lcdPlayChar(0,4,STAR+2*WIDE);
 lcdPlayChar(1,4,STAR+3*WIDE);
 
//SCORE
 lcdPlayChar(15,5,STAR);
 lcdPlayChar(19,5,STAR+1*WIDE);
 lcdPlayChar(20,5,STAR+2*WIDE);
 lcdPlayChar(21,5,STAR+3*WIDE);
 lcdPlayChar(12,5,STAR+4*WIDE);

 lcdPlayChar(0,6,STAR+1*WIDE);
 lcdPlayChar(0,6,STAR+2*WIDE);
 lcdPlayChar(0,6,STAR+3*WIDE);
 lcdPlayChar(0,6,STAR+4*WIDE);
//TIME
 lcdPlayChar(0,7,STAR);
 lcdPlayChar(0,7,STAR+1*WIDE);
 lcdPlayChar(10,7,STAR+2*WIDE);
 lcdPlayChar(0,7,STAR+3*WIDE);
 lcdPlayChar(0,7,STAR+4*WIDE);
}
//-----------------------------------------------------------------
void showScoreSpeed(void)
{
  unsigned char num[5];
  char i;
  unsigned int temp;
  temp=score;
  for(i=0;i<5;i++)
   {
     num[i]=temp%10;
	 temp=temp/10;
   }
  for(i=4;i>0;i--)
   {
     if(num[i]==0)
	  num[i]=22;
	 else
	  break;
   }
  for(i=4;i>-1;i--)
   lcdPlayChar(num[i],6,STAR+(4-i)*WIDE);

 lcdPlayChar(speed/10,4,STAR+2*WIDE);
 lcdPlayChar(speed%10,4,STAR+3*WIDE);
}
//-------------------------------------------------------------------
void timeServer(void)
{
  if(timeupdate)
   {
    timeupdate=0;
    lcdPlayChar(fen/10,7,STAR);
    lcdPlayChar(fen%10,7,STAR+1*WIDE);
    lcdPlayChar(10,7,STAR+2*WIDE);
    lcdPlayChar(miao/10,7,STAR+3*WIDE);
    lcdPlayChar(miao%10,7,STAR+4*WIDE);    
   }
  if(fashionupdate)
   {
     fashionupdate=0;
     lcdPlayChar(22,7,STAR+2*WIDE);
   }
}
//===================================================================
void t0isr(void) interrupt 1
{
  unsigned char key;
  TH0=(65536-10000)/256;
  TL0=(65536-10000)%256;
  downtimegap++;
  t0ms=++t0ms%100;
  if(t0ms==0)
   {
     timeupdate=1;
     miao=++miao%60;
	 if(miao==0)
	  fen=++fen%60;
   }
  if(t0ms==50)
   fashionupdate=1;
//----------------------------
  key=0xff;
  KEYLEFT=1;
  KEYRIGH=1;
  KEYROTATION=1;
  KEYDOWN=1;
  if(!KEYLEFT)
    key=0;
  if(!KEYRIGH)
    key=1;
  if(!KEYROTATION)
    key=2;
  if(!KEYDOWN)
    key=3;

  switch(keystate)
   {
    case 0: if(key!=gkey)
	         {
			  gkey=key;
			  keystate=1;
			 }
			break;
   case 1: if(key==gkey)
             {
			   t0ms1=0;
			   keystate=2;
			   if(key!=0xff)
			     keyflag=1;
			 }
		   else
		     keystate=0;
		   break;
   case 2: if(key==gkey)
             {
			   if(t0ms1<PUSHON)
			     t0ms1++;
			 }
		   else
		    {
			  keystate=0;
			  keyflag=0;
			  gkey=0xff;
			}
		   break;
   }

}
//===================================================================
void showNextCube(unsigned char code * p,unsigned char x,unsigned char y)
{
 unsigned char i,j,temp;
  for(i=0;i<4;i++)
   {  
      temp=1;
      for(j=0;j<4;j++)
      {
        if(p[i] & temp)
         lcdPutPix(x+j,y+i,1); 
        else
         lcdPutPix(x+j,y+i,0); 
        temp<<=1;
      }
   }  
}
//------------------------------------------------------------------
void createCube(void)
{
  static unsigned char next;
  this.cube=next;
  next=TL0%7;
  this.row=0;
  this.column=6;
  this.state=0;
  this.box=cube+16*this.cube;
  showNextCube(cube+16*next,19,3);
}
//------------------------------------------------------------------
void showCubeMap(void)
{
 unsigned char hang,lie,temp; 
 for(hang=MAXHANG-1;hang>0;hang--)
  {
   if(cubeMap[hang][0]==0 && cubeMap[hang][1]==0)
     break;

   for(lie=0;lie<(MAXLIE/8);lie++)
    {
     temp=8*lie;
     if(cubeMap[hang][lie]&0x01)
       lcdPutPix(temp+1,hang,1);

     if(cubeMap[hang][lie]&0x02)
       lcdPutPix(temp+2,hang,1);

     if(cubeMap[hang][lie]&0x04)
       lcdPutPix(temp+3,hang,1);

     if(cubeMap[hang][lie]&0x08)
       lcdPutPix(temp+4,hang,1);

     if(cubeMap[hang][lie]&0x10)
       lcdPutPix(temp+5,hang,1);

     if(cubeMap[hang][lie]&0x20)
       lcdPutPix(temp+6,hang,1);

     if(cubeMap[hang][lie]&0x40)
       lcdPutPix(temp+7,hang,1);

     if(cubeMap[hang][lie]&0x80)
       lcdPutPix(temp+8,hang,1);
    }
  }
}
//-------------------------------------------------------------------
void writeCubeToMap(void)
{
  unsigned char row,column,temp;
  unsigned char hang,lie;
  for(row=0;row<4;row++)
   {
     temp=1;
     for(column=0;column<4;column++)
	  {
	    if(this.box[row] & temp)
		 {
		   hang=this.row+row;
		   lie=this.column+column;
           cubeMap[hang][lie/8] |=bittable[lie%8];
	       lcdPutPix(lie+1,hang,1);			  
		 }
		temp<<=1;
	  }
   }
}
//-------------------------------------------------------------------
void clearCubeFromMap(void)
{
  unsigned char row,column,temp;
  unsigned char hang,lie;
  for(row=0;row<4;row++)
   {
     temp=1;
     for(column=0;column<4;column++)
	  {
	    if(this.box[row] & temp)
		 {
		   hang=this.row+row;
		   lie=this.column+column;
           cubeMap[hang][lie/8] &=~bittable[lie%8];
	       lcdPutPix(lie+1,hang,0);		  
		 }
		temp<<=1;
	  }
   }
}
//-------------------------------------------------------------------
unsigned char checkBorder(void)
{
 if(this.box[3]!=0 && this.row>(MAXHANG-4)) 
    return 1;
  else if(this.box[2]!=0 && this.row>(MAXHANG-3))
    return 1;
  else if(this.box[1]!=0 && this.row>(MAXHANG-2))
    return 1;
  else if(this.box[0]!=0 && this.row>(MAXHANG-1))
    return 1;
//---------------------
  if((this.box[0] & 0x01) || (this.box[1] & 0x01) || (this.box[2] & 0x01) ||(this.box[3] & 0x01) ) 
   {
     if(this.column<0)
      return 1;
   }   
  else if((this.box[0] & 0x02) || (this.box[1] & 0x02) || (this.box[2] & 0x02) ||(this.box[3] & 0x02) ) 
   {
     if(this.column<-1)
      return 1;
   }
  else if((this.box[0] & 0x04) || (this.box[1] & 0x04) || (this.box[2] & 0x04) ||(this.box[3] & 0x04) ) 
   {
     if(this.column<-2)
      return 1;
   }
   else if((this.box[0] & 0x08) || (this.box[1] & 0x08) || (this.box[2] & 0x08) ||(this.box[3] & 0x08) ) 
   {
     if(this.column<-3)
      return 1;
   }
//---------------------
  if((this.box[0] & 0x08) || (this.box[1] & 0x08) || (this.box[2] & 0x08) ||(this.box[3] & 0x08) ) 
   {
     if(this.column>(MAXLIE-4))
      return 1;
   }   
  else if((this.box[0] & 0x04) || (this.box[1] & 0x04) || (this.box[2] & 0x04) ||(this.box[3] & 0x04) )
   {
     if(this.column>(MAXLIE-3))
      return 1;
   }
  else if((this.box[0] & 0x02) || (this.box[1] & 0x02) || (this.box[2] & 0x02) ||(this.box[3] & 0x02) ) 
   {
     if(this.column>(MAXLIE-2))
      return 1;
   }
  else if((this.box[0] & 0x08) || (this.box[1] & 0x08) || (this.box[2] & 0x08) ||(this.box[3] & 0x08) ) 
   {
     if(this.column>(MAXLIE-1))
      return 1;
   }
//--------------------
  return 0;
}
//------------------------------------------------------------------
unsigned char checkClask(void)
{
  unsigned char row,column,temp;
  unsigned char hang,lie;
  for(row=0;row<4;row++)
   {
     temp=1;
     for(column=0;column<4;column++)
	  {
	    if(this.box[row] & temp)
 	      {
		    hang=this.row+row;
			lie=this.column+column;
		    if(cubeMap[hang][lie/8] & bittable[lie%8])
			  return 1;
		  }
		temp<<=1;
	  }
   }
  return 0;
}
//-------------------------------------------------------------------
void checkMap(void)
{
  unsigned char i,j,delete;
  bit full;
  full=0;
  delete=0;
  for(i=MAXHANG-1;i>0;i--)
   {
     if(cubeMap[i][0]==0 && cubeMap[i][1]==0)
 	   break;
	 if(cubeMap[i][0]==0xff && cubeMap[i][1]==0xff)
	   {
	     delete++;
		 full=1;
		 for(j=i;j>0;j--)
		  {
		    cubeMap[j][0]=cubeMap[j-1][0];
		    cubeMap[j][1]=cubeMap[j-1][1];
		  }
		 i++;
		 cubeMap[0][0]=0;
		 cubeMap[0][1]=0;
	   }
   }
 if(full)
  {
    if(delete==1)
	  score++;
	else if(delete==2)
	  score+=4;
	else if(delete==3)
	  score+=9;
	else if(delete==4)
	  score+=16;
	rectangle();
	showCubeMap();
    if(score<50)
	 speed=1;
	else if(score<100)
	 speed=2;
	else if(score<500)
	 speed=3;
	else if(score<1000)
	 speed=4;
	else if(score<5000)
	 speed=5;
	else if(score<10000)
	 speed=6;
	else if(score<20000)
	 speed=7;
	else if(score<30000)
	 speed=8;
	else if(score<40000)
	 speed=9;
	else if(score<50000)
	 speed=10;
	else if(score<60000)
	 speed=11;
	else 
	 speed=12;  
	showScoreSpeed();
  }
}
//-------------------------------------------------------------------
void moveLeft(void)
{
  clearCubeFromMap();
  this.column--;
  if(checkBorder() || checkClask())
    this.column++;
  writeCubeToMap();
}
//-------------------------------------------------------------------
void moveRigh(void)
{
  clearCubeFromMap();
  this.column++;
  if(checkBorder() || checkClask())
    this.column--;
  writeCubeToMap();
}
//-------------------------------------------------------------------
void moveDown(void)
{
  clearCubeFromMap();
  this.row++;
  if(checkBorder() || checkClask())
   {
    this.row--;
	downok=1;
   }
  else
   downok=0;
  writeCubeToMap();
  if(downok)
    checkMap();
}
//------------------------------------------------------------------
void cubeRotation(void)
{
  unsigned char temp;
  temp=this.state;
  clearCubeFromMap();
  this.state=++this.state%4;
  this.box=cube+16*this.cube+4*this.state;
  if(checkBorder() || checkClask())
   {
     this.state=temp;
     this.box=cube+16*this.cube+4*this.state;
   }
  writeCubeToMap(); 
}
/

硬件设计

使用元器件:

单片机:AT89C52;

(注意:单片机是通用的,无论51还是52、无论stc还是at都一样,引脚功能都一样。程序也是一样的。)

添加图片注释,不超过 140 字(可选)

设计资料

01仿真图

本设计使用proteus7.8和proteus8.9两个版本设计!具体如图!

添加图片注释,不超过 140 字(可选)

02程序

本设计使用软件keil5版本编程设计!具体如图!

添加图片注释,不超过 140 字(可选)

03设计资料

        资料获取请关注同名公众号,全部资料包括仿真源文件 、程序等。具体内容如下,全网最全! !

可以关注下方公众号!

点赞分享一起学习成长。

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

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

相关文章

Qt窗口与对话框

目录 Qt窗口 1.菜单栏 2.工具栏 3.状态栏 4.滑动窗口 QT对话框 1.基础对话框QDiaog 创建新的ui文件 模态对话框与非模态对话框 2.消息对话框 QMessageBox 3.QColorDialog 4.QFileDialog文件对话框 5.QFontDialog 6.QInputDialog Qt窗口 前言&#xff1a;之前以上…

天才程序员周弈帆 | Stable Diffusion 解读(二):论文精读

本文来源公众号“天才程序员周弈帆”&#xff0c;仅用于学术分享&#xff0c;侵权删&#xff0c;干货满满。 原文链接&#xff1a;Stable Diffusion 解读&#xff08;二&#xff09;&#xff1a;论文精读 【小小题外话】端午安康&#xff01; 在上一篇文章天才程序员周弈帆 …

初阶 《函数》 4. 函数的调用

4. 函数的调用 4.1 传值调用 函数的形参和实参分别占有不同内存块&#xff0c;对形参的修改不会影响实参 4.2 传址调用 传址调用是把函数外部创建变量的内存地址传递给函数参数的一种调用函数的方式 这种传参方式可以让函数和函数外边的变量建立起真正的联系&#xff0c;也就是…

【数据分析基础】实验三 文件操作、数组与矩阵运算

一&#xff0e;实验目的 掌握上下文管理语句with的使用方法。掌握文本文件的操作方法。了解os、os.path模块的使用。掌握扩展库Python-docx、openpyxl的安装与操作word、Excel文件内容的方法。熟练掌握numpy数组相关运算和简单应用。熟练使用numpy创建矩阵&#xff0c;熟悉常用…

matlab演示地月碰撞

代码 function EarthMoonCollisionSimulation()% 初始化参数earth_radius 6371; % 地球半径&#xff0c;单位&#xff1a;公里moon_radius 1737; % 月球半径&#xff0c;单位&#xff1a;公里distance 384400; % 地月距离&#xff0c;单位&#xff1a;公里collision_tim…

【JAVASE】java语法(成员变量与局部变量的区别、赋值运算符中的易错点)

一&#xff1a;成员变量与局部变量的区别 区别 成员变量 局部变量 类中位置不同 …

高通Android开关机动画踩坑简单记录

1、下面报错有可能是selinux的原因 Read-only file system 2、接着push 动画 reboot之后抓取logcat出现 &#xff0c;以下这个报错。看着像是压缩格式有问题。 3、于是重新压缩一下报错没有再出现 &#xff0c;压缩格式默认是标准&#xff0c;这里必须要改成存储格式哈 4、修改…

python-数字黑洞

[题目描述] 给定一个三位数&#xff0c;要求各位不能相同。例如&#xff0c;352是符合要求的&#xff0c;112是不符合要求的。将这个三位数的三个数字重新排列&#xff0c;得到的最大的数&#xff0c;减去得到的最小的数&#xff0c;形成一个新的三位数。对这个新的三位数可以重…

解决windows11开机xbox自启动

1、同时按键盘“ctrlaltdelete”键&#xff0c;在弹出页面中选择任务管理器&#xff1b; 2、点击启动应用 3、找到软件Xbox App Services&#xff0c;选择“已启用”点击右键&#xff0c;点击禁用&#xff1b;

新书推荐:2.3 消息机制

Windows程序的消息机制是指在Windows操作系统下&#xff0c;应用程序与操作系统之间的一种通信方式。通过消息机制&#xff0c;应用程序可以接收来自操作系统的各种事件和请求&#xff0c;以便做出相应的响应和处理。 在Windows程序中&#xff0c;消息机制的实现是基于消息队列…

OpenGauss数据库-6.表空间管理

第1关&#xff1a;创建表空间 gsql -d postgres -U gaussdb -W passwd123123 CREATE TABLESPACE fastspace OWNER omm relative location tablespace/tablespace_1; 第2关&#xff1a;修改表空间 gsql -d postgres -U gaussdb -W passwd123123 ALTER TABLESPACE fastspace R…

Gh-ost让MySQL在线表结构变更不再是难题

Gh-ost&#xff1a;无缝迁移&#xff0c;效率与安全并行- 精选真开源&#xff0c;释放新价值。 概览 gh-ost是由GitHub团队精心打造的在线MySQL表结构迁移工具&#xff0c;它以一种无需触发器的方式&#xff0c;实现了对数据库表结构变更的在线操作。gh-ost的设计初衷是解决现…

matlab使用教程(95)—显示地理数据

下面的示例说明了多种表示地球地貌的方法。此示例中的数据取自美国商务部海洋及大气管理局 (NOAA) 国家地理数据中心&#xff0c;数据通告编号为 88-MGG-02。 1.关于地貌数据 数据文件 topo.mat 包含地貌数据。topo 是海拔数据&#xff0c;topomap1 是海拔的颜色图。 load t…

【HarmonyOS】鸿蒙应用模块化实现

【HarmonyOS】鸿蒙应用模块化实现 一、Module的概念 Module是HarmonyOS应用的基本功能单元&#xff0c;包含了源代码、资源文件、第三方库及应用清单文件&#xff0c;每一个Module都可以独立进行编译和运行。一个HarmonyOS应用通常会包含一个或多个Module&#xff0c;因此&am…

【力扣高频题】003.无重复字符的最长子串

前段时间和小米的某面试官聊天。因为我一直在做 算法文章 的更新&#xff0c;就多聊了几句算法方面的知识。 并且在聊天过程中获得了一个“重要情报”&#xff1a;只要他来面试&#xff0c;基本上每次的算法题&#xff0c;都会去考察关于 子串和子序列 的问题。 的确&#xf…

【第14章】SpringBoot实战篇之多环境配置

文章目录 前言一、通用配置文件1. 定义2. 使用2.1 application.yml2.2 启动类 3. 测试 二、多环境配置文件1.定义1.1 application-local.yml1.2 application-dev.yml1.3 application-test.yml1.4 application-prod.yml 2.使用2.1 application.yml2.2 启动类 3.测试 三、多环境配…

OPPO高级项目经理曹帆受邀为第十三届中国PMO大会演讲嘉宾

全国PMO专业人士年度盛会 OPPO互联网服务系统内容生态中心高级互联网项目经理曹帆先生受邀为PMO评论主办的2024第十三届中国PMO大会演讲嘉宾&#xff0c;演讲议题为“加、减、乘、除——激活项目团队效能”。大会将于6月29-30日在北京举办&#xff0c;敬请关注&#xff01; 议…

操作系统入门系列-MIT6.828(操作系统工程)学习笔记(五)---- 操作系统的组织结构(OS design)

系列文章目录 操作系统入门系列-MIT6.S081&#xff08;操作系统&#xff09;学习笔记&#xff08;一&#xff09;---- 操作系统介绍与接口示例 操作系统入门系列-MIT6.828&#xff08;操作系统工程&#xff09;学习笔记&#xff08;二&#xff09;----课程实验环境搭建&#x…

[spring] Spring MVC Thymeleaf(上)

[spring] Spring MVC & Thymeleaf&#xff08;上&#xff09; 本章内容主要过一下简单的 Spring MVC 的案例 简单来说&#xff0c;spring mvc 就是比较传统的网页开发流程&#xff0c;目前 boot 是可以比较轻松的配置 thymeleaf——毕竟 spring boot 内置对 thymeleaf 的…

Docker与Docker-Compose详解

1、Docker是什么&#xff1f; 在计算机中&#xff0c;虚拟化(英语: Virtualization) 是一种资源管理技术&#xff0c;是将计算机的各种实体资源&#xff0c;如服务器、网络、内存及存储等&#xff0c;予以抽象、转换后呈现出来&#xff0c;打破实体结构间的不可切割的障碍&…