Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define S 4
- #define O 9
- char tetris[S][O];
- void feltolt(){
- int i,j;
- for(i=0;i<S;i++){
- for(j=0;j<O;j++){
- tetris[i][j]='.';
- }
- }
- }
- void kiir(){
- int i,j;
- for(i=0;i<S;i++){
- for(j=0;j<O;j++){
- printf("%c", tetris[i][j]);
- }
- printf("\n");
- }
- }
- void beker(){
- int j, poz;
- do{
- j=0;
- printf("rud bal oldalanak pozicioja:\n");
- scanf("%d", &poz);
- do{
- if(poz <= 0 || poz > 7){
- printf("hibas pozicio!\n");
- } else {
- if(tetris[j][poz-1]!='*' && tetris[j][poz]!='*' && tetris[j][poz+1]!='*'){
- if(j==3){
- tetris[j][poz-1]='*';
- tetris[j][poz]='*';
- tetris[j][poz+1]='*';
- j++;
- } else {
- j++;
- }
- } else {
- tetris[j-1][poz-1]='*';
- tetris[j-1][poz]='*';
- tetris[j-1][poz+1]='*';
- j++;
- }
- }
- } while (j<4);
- kiir();
- } while (tetris[0][2] == '.' && tetris[0][5] == '.' && tetris[0][7] == '.');
- }
- int main(){
- feltolt();
- kiir();
- beker();
- return 0;
Add Comment
Please, Sign In to add comment