Recently, I learned C and wanted to do a big exercise. So I chose tetris. I am a computer science student. To tell the truth, the theory is okay, and my hands-on skills are poor. I asked my students to do it first, then I will explain to him how to build the Russian square step by step. I feel that this is also a small challenge to me. After all, the university is much deserted and has little to do.
There are a lot of square on the Internet, because C is used, and Chen Chang was chosen as the learning template.
Environment: Win-TC 1.91
Key Technology Chen Chang wrote in detail: http://kb.cnblogs.com/a/341517/
Source code: http://www.pudn.com/downloads67/sourcecode/game/detail241488.html
Although the source code cannot be downloaded (to be registered), it can be previewed and can be used directly... note: I <X instead of I = X should be used for the second variable in the for loop in Chen Chang edition. In some cases, you have to change it yourself. In general, it is correct. Chen Chang's code is well written, with clear structure, smoothness, and rigor. It is a good learning template.
1. There are two important data structures:
How do I represent 1.19 different images?
Struct shape
{
Int XY [8];
Int color;
Int next;
}
2. How is the Panel represented?
Struct boards
{
Int exist;
Int color;
} // Slightly different from Chen Chang
Write it here first. If you are free, continue.