]> git.cworth.org Git - ttt/blobdiff - src/ttt-board.c
Add kub program
[ttt] / src / ttt-board.c
index d231ea943ad52d4ddb252c1debe773ea4e79b40a..e55fda1b9bb48cca37578bfef2875127d9b335c2 100644 (file)
@@ -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