59 lines
1.0 KiB
C
59 lines
1.0 KiB
C
//
|
|
// Created by nano on 5/9/25.
|
|
//
|
|
|
|
#ifndef ROBOT_H
|
|
#define ROBOT_H
|
|
#include "../cell/cell.h"
|
|
#include "../stack/stack.h"
|
|
|
|
#define MAZE_SIZE 11
|
|
|
|
typedef enum {
|
|
NORTH = 0,
|
|
EAST = 1,
|
|
SOUTH = 2,
|
|
WEST = 3
|
|
} direction;
|
|
|
|
|
|
typedef struct {
|
|
cell pos;
|
|
direction dir;
|
|
} robot;
|
|
|
|
void turnLeft(robot *r);
|
|
|
|
void turnRight(robot *r);
|
|
|
|
void turnAround(robot *r);
|
|
|
|
void forward(robot *r);
|
|
|
|
void backward(robot *r);
|
|
|
|
const char *directionToString(direction dir);
|
|
|
|
int determineDirection(cell from, cell to);
|
|
|
|
int determineDirectionFromMove(cell move);
|
|
|
|
int getStartDirection(cell startCell);
|
|
|
|
void spin(robot *robot, direction desiredDirection);
|
|
|
|
int move(robot *r, cell move);
|
|
|
|
void printMatrix_with_current_pos(int m[][MAZE_SIZE], robot r);
|
|
|
|
void register_sensor_blockages(robot* r, int sensorInput, int visited[MAZE_SIZE][MAZE_SIZE]);
|
|
|
|
int followPath_with_blockages(robot *r, stack *path,int visited[MAZE_SIZE][MAZE_SIZE]);
|
|
|
|
void simple_control();
|
|
|
|
void printAllMoves();
|
|
void parkBackwards(robot *r);
|
|
void comm_discard_sensor_data(int timeout);
|
|
#endif //ROBOT_H
|