0.1.6 • Published 5 years ago

turing-machine-js v0.1.6

Weekly downloads
7
License
GPL-3.0-or-later
Repository
github
Last release
5 years ago

turing-machine-js

Build Status GitHub issues

A convenient Turing machine

This repository contains following packages:

Example

import TuringMachine, {
  Alphabet, haltState,
  ifOtherSymbol,
  movements,
  State,
  symbolCommands,
  Tape
} from '@turing-machine-js/machine';

const alphabet = new Alphabet({
  symbolList: ['$', 'a', 'b', 'c'],
});
const tape = new Tape({
  alphabet,
  symbolList: ['a', 'b', 'c'],
});
const machine = new TuringMachine(tape);
const eraseState = new State({
  ['abc']: {
    symbol: symbolCommands.erase,
    movement: movements.right,
  },
  [ifOtherSymbol]: {
    nextState: haltState,
  },
});

console.log(tape.symbolList.join('')); // abc

machine.run(eraseState);

console.log(tape.symbolList.join('')) // $$$$
0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago