当前位置:网站首页>Tetris preliminary
Tetris preliminary
2022-06-11 07:15:00 【lihongtao8209】
The following code can show the whereabouts of two blocks .
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <conio.h>
using namespace std;
//Tetris
class point
{
private:
int (*a)[10];
public:
point()
{
}
void at(int (*a)[10])
{
this->a=a;
}
void move(int& k,int &t)
{
if(k==0)
{
a[k][0]=0; // The first box turns black at the beginning
a[k+1][0]=0;// The second space turns black at the beginning
}
if(k!=0 && k<20)
{
a[t][0]=1; // The previous box becomes blank
a[k][0]=0; // Current grid turns black
a[k+1][0]=0;// The next box turns black
}
}
};
class cdown
{
private:
point m_p;
public:
cdown(int (*a)[10])
{
m_p.at(a);
}
void begin(int& k,int &t)
{
m_p.move(k,t);
}
void end(int& k,int& t)
{
if(k<20)
{
printf("%d\n",k);
t=k;
k=k+1;
}
}
void shape(int& k,int& t)
{
}
~cdown()
{
}
};
int main(int argc, char** argv)
{
int i=0;
int j=0;
int k=0;
int t=0;
int a[20][10];
for(i=0; i<20; i++)
{
for(int j=0; j<10; j++)
{
a[i][j]=1;
}
}
cdown down((a));
while(1)
{
down.begin(k,t);
for(i=0; i<20; i++)
{
for(j=0; j<10; j++)
{
if(a[i][j]==0)
{
printf("■");
}
else
{
printf("□");
}
}
printf("\n");
}
down.end(k,t);
sleep(1);
clrscr();
}
return 0;
}
边栏推荐
- 农房一体脚本的心得记录
- This comprehensive understanding
- [Xunwei dry goods] opencv test of Godson 2k1000 development board
- 1、 Sqlserver2008 installation (with password), database creation, C form project test
- No response from win10 explorer when dragging files
- Difference between byte and bit
- Modular notes
- WPF data binding (IV)
- 多线程复习总结之解析Volatile关键字
- Transformer Tracking
猜你喜欢
![[deploy private warehouse based on harbor] 4 push image to harbor](/img/af/8e28b229d94f3e6eab02308b69dc74.jpg)
[deploy private warehouse based on harbor] 4 push image to harbor
![[deploy private warehouse based on harbor] 3 deploy harbor](/img/cd/be68a430e86b4b23ad93b42a338f00.jpg)
[deploy private warehouse based on harbor] 3 deploy harbor
![[Xunwei dry goods] opencv test of Godson 2k1000 development board](/img/94/312bb1f0d5e8d49506f659ad23cd3a.jpg)
[Xunwei dry goods] opencv test of Godson 2k1000 development board

JVM learning record (VII) -- class loading process and parental delegation model

資深OpenStacker - 彭博、Vexxhost昇級為OpenInfra基金會黃金成員

Deep Attentive Tracking via Reciprocative Learning

The difference between arrow function and ordinary function

big.js--使用/实例

Leetcode-141. Linked List Cycle

教育专家王中泽老师多年经验分享:家庭教育不是附庸品
随机推荐
P3811 [template] multiplicative inverse
Leetcode-9.Palindrome Numbber
【CF #277.5 (Div. 2)】B. BerSU Ball
Niuke wrong question 3.1
模块化笔记
1266_ Implementation analysis of FreeRTOS scheduler startup code
webserver
RGB-D Salient Object Detection withCross-Modality Modulation and Selection
Shutter restraint container assembly
Mybags puls will report an error invalid bound statement (not found) when writing an SQL statement in the XML file:
Use definite integral to calculate triangle area
Cv2.rectangle() picture frame
Difference between byte and bit
[Xunwei dry goods] opencv test of Godson 2k1000 development board
Graph Attention Tracking
LEARNING TARGET-ORIENTED DUAL ATTENTION FOR ROBUST RGB-T TRACKING
Promise. All capture error
Senior openstacker - Bloomberg, vexxhost upgraded to gold member of openinfra Foundation
农房一体脚本的心得记录
Shuttle inside and outside margins