Module handling incoming/outgoing messages to an "opponent".
More...
Module handling incoming/outgoing messages to an "opponent".
This module contains functionality to interact with the "opponent". The opponent is an executable, that generates Tetrominos. It can run in various modes. For more information on the opponent see.
- Authors
- Philipp Karg (phili.nosp@m.pp.k.nosp@m.arg@t.nosp@m.um.d.nosp@m.e)
- Date
- 04.02.2021
- Copyright
- Philipp Karg 2022
◆ iOpponentInit()
#include <opponent.h>
Initialize the opponent functionality.
- Returns
- (int): 0 if initialization was successful, -1 otherwise.
◆ parseMode()
static bool parseMode |
( |
const char * |
buffer, |
|
|
game_mode_t * |
mode |
|
) |
| |
|
static |
#include <opponent.c>
Parse buffer
into the corresponding game_mode_t.
- Parameters
-
[in] | buffer | (const char*): String to parse. |
[out] | mode | ( game_mode_t *): Object to parse game mode into. |
- Returns
- (bool): whether
buffer
could be parsed.
◆ parseTetrominoType()
#include <opponent.c>
Parse buffer
into the corresponding tetromino_type_t.
- Parameters
-
[in] | buffer | (const char*): String to parse. |
[out] | type | ( tetromino_type_t *): Object to parse Tetromino type into. |
- Returns
- (bool): whether
buffer
could be parsed.
◆ selectGameMode()
static bool selectGameMode |
( |
char * |
buf | ) |
|
|
static |
#include <opponent.c>
Function that reads a game selection from the user.
- Parameters
-
[in] | buf | (char*): String to put the selected game mode in. |
- Returns
- (bool): whether a game mode was selected.
◆ UDPHandler()
static void UDPHandler |
( |
size_t |
readSize, |
|
|
char * |
buffer, |
|
|
void * |
args |
|
) |
| |
|
static |
#include <opponent.c>
Interrupt-Servie-Routine that handles incoming UDP messages.
- Parameters
-
[in] | readSize | (size_t): Size of the buffer. |
[in] | buffer | (char*): The UDP message. |
[in] | args | (void*): Additional arguments. |