LogoLogo
1.0.0
  • Home
  • Install
  • Docs
  • Contribute
  • Journey
  • Welcome
  • The Varphi Language Standard
    • Welcome
    • State Names
    • Tallies and Blanks
    • Head Directions
    • Lines
    • Comments
    • Varphi Programs
    • Addressing Ambiguities
  • Writing Varphi Programs
    • Your First Varphi Program
    • Running Varphi Programs
    • Debugging Varphi Programs
    • The Varphi VS Code Extension
    • Good Practices
    • More Examples
      • Addition By One
      • Add Two Numbers
      • Multiplication By Two
      • Rock, Paper, Scissors
      • Coin Flip
  • Turing Machine Theory
    • The Unary Number System
    • Turing Machine Tapes
    • Turing Machine Heads
    • Turing Machine States
    • Turing Machines
    • Nondeterministic Turing Machines
Powered by GitBook
LogoLogo

© 2025 Hassan El-Sheikha

On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Writing Varphi Programs
  2. More Examples

Add Two Numbers

Below is a Varphi program that adds (i.e., "merges") two contiguous blocks of tallies (containing at least one tally each) separated by a blank tape cell into one contiguous block of tallies.

q0 1 q1 0 R // Remove first tally of left number
q1 1 q1 1 R // Skip remaining tallies of left number
q1 0 q2 1 R // Make middle blank be a tally

PreviousAddition By OneNextMultiplication By Two

Last updated 4 months ago

Was this helpful?