#include "tetris_c.h"
/*
* 0 1 2 3 4 5
* ... ... ... ... ... x..
* ... x.. ..x xx. .xx xx.
*/
int tt[][3] = { { 0, 2, 5 }, { 1, 0, 2 }, { 2, 0, 1 }, { 3, 2, 4 }, { 4, 1, 3 }, { 5, 3, 0 } };
int pp[][3] = { { 0, 0, 0 }, { 0, 1, 1 }, { 0, 0, 0 }, { 0, 2, 1 }, { 0, 0, 0 }, { 0, 1, 1 } };
int rr[][3] = { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 1, 2 }, { 0, 1, 3 }, { 0, 0, 2 } };
static int s, p, r;
void init(int n) {
s = 0, p = r = -1;
}
void new_figure(int c) {
c--;
p = pp[s][c], r = rr[s][c], s = tt[s][c];
}
int get_position() {
return p;
}
int get_rotation() {
return r;
}
Compilation message
grader.c: In function 'main':
grader.c:10:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
10 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
grader.c:12:6: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
12 | scanf("%d", &a[i]);
| ^~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Win! |
2 |
Correct |
0 ms |
348 KB |
Win! |
3 |
Correct |
0 ms |
348 KB |
Win! |
4 |
Correct |
0 ms |
344 KB |
Win! |
5 |
Correct |
0 ms |
348 KB |
Win! |
6 |
Correct |
0 ms |
348 KB |
Win! |
7 |
Correct |
0 ms |
420 KB |
Win! |
8 |
Correct |
1 ms |
348 KB |
Win! |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Game over! After 5 turns. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Win! |
2 |
Correct |
0 ms |
348 KB |
Win! |
3 |
Correct |
0 ms |
348 KB |
Win! |
4 |
Correct |
0 ms |
344 KB |
Win! |
5 |
Correct |
0 ms |
348 KB |
Win! |
6 |
Correct |
0 ms |
348 KB |
Win! |
7 |
Correct |
0 ms |
420 KB |
Win! |
8 |
Correct |
1 ms |
348 KB |
Win! |
9 |
Incorrect |
0 ms |
344 KB |
Game over! After 5 turns. |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Win! |
2 |
Correct |
1 ms |
348 KB |
Win! |
3 |
Correct |
0 ms |
348 KB |
Win! |
4 |
Correct |
0 ms |
348 KB |
Win! |
5 |
Correct |
0 ms |
344 KB |
Win! |
6 |
Correct |
0 ms |
344 KB |
Win! |
7 |
Correct |
1 ms |
348 KB |
Win! |
8 |
Correct |
0 ms |
348 KB |
Win! |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Win! |
2 |
Correct |
0 ms |
348 KB |
Win! |
3 |
Correct |
0 ms |
348 KB |
Win! |
4 |
Correct |
0 ms |
344 KB |
Win! |
5 |
Correct |
0 ms |
348 KB |
Win! |
6 |
Correct |
0 ms |
348 KB |
Win! |
7 |
Correct |
0 ms |
420 KB |
Win! |
8 |
Correct |
1 ms |
348 KB |
Win! |
9 |
Incorrect |
0 ms |
344 KB |
Game over! After 5 turns. |
10 |
Halted |
0 ms |
0 KB |
- |