X-Git-Url: https://git.cworth.org/git?p=ttt;a=blobdiff_plain;f=src%2Fttt-board.c;fp=src%2Fttt-board.c;h=e55fda1b9bb48cca37578bfef2875127d9b335c2;hp=d231ea943ad52d4ddb252c1debe773ea4e79b40a;hb=3f50431bd1ad36a1e4cc5a0df7f9f204e8be2b2c;hpb=5166baca35916a708e6ad8539e5cb333bbcfeb18 diff --git a/src/ttt-board.c b/src/ttt-board.c index d231ea9..e55fda1 100644 --- a/src/ttt-board.c +++ b/src/ttt-board.c @@ -44,9 +44,21 @@ void ttt_board_init_from_string (ttt_board_t *board, const char *s) { - /* XXX: NYI */ + int i, j; + j = 0; + for (i = 0; i < strlen (s); i++) + { + if ((s[i] == 'X') | + (s[i] == 'O') | + (s[i] == '_')) + { + board->cells[j] = s[i]; + j++; + } + } } + /* Return the string representation of a board. * * The return value is a malloc()ed string that should be free()ed