139 if(m_shm->
colorCount >= IPC_COLOR_MAX_COUNT) {
181 size_t len = strlen(m_shm->
logData);
183 if(len >= IPC_COLOR_MAX_COUNT-2) {
187 size_t n = IPC_LOG_MAX_BYTES - len - 1;
194 strncat(m_shm->
logData, msg, n);
A class providing a simplified API for the Bots.
Definition: bot_api.h:20
const IpcSegmentInfo * getSegments(void)
Get a pointer to the Segment list.
Definition: bot_api.h:91
const IpcBotInfo * getBots(void)
Get a pointer to the Bot list.
Definition: bot_api.h:107
const IpcFoodInfo * getFood(void)
Get a pointer to the Food list.
Definition: bot_api.h:73
size_t getFoodCount(void)
Get the length of the Food list.
Definition: bot_api.h:80
size_t getBotCount(void)
Get the length of the Bot list.
Definition: bot_api.h:114
Api(IpcSharedMemory *shm)
Constructor for the API interface object.
Definition: bot_api.h:35
bool addColor(uint8_t r, uint8_t g, uint8_t b)
Add a color to the color list.
Definition: bot_api.h:137
const IpcSelfInfo * getSelfInfo(void)
Get a pointer to the self information.
Definition: bot_api.h:62
void log(const char *msg)
Send a log message.
Definition: bot_api.h:179
void clearColors(void)
Clear the color list.
Definition: bot_api.h:122
ipc_real_t angle
The direction into which the bot should move in the current frame.
Definition: bot_api.h:23
void * getPersistentMemory(void)
Get a pointer to the persistent memory.
Definition: bot_api.h:163
const IpcServerConfig * getServerConfig(void)
Get a pointer to the server config data.
Definition: bot_api.h:52
size_t getSegmentCount(void)
Get the length of the Segment list.
Definition: bot_api.h:98
bool boost
Set this to true to boost in this frame.
Definition: bot_api.h:24
IPC representation of a bot.
Definition: ipc_format.h:79
uint8_t g
Green channel (0-255)
Definition: ipc_format.h:103
uint8_t b
Blue channel (0-255)
Definition: ipc_format.h:104
uint8_t r
Red channel (0-255)
Definition: ipc_format.h:102
IPC representation of a food particle.
Definition: ipc_format.h:68
IPC representation of a snake segment.
Definition: ipc_format.h:87
IPC representation of one's own snake and current world parameters.
Definition: ipc_format.h:17
IPC representation of the static server and world configuration.
Definition: ipc_format.h:40
Shared memory structure.
Definition: ipc_format.h:129
struct IpcSelfInfo selfInfo
Information about your snake (updated every frame).
Definition: ipc_format.h:132
struct IpcBotInfo botInfo[IPC_BOT_MAX_COUNT]
List of bots related to segments in segmentInfo.
Definition: ipc_format.h:138
uint8_t persistentData[IPC_PERSISTENT_MAX_BYTES]
Persistent data: will be saved after your snake dies and restored when it respawns.
Definition: ipc_format.h:151
struct IpcSegmentInfo segmentInfo[IPC_SEGMENT_MAX_COUNT]
List of segments seen by the snake.
Definition: ipc_format.h:141
uint32_t segmentCount
Number of items used in segmentInfo.
Definition: ipc_format.h:140
struct IpcColor colors[IPC_COLOR_MAX_COUNT]
Colors to set for this snake.
Definition: ipc_format.h:144
struct IpcFoodInfo foodInfo[IPC_FOOD_MAX_COUNT]
List of food items seen by the snake.
Definition: ipc_format.h:135
uint32_t botCount
Number of items used in botInfo.
Definition: ipc_format.h:137
uint32_t colorCount
Number of items used in colors.
Definition: ipc_format.h:143
char logData[IPC_LOG_MAX_BYTES]
Log data for the current frame.
Definition: ipc_format.h:146
uint32_t foodCount
Number of items used in foodInfo.
Definition: ipc_format.h:134
struct IpcServerConfig serverConfig
Information about the world and server configuration.
Definition: ipc_format.h:130