#include "tetris.h"
#include <iostream>
void init(int n) {
}
int position;
int rotation;
int type = 0; // 0 是空白,1 是 只有一個在邊邊, 2 是兩個在邊邊,3 是小階梯
int left = 0;
void new_figure(int figure_type) {
if (figure_type == 1) {
position = 0, rotation = 1;
return;
}
if (figure_type == 2) {
if (type == 0) {
position = 0;
rotation = 0;
type = 2, left = 1;
}
else if (type == 1) {
if (left) {
position = 1, rotation = 0;
type = 0;
}
else{
position = 0, rotation = 0;
type = 0;
}
}
else if (type == 2) {
if (left) {
position = 2, rotation = 1;
type = 1, left = 0;
}
else {
position = 0, rotation = 1;
type = 1, left = 1;
}
}
else {
if (left) {
position = 1, rotation = 0;
type = 2, left = 1;
}
else {
position = 0, rotation = 0;
type = 2, left = 0;
}
}
}
else {
if (type == 0) {
position = 0;
rotation = 0;
type = 3, left = 1;
}
else if (type == 1) {
if (left) {
position = 1, rotation = 1;
type = 1, left = 0;
}
else{
position = 0, rotation = 0;
type = 1, left = 1;
}
}
else if (type == 2) {
if (left) {
position = 1, rotation = 3;
type = 2, left = 0;
}
else {
position = 0, rotation = 1;
type = 2, left = 1;
}
}
else {
if (left) {
position = 1, rotation = 2;
type = 0;
}
else {
position = 0, rotation = 1;
type = 0;
}
}
}
}
int get_position() {
return position;
}
int get_rotation() {
return rotation;
}
Compilation message (stderr)
tetris.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
tetris_c.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |