diff options
| author | tslil <tslil@posteo.de> | 2020-12-29 22:48:53 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | 0a3b2d825077b5e6c5f1cf4a0dcb13fdfffc0be6 (patch) | |
| tree | 08b71fbf1810806e628bbf7f8d7b121d9b7c8443 /include/ptn.c | |
| parent | e57746530836b24b6d8d20e41239e955fa9e20d4 (diff) | |
Working on the big wrapper for everything
Diffstat (limited to 'include/ptn.c')
| -rw-r--r-- | include/ptn.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/include/ptn.c b/include/ptn.c index 66b4ad8..3d9c0a5 100644 --- a/include/ptn.c +++ b/include/ptn.c @@ -3,7 +3,21 @@ #define ASSERT_NONEMPTY { if (ptn == 0 || *ptn == 0) return PTN_INVALID; } #define ASSERT_MORE { if (*ptn == 0) return PTN_INVALID; } -enum PTN_PARSE_RESULT +uint8_t +likely_move(char *ptn) { + if (ptn == 0) return 0; + for (;;ptn++) { + switch (*ptn) { + case '+': + case '-': + case '>': + case '<': return 1; + case 0: return 0; + } + } +} + +enum E_RESULT parse_place(const uint8_t board_size, char *ptn, uint8_t *out_location, enum STONE_VARIANT *out_stone) { @@ -33,7 +47,7 @@ parse_place(const uint8_t board_size, char *ptn, return PTN_VALID; } -enum PTN_PARSE_RESULT +enum E_RESULT parse_move(const uint8_t board_size, char *ptn, uint8_t *out_location, enum MOVE_DIRECTION *out_direction, uint8_t *out_steps, uint8_t out_drops[5]) { |
