Just the thing for some fun in a Theory of Computation class. The Turing machine tape is represented as a doubly linked list of pointers. The forward and backward links are XOR'd together and stored in one pointer. If we always keep one of the links on hand, we can recover the other link at any time. The state of the tape is stored in the low order bit of the pointer.
Memory representing a tape cell is allocated when the cell is first scanned.
Thus the simulation begins with a tape effectively the size of virtual memory set to all zeros. Since a header can be added to any Turing program to write initial data and position the scan head, this is little loss of generality. The simulated Turing machine has a single tape with either an 1 or a 0 in each cell. The Turing machine language format is a string of three bytes. The first byte is the current state.