#!/bin/bash
#!/bin/ksh
########################################################################
# File: TM_sum.ksh
# (Extracted from
# "$Id: TM_sum.ksh,v 1.1 2009/05/23 15:19:21 maoyam Exp maoyam $")
#
# Abstracts:
#  This Korn's shell script runs a universal Turing's machine that
# would work sum of positive integers.  This script is a test program
# for `UTM.c' that is yet another test program for `buffer_checker.c'.
#
# Copyright (C) 2004 Maoyam Tokyo, Japan (mailto:maoyam@mail.goo.ne.jp)
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
########################################################################

# This UTM program "sum of numbers" means...
#   status# | cell is 0  | cell is 1
#  ---------+------------+------------
#     #0    |  term      |  wrt0_next
#           |   -> #0    |   -> #1
#  ---------+------------+------------
#     #1    |  wrt1_next |  next
#           |   -> #2    |   -> #1
#  ---------+------------+------------
#     #2    |  prev      |  prev
#           |   -> #4    |   -> #3
#  ---------+------------+------------
#     #3    |  next      |  prev
#           |   -> #0    |   -> #3
#  ---------+------------+------------
#     #4    |  next_term |  prev
#           |   -> #0    |   -> #4
#  ---------+------------+------------
#    * number of status is 5.
./UTM -p '(5	((0  0) (10 1)) 
		((16 2) (4  1)) 
		((5  4) (5  3))
		((4  0) (5  3))
		((18 0) (5 4)))' $*;
exit $?;
