Comments (23)
I don't understand how to do this unless it's possible to move the header two spaces at once. (or move the header without it being part of a state??) I'm going to through my understanding of all the answers posted so far. Please please please if you think you understand this and your answer is right, please reply to me and explain. I think I am misunderstanding some sort of key information about Turing machines and/or the stipulations within the question.
@diegochillo's and @fcagnola write a 1 in the initial cell, which is incorrect since the instructions said that one had to be 0 and only the immediately adjacent cells should contain 1. @giorgiasampo's does make 1 0 1 with the 0 being in original cell position of the header but contains instructions for state D which is forbidden. @edoardodalborgo's doesn't work when you write 0 as in state A. It sends you to state C where you write a one and it finishes so it just says 01. Right? What am I missing? Is it something about how the cells are set up before state A begins? Is it the definition of instructions that I've misunderstood and a table that looks like @giorgiasampo's with stuff in state D is allowed? Is the origin cell of the header different from the origin cell of state A?
I've tried reusing a state like @DeniseBas but it just traps me in an endless loop. Can you have one state with two different sets of instructions and next states (as in Denise's state A)??? I wouldn't think so but I am lost as to how to actually do this with only states A, B, and C containing instructions, moving one space at a time, and each phase being exactly the same each time it is used.
from 2020-2021.
@diegochillo Thank you!!! I understand now! For those following the replies: The key is that you don't have to assign a next state (duh!), that's how you can use the same state twice. See @diegochillo's latest reply for a step by step explanation. Mystery solved! Thank you!
from 2020-2021.
Turing machine that writes 101 around the initial cell:
input: ''
blank: '0'
start state: A
table:
A:
[1,0]: {write: 1, L: B}
B:
[0]: {write: 1, R}
[1]: {write: 0, R: C}
C:
[0]: {write: 1, R: D}
D:
from 2020-2021.
This is my proposed solution, I think it'll work
Current state | Symbol | Write | Move | Next state |
---|---|---|---|---|
A | 0/1 | 1 | Right | B |
B | 0/1 | 0 | Right | C |
C | 0/1 | 1 | Right | D |
Starting state: A
Ending state: D
from 2020-2021.
blank: '0'
start state: A
table:
A:
0: {write 1, L: B}
1: {write 0, R: C}
B:
0,1: {write 1, R: A}
C:
0,1: {write 1, R: D}
end state: D
from 2020-2021.
from 2020-2021.
I agree with SarahTew, something's not right.
The prohibition on specifing any instruction for the final state D makes the problem complex. Indeed, the text tells us that once reached the final state (so, after the transition from C to D),2 cells (the ones immediately on the left and on the right of the inital position of the head, which means the cells pointed by the head during the state C and A) will change value to 1.
If this change must take place simultaneously, we can say (if I have understood correctly how the Touring machine works) that there is no solution, because the head of the machine points one cell at a time and write one symbol at a time.
Moreover, if D has no instruction we cannot proceed writing new symbols in cells. The table tell us the machine has to stop. But we also cannot anticipate the change of symbols before, because the text specify that only once reached the D state, we should write 1 in those two cells.
Maybe this argument is uncorrect, anyway I can not find other solutions.
from 2020-2021.
@SarahTew who wrote:
@diegochillo's and @fcagnola write a 1 in the initial cell, which is incorrect since the instructions said that one had to be 0 and only the immediately adjacent cells should contain 1.
Dear Sarah,
The instructions state that you have to get the 101 "once reached the final state". During the process, you can write what you want where you want. I restore the 0 in the initial cell at the B state.
from 2020-2021.
from 2020-2021.
Current state | Tape symbol | Write symbol | Move head | Next State |
---|---|---|---|---|
A | 0 | 1 | R | B |
A | 1 | 0 | L | C |
B | 0 | 1 | L | A |
C | 0 | 1 | R | D |
D |
At first I was confused because I thought that at the beginning of the execution, the cells could contain either 0 or 1, but after rereading the book chapter, I saw that all the cells are assigned to 0 in advance! I don't know if this information can help other people... :)
from 2020-2021.
Initial state: A
Final state: D
Only the cells immediately on the left and on the right of the initial position A have the value 1 specified.
from 2020-2021.
@diegochillo I am still confused so I've copied your algorithm here for reference and below it I have written out when happens when I follow the algorithm and the problems that still aren't resolved. I still don't understand if I'm misreading the question and/or your algorithm.
input: ''
blank: '0'
start state: A
table:
A:
[1,0]: {write: 1, L: B}
B:
[0]: {write: 1, R}
[1]: {write: 0, R: C}
C:
[0]: {write: 1, R: D}
D:
Let the bold number be the number in the initial position cell. Let __ represent a cell with nothing written in it (it is either blank or contains something for the machine to read that you have not written)
At the end of state A you have __ 1 __ then you move left and to State B.
At the end of state B you have either 1 1 __ then you move right but there's no subsequent state (Why does it end here?)
or 0 1 __ then you move right and move to State C
At the end of the State C you have 0 1__ then you move to State D.
All of the scenarios above end with a 1 in the initial cell. You don't replace it with 0 in State B because you've moved to the left; you're putting a 0 in the cell to the left of your initial starting place. They also don't contain 1s in the cells adjacent to the initial cell. How is your algorithm supposed to work? How are you getting 1 0 1 ?
from 2020-2021.
input:'' and blank: '0' mean that all the cells are initially filled with symbol '0'.
then you move right but there's no subsequent state
When there's no state specified, it means that you remain in the same state you are.
So the sequence is:
Initial symbols: 000
A: regardless of the symbol (1 or 0), write 1 on the initial cell, move left and switch to state B (Symbols: 010)
B: cursor is left to initial cell, there's a 0, so write 1 and move right (Symbols: 110)
B: cursor is back on initial cell, there's a 1, so write 0, move right and switch to state C (Symbols: 100)
C: cursor is right to the initial cell, there's a 0, so write 1, move right and switch to final empty state D (Symbols: 101)
...as ou can check on https://turingmachine.io/
Hope this helps.
from 2020-2021.
Current State | Tape symbol | Write symbol | Move head | Next state |
---|---|---|---|---|
A | 1 | 0 | right | B |
B | 0 | 1 | right | C |
C | 1 | 0 | right | D |
D |
from 2020-2021.
input: '01'
blank: ' '
start state: a
table:
a:
'0': {L: b}
b:
' ': {write: 1, R: c}
c:
'0': {R: b}
d:
seems to work using https://turingmachine.io/
from 2020-2021.
from 2020-2021.
from 2020-2021.
input: ''
blank: '0'
start state: A
table:
A:
[1,0]: {write: 1, R: B}
B:
[1,0]: {write: 1, L: C}
C:
[1]: {write: 0, L}
[0]: {write: 1, R: D}
D:
Start state: A
End state: D
from 2020-2021.
blank: '0'
start state: A
table:
A:
0: {write: 1, R: B}
1: {write: 1, R: B}
B:
0: {write: 0, R: C}
1: {write: 0, R: C}
C:
0: {write: 1, R: D}
1: {write: 1, R: D}
D:
The output should be: ... 0 0 0 1 0 1 0 0 0 ...
This is how I tried solving this exercise, but I still have one big doubt: what is the "initial position" that have to present on its immediately near cells "1"?
from 2020-2021.
from 2020-2021.
from 2020-2021.
Initial state: A
Final state: D
from 2020-2021.
Hi all,
Besides the varous correct answers I've seen here, I have to say that the discussion in this exercise was one of the best ones I've seen in the past four years. Thanks for that!
from 2020-2021.
Related Issues (20)
- Lecture "Brute-force algorithms", exercise 5 HOT 15
- Lecture "Organising information: unordered structures", exercise 1 HOT 21
- Lecture "Organising information: unordered structures", exercise 2 HOT 19
- Lecture "Organising information: unordered structures", exercise 3 HOT 20
- Lecture "Recursion", exercise 1 HOT 19
- Lecture "Recursion", exercise 2 HOT 20
- Lecture "Divide and conquer algorithms", exercise 1 HOT 19
- Lecture "Divide and conquer algorithms", exercise 2 HOT 17
- Lecture "Divide and conquer algorithms", exercise 3 HOT 5
- Lecture "Dynamic programming algorithms", exercise 1 HOT 21
- Lecture "Dynamic programming algorithms", exercise 2 HOT 19
- Lecture "Organising information: trees", exercise 1 HOT 9
- Lecture "Organising information: trees", exercise 2 HOT 7
- Bonus exercise (AtariGo) HOT 2
- Lecture "Backtracking algorithms", exercise 1 HOT 6
- Lecture "Backtracking algorithms", exercise 2 HOT 5
- Lecture "Organising information: graphs", exercise 1 HOT 15
- Lecture "Organising information: graphs", exercise 2 HOT 14
- Lecture "Greedy algorithms", exercise 1 HOT 5
- Lecture "Greedy algorithms", exercise 2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 2020-2021.