Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Rage against the Turing Machine (confoo)

Avatar for Igor Wiedler Igor Wiedler
February 27, 2014

Rage against the Turing Machine (confoo)

Lightning talk.

Avatar for Igor Wiedler

Igor Wiedler

February 27, 2014
Tweet

More Decks by Igor Wiedler

Other Decks in Programming

Transcript

  1. while (!in_array($state, $accept_states)) { $read_val = isset($tape[$position]) ? $tape[$position] :

    '_'; ! if (!isset($rules[$state][$read_val])) { throw new NoTransitionException(); } ! list($write_val, $move_dir, $new_state) = $rules[$state][$read_val]; ! $tape[$position] = $write_val; ! if ('l' === $move_dir) { $position--; if ($position < 0) { $position++; array_unshift($tape, '_'); } } else if ('r' === $move_dir) { $position++; if ($position >= count($tape)) { array_push($tape, '_'); } } ! $state = $new_state; }
  2. U M