Question: We want a Turing machine that capitalises a string: the first letter of every word is changed to uppercase. There can only be six different
We want a Turing machine that capitalises a string: the first letter of every word is changed to uppercase.
There can only be six different symbols on the tape: a A double quote space and None blank symbol The input tape consists of a double quote, followed by zero or more spaces, a A and followed by a double quote. The rest of the tape is blank. Write the transition table for the Turing machine. Use descriptive state names.
The list constructor used in the test below was introduced in Section : listA evaluates to A
When the Turing machine stops, every a at the start of the string or preceded by a space has been replaced with A The rest of the string must remain unchanged. For example, if the tape is initially
aAaaa
then the final tape is
AAaAa
The head begins and must endrun i mutil
run i mtm
capitalise
# Write the transitions here in the form
# state symbol: newsymbol, LEFT or RIGHT or STAY, newstate
start: RIGHT,
capitalisetests
# case, TM input tape, debug, output tape
example capitalise, listaA a aa True, listAA a Aa
testrunTM capitalisetests on the first leftmost double quote. Here is some incomplete code: run i mutil
run i mtm
capitalise
# Write the transitions here in the form
# state symbol: newsymbol, LEFT or RIGHT or STAY, newstate
start: RIGHT,
capitalisetests
# case, TM input tape, debug, output tape
example capitalise, listaA a aa True, listAA a Aa
testrunTM capitalisetests
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
