17 lines
378 B
C++
17 lines
378 B
C++
#include "input.h"
|
|
|
|
#include "constants.h"
|
|
|
|
const char *COMMANDS[] = {
|
|
"no", "so", "ea", "we", "ne", "nw", "se", "sw"
|
|
};
|
|
const int COMMANDS_CNT = 8;
|
|
|
|
game_command get_direction(std::string &str) {
|
|
for (int i = 0; i < COMMANDS_CNT; ++i)
|
|
if (str == COMMANDS[i])
|
|
return (game_command)i;
|
|
|
|
return game_command_panic;
|
|
}
|