Пример #1
0
    start() {
        this.isRunning = true;
        this.isPaused = false;
        this.interpreter = new Interpreter();

        this.currentTest = this.progression.current;

        if (!this.currentTest)
            return;

        const currentTape = Tape.clone(this.currentTest.input);

        this.tapeView.setTape(currentTape);

        this.tapeView.drawTape();
        this.interpreter.setProgram(this.level.program);
        this.interpreter.setTape(currentTape);
        this.interpreter.start();
        this.update();
    }
Пример #2
0
    _createControls() {
        super._createControls();

        const CONTROL_WIDTH = this.width - layout.CONTROL_X;

        this.tapeView = new TapeView(
            this._layer,
            layout.CONTROL_X,
            layout.MARGIN,
            CONTROL_WIDTH - 10,
            (CONTROL_WIDTH - 10) / 10,
            new Tape(),
            Math.floor((this.height / 2 - layout.MARGIN) / ((CONTROL_WIDTH - 10) / 10))
        );

        this.tapeView.drawTape();
        this.programView.drawProgram();
    }