Commit e7f91215 authored by Jakub Čirip's avatar Jakub Čirip
Browse files

Update

parent 3f4b5f0c
...@@ -44,8 +44,8 @@ bool is_game_won(const struct game game){ ...@@ -44,8 +44,8 @@ bool is_game_won(const struct game game){
bool update(struct game *game, int dy, int dx){ bool update(struct game *game, int dy, int dx){
char word[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'}; char w[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'};
int num[] = {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048}; int c[] = {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048};
int chang=0, a=0, int chang=0, a=0,
if(dy==1 && dx==0) if(dy==1 && dx==0)
{ {
...@@ -107,7 +107,7 @@ if(dy==1 && dx==0) ...@@ -107,7 +107,7 @@ if(dy==1 && dx==0)
} }
}else if(dy==0 && dx==1) }else if(dy==0 && dx==1)
{ {
//V PRAVO //V Pravo
chang=0; chang=0;
for(int i=0; i<4; i++){ for(int i=0; i<4; i++){
for(int j=3; 0<j; j--) for(int j=3; 0<j; j--)
...@@ -239,6 +239,7 @@ if(dy==1 && dx==0) ...@@ -239,6 +239,7 @@ if(dy==1 && dx==0)
} }
} }
for(int z=0; 4>z; z++) for(int z=0; 4>z; z++)
l
{ {
for(int v=0; 3>v;v++) for(int v=0; 3>v;v++)
{ {
...@@ -246,7 +247,7 @@ if(dy==1 && dx==0) ...@@ -246,7 +247,7 @@ if(dy==1 && dx==0)
{ {
game->board[i][v]=game->board[i][v+1]; game->board[i][v]=game->board[i][v+1];
game->board[i][v+1]=' '; game->board[i][v+1]=' ';
chang++; chang++;
} }
} }
} }
...@@ -325,7 +326,7 @@ if(dy==1 && dx==0) ...@@ -325,7 +326,7 @@ if(dy==1 && dx==0)
return 0; return 0;
} }
else{ else{
return 1; return 0;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment