Advertisement
StabOnes

Untitled

May 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. void turing(DbLink *list, struct _progr arr[], int cmd) {
  2.     int headstate = 1, error = 0;
  3.     char replace_symb = 0;
  4.     int i = 0;
  5.     Raw *buff, *tmp;
  6.     tmp = list->head;
  7.     while (tmp != NULL && error != 1) {
  8.         for (i = 0; i < cmd; i++) {
  9.             buff = tmp->value;
  10.             if (buff == arr[i].inputsymb && headstate == arr[i].state) {
  11.                 replace_symb = arr[i].outputsymb;
  12.                 headstate = arr[i].newstate;
  13.                 printf("%c ", replace_symb);
  14.                 switch (arr[i].action) {
  15.                 case 'R': { tmp = tmp->next; break;}
  16.                 case 'L': { tmp = tmp->prev; break;}
  17.                 case 'S': { error = 1; break;}
  18.                 }
  19.             }
  20.         }
  21.     }
  22.     printf("\n");
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement