[Community Puzzle] "Test before..."

Hello,
I don’t undestand why the Validator 04 “One action without precedence” work not like Exemple 04…
My code pass all test except validator 04 !

My code has 100% at submit. But i don’t pass the 4th test case in the IDE.

The following output is expected:

Connect
Authenticate
Play
Win
Share
Disconnect

But my code output is this:

Connect
Play
Win
Share
Disconnect
Authenticate

For me, the 4th validator (the one in the IDE and the hidden one) have multiples solutions.

For the 4th IDE test case, my code do as the following:

Initial state: Connect Disconnect Authenticate Play Share Win

Share before Disconnect
=> Connect Share Disconnect Authenticate Play Win

Share after Win
=> Connect Win Share Disconnect Authenticate Play

Play after Connect 
=> Connect Win Share Disconnect Authenticate Play (play is already after Disconnect so nothing to do)

Play before Win
=> Connect Play Win Share Disconnect Authenticate

But this output is still wrong. I can’t say why i pass the hidden validator since i don’t know it. But the rules for this one are not that clear.

Same here, when an action isn’t linked to any other the final output order is not defined clearly.
I tried different orders, one of which passes the 4th IDE test, but I couldn’t get the 4th validation.

The order is stated in the “OUTPUT” Section:

If multiple actions can be done at the same time, choose the one that appears first in the intitial order.

That’s why “Authenticate” is expected to come before “Play”, and after “Connect”.

2 Likes

When I apply that rule my code passes all the IDE tests, but not the 4th validation. Which, interestingly, is the opposite of what Magus described :smile:
Could be a blunder on my side ofc, but it would be nice to have someone recheck the 4th validator and be sure.

Same thing here. My code passes the 4 test cases but not the 4th validator.
Any help?

Does anyone can help? It’s so frustrating not knowing why a validator fails while all test cases pass…

I have tried a few variants and none of them passed the last validation:
[‘Connect’, ‘Authenticate’, ‘Play’, ‘Win’, ‘Share’, ‘Disconnect’]
[‘Authenticate’, ‘Connect’, ‘Play’, ‘Win’, ‘Share’, ‘Disconnect’]
[‘Connect’, ‘Play’, ‘Win’, ‘Share’, ‘Disconnect’, ‘Authenticate’]
The test case is of course working with the first one… How was this puzzle approved?!

How was this puzzle approved?!

Because the person testing it didn’t have such problems?

I also have a solution now that fails the 4th test, contradicts the requirements, but passes the validation. Yay!

Yup, this puzzle is definitely confusing.
It passed the last validation test when printing the actions out of the graph at the end. And of course it didn’t pass the 4th test in the IDE.

As suggested by @Magus, one can try to also with the following testcase:
> 6

premier
deuxieme
troisieme
quatrieme
cinquieme
sixieme
5
deuxieme before premier
premier after troisieme
troisieme after quatrieme
deuxieme before quatrieme
cinquieme before premier

with the following output:

deuxieme
quatrieme
troisieme
cinquieme
premier
sixieme

why not the following outpout ?

cinquieme
sixieme
deuxieme
quatrieme
troisieme
premier

The answer is above, in the 4th message.
It’s because cinquieme and sixieme were given last in the input.

Sorry, I am still confused. In test case 4, none of the orders mention “Authenticate”. None of the orders specify any actions which can be done at the same time as “Authenticate”, so I fail to see how the statement you quoted is relevant.

Could anyone clarify? Thanks.

The actions are given in this order: Connect, Disconnect, Authenticate, Play, Share, and Win.
The precedence graph is ( means “before”): Connect → Play → Win → Share → Disconnect, and Authenticate alone.

  • The 1st action can be either Connect or Authenticate, but Connect was given before Authenticate. So, it’s Connect.
  • The 2nd action can be either Play or Authenticate, but Authenticate was given before Play. So, it’s Authenticate.
  • There is no choice for the 3rd action, it can only be Play.
  • The same for the remaining actions.
1 Like

Thank you Plopx for your explanation. My confusion still exists, though it is not caused by Plopx at all - you have been patient and helpful :slight_smile:

The puzzle statement states: “If multiple actions can be done at the same time, choose the one that appears first in the initial order.” But how do we know if multiple actions can be done at the same time?

To me, the initial list of actions means nothing but actions. The list itself does not state whether the actions can be done at the same time or not - the answer can be “yes” or “no”, equally possible.

Your explanation is based on this assumption: “All actions given in the initial list are assumed to be actions that can be done at the same time, unless otherwise specified in the list of orders.”

Without this assumption, I cannot find any action which has been stated as “can be done at the same time” as “Authenticate”. It follows that all of the following combinations can be a correct answer to test case 4 (not contradicting the list of orders):

  • Authenticate → Connect → Play → Win → Share → Disconnect
  • Connect → Authenticate → Play → Win → Share → Disconnect
  • Connect → Play → Authenticate → Win → Share → Disconnect
  • Connect → Play → Win → Authenticate → Share → Disconnect
  • Connect → Play → Win → Share → Authenticate → Disconnect
  • Connect → Play → Win → Share → Disconnect → Authenticate

I think it is more of an issue of an unclear puzzle statement. Please feel free to point it out if I miss anything in the thinking process :slight_smile: