随机生成的俄罗斯方块改为固定生成5个某种俄罗斯方块再继续随机生成
blockType = 1+rand()%7
设置srand()实现。
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
srand(1);
for (int i = 0; i < 10; i++)
{
cout << rand()%100<< " ";
}
cout<<endl;
srand(1);
for (int i = 0; i < 10; i++)
{
cout << rand()%100<< " ";
}
cout<<endl;
srand((int)clock());
for (int i = 0; i < 10; i++)
{
cout << rand()%100<< " ";
}
cout<<endl;
// srand((int)clock());
for (int i = 0; i < 10; i++)
{
cout << rand()%100<< " ";
}
return 0;
}