#ifndef TAPE_H
#define TAPE_H

class Tape {
    class Cell {
    public:
        char symbol;
        Cell *left;
        Cell *right;

        Cell(char c) : symbol(c), left(0), right(0) {}
    };

    Cell *first;
    Cell *last;
    Cell *head;

    void Append(char symbol);
    void Prepend(char symbol);

    // copying is forbidden
    Tape(const Tape &);
    void operator=(const Tape &);

public:
    enum { blank = '_' };

    Tape(const char *input);
    ~Tape();

    char Read() const { return head->symbol; }
    void Write(char c) { head->symbol = c; }

    void Move(char direction);
    void Print() const;
};

#endif
