You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
866 B
49 lines
866 B
#include "labyrinth.h"
|
|
|
|
#include "global.h"
|
|
|
|
#include "stdio.h"
|
|
#include "stdlib.h"
|
|
|
|
void turn_direction_right(Direction *direction){
|
|
switch (*direction) {
|
|
case N:
|
|
*direction = E;
|
|
break;
|
|
case E:
|
|
*direction = S;
|
|
break;
|
|
case S:
|
|
*direction = W;
|
|
break;
|
|
case W:
|
|
*direction = N;
|
|
break;
|
|
}
|
|
}
|
|
|
|
void lab_move(unsigned short *x, unsigned short *y, Direction direction){
|
|
|
|
if (direction == N){
|
|
*x = *x - 1;
|
|
return;
|
|
}
|
|
if (direction == E){
|
|
*y = *y + 1;
|
|
return;
|
|
}
|
|
if (direction == S){
|
|
*x = *x + 1;
|
|
return;
|
|
}
|
|
if (direction == W){
|
|
*y = *y - 1;
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
void set_wall(State** field, unsigned short x, unsigned short y) {
|
|
field[0][0] = WALL;
|
|
}
|
|
|