MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / undo

Function undo

CPP/Problems/maze_game.c:46–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46char undo(head *h, int ply[2], int snk[2])
47{
48 if (h->start == NULL && h->cnt <= 1)
49 return '0';
50 char ch = h->end->dir;
51 ply[0] = h->end->pr[0];
52 ply[1] = h->end->pr[1];
53 snk[0] = h->end->sk[0];
54 snk[1] = h->end->sk[1];
55 memory *temp = h->end;
56 memory *node = h->start;
57 while (node->next != NULL && node->next->next != NULL)
58 node = node->next;
59 if (node->next == NULL)
60 h->start = h->end = NULL;
61 else
62 {
63 node->next = NULL;
64 h->end = node;
65 }
66 h->cnt--;
67 free(temp);
68 return ch;
69}
70
71void del_memory(head *h)
72{

Callers 2

playFunction · 0.85
demo2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected