Sha256: 211474c39b2fe9fc66903bd6ac63eca86c47b7f9d85ca1e0143ebe6baf018607

Contents?: true

Size: 893 Bytes

Versions: 34

Compression:

Stored size: 893 Bytes

Contents

#ifndef _ROBOT_SIMULATOR_H
#define _ROBOT_SIMULATOR_H

typedef enum {
   Heading_North = 0,
   Heading_East,
   Heading_South,
   Heading_West,
   Heading_Max
} Bearing_t;

enum {
   Default_Bearing = Heading_North,
   Default_X_Coordinate = 0,
   Default_Y_Coordinate = 0,
};

enum {
   Command_Left = 'L',
   Command_Right = 'R',
   Command_Advance = 'A'
};

typedef struct RobotCoordinates {
   int x_position;
   int y_position;
} RobotCoordinates_t;

typedef struct RobotGridStatus {
   Bearing_t bearing;
   RobotCoordinates_t grid;
} RobotGridStatus_t;

RobotGridStatus_t robot_init(void);
RobotGridStatus_t robot_init_with_position(int bearing, int x, int y);
void robot_turn_right(RobotGridStatus_t * robot);
void robot_turn_left(RobotGridStatus_t * robot);
void robot_advance(RobotGridStatus_t * robot);
void robot_simulator(RobotGridStatus_t * robot, const char *commands);

#endif

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
trackler-2.0.6.6 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.6.5 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.6.4 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.6.3 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.6.2 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.6.1 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.6.0 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.18 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.17 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.16 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.15 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.14 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.13 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.12 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.11 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.10 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.9 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.8 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.7 tracks/c/exercises/robot-simulator/src/robot_simulator.h
trackler-2.0.5.6 tracks/c/exercises/robot-simulator/src/robot_simulator.h