# [Community Puzzle] Code your own Automaton2000, step 1

Hello, I am trying to solve the puzzle and I can not pass tests 5 and 4.
For test 5 I get the answer:
trying to hack
Are you listening Automaton2000?
And here Automaton 2000?
And here Automaton 2000?
And here Automaton 2000?,
witch seems consistent with the puzzle statement.

For test 4 I get:
one two one two one two,
which also seems logical, since the depth of the tree should not exceed the number of words in a sentence in this case. I do not see how you can get into infinite loop from here.
Surely, I am missing something in the description of the puzzle.

The tree can be recursive. This is the meaning of the test 4.

Can you sketch a short example of the tree is this case? As I understand it, the moment an end node is encountered, a line should be printed, so you go down the tree to reconstruct the whole sentence, which is âone two one two one twoâ, where the last âtwoâ is the end node.

For test case 5 I still do not see why the output is wrong - there are 5 strings that contain or are âAutomaton2000â, so five lines are printed in the solution, and they seem to be the right ones following the logic of how the tree is updated.
What am I missing?

Maybe someone else could answer? Automaton2000?

In the case of a sentence like âone two one two one two one twoâ, youâll have a tree like this:

``````__START__
one 1

one
two 4

two
one 3
__END__ 1``````

Hi !
I pass all the tests, but fail at validator 2.
Could I have a clue about what is specific to this validator compared with the tests ?
Thank you !

If i remember well, you donât handle the character `:` correctly.

1 Like

I go back to work.

Thanks for replying. Solved it by taking an alternative approach to building/using the tree, and making use of the __ END __ indicator.

I was also wondering how does the test 4 expect âinfiniteâ sentence. But this answer clarifies the problem a bit. Maybe the better term should be âdirected graphâ instead of âtree that can be recursiveâ. The last one sounds like oxymoron to me

Am I the only one to have been confused by the fact that the statement talks about a tree (10 occurrences) while itâs actually a directed graph (corresponding to a Markov chain)?
Also, I really donât see the point of having added some spaces between the login and the â:â at the beginning of the chat lines in some testcases.

A tree is a graph without loops.

Yes I think you are the only one

@nicola1: Yeah (+ connected to be accurate) but there are loops in this case, thatâs precisely the reason why the statement says âAutomaton2000 has a security and stops at 30 words at maximum. You donât want to do an infinite loop !â

@Kirbiby: Maybe, nevertheless this problem has only been solved by 112 people in almost two years while itâs not that difficult.

1 Like

The name of this puzzle implies that there should be a âstep 2â. Where is it?

Blocked somewhere into my side project stack.

time to build your Automaton3000 that creates the codes for your âside projectsââŚ

I donât see the details on the rules of how to build the tree. The example does not explain how the loops are created. What am I missing?

I think the confusion arises because the puzzle statement states that:

Everytime you read the word Automaton2000 in a sentence, you have to print a sentence.

So it sounds like that one sentence should be output whenever âAutomaton2000â is mentioned. For example, three sentences if mentioned three times even in a single chat line.

However, the output requirement states that:

One line each time a chat line contains the string Automaton2000

This implies that only one sentence should output even if âAutomaton2000â is mentioned a few times in a single chat line.

The latter interpretation is the one adopted in the puzzle.

1 Like

Oh. Iâll edit thatâŚ

EDIT: I fixed the statement.

2 Likes