#include "tetris.h"
void init(int n)
{
}
int state;
int position;
int rotation;
/*
0 (0,0,0)
1 (1,0,0)
2 (1,1,0)
3 (1,1,1)
4 (2,1,1)
5 (2,2,1)
*/
void new_figure(int figure_type)
{
switch (figure_type)
{
case 1:
// if (state == 0)
{
position = 0, rotation = 0;
state = 0;
}
// else
// {
// position = 0, rotation = 1;
// if (state == 1)
// state = 2;
// else if (state == 2)
// state = 3;
// else if (state == 3)
// state = 4;
// else if (state == 4)
// state = 5;
// }
break;
case 2:
if (state == 2 || state == 4)
{
position = 1, rotation = 0;
state = 0;
}
else
{
position = 0, rotation = 1;
if (state == 0)
state = 1;
else if (state == 1)
state = 2;
else if (state == 3)
state = 4;
}
break;
case 3:
if (state == 2 || state == 3)
{
position = 0, rotation = 1;
state = 1;
}
else
{
position = 0, rotation = 0;
if (state == 0)
state = 2;
else if (state == 1)
state = 3;
else if (state == 4)
state = 5;
}
break;
default:
break;
}
}
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... |