[Community puzzle] Advanced Tree

100%

You were right! I forgot to remove dot in hidden file name and sorting was wrong…

Thanks a lot!

I have modified the Multiple Flags Test to highlight when the sorting logic is incorrect. Hopefully this will prevent confusion in the future. Thanks for your help in identifying this issue.

  • danBhentschel

I do not understand the difference between test case 3 and test case 13. Why should the output be an error, instead of the following?

Directory3
|-- File5
`-- .File8
0 directories, 2 files

Should I assume that, for input line 1 “string S - a path to execute tree in”, S always refers to “./” plus S if S does not begin with “./”?

Not sure if the answer to the above has anything to do with the puzzle statement: “You’re only given valid paths, which are only starting with one “current directory” (./) and without “parent directory” (…/)”? But I have no idea what “without parent directory” means >.< Sorry if my question sounds stupid.

Thank you.

Yes.

I agree, this is a bit ambiguous, especially if you don’t have a priori knowledge of how Unix-like filesystems work.

  • danBhentschel

OK, thanks for your reply!

Any hindsight on Validator 12? I pass every IDE TC and every submit TC except this one.

Nevermind I found my issue, I wasn’t treating correctly the depth when the start directory was different than ‘.’ :slight_smile:

Feel free to suggest a new test/validator pair to help others debug that!

1 Like

Any case where the starting directory is not ‘.’ and there’s a depth flag set will do, this TC is not covered in the IDE if I’m not mistaken :slight_smile:

No, seriously, I solved this way too long to be in any kind of mood nearing reading the statement fully. Especially that one, from my memory of it.

You’re still in it, you’re at your best! Write two similar test cases, put the slightly harder one here and PM me the slightly easier one, and everybody benefits!

So I made 2 TC like you asked. Turns out by doing them I found another bug in my code that wasn’t showed through any of the TC (IDE or submit).
Here’s a complex test:
Input =>

./Directory4/Directory5/Directory6
-a,-L 4
15
./Directory1/File1
./Directory1/File2
./Directory2/File3
./Directory1/File4
./Directory2/DirectoryA/File5
./File6
./.File7
./Directory2/DirectoryA/.File8
./Directory2/DirectoryA/DirectoryIII/File9
./Directory2/DirectoryA/DirectoryIII/.File10
./.Directory3/File11
./.Directory3/File13
./.Directory3/.File12
./.Directory3/DirectoryA/DirectoryI/DirectoryII/File14
./.Directory3/DirectoryA/DirectoryI/DirectoryII/File15
./Directory4/Directory5/Directory6/Directory8/Fileb
./Directory4/Directory5/Directory6/Directory8/Filec
./Directory4/Directory5/Directory6/Directory9/Directory10/Directory11/Directory12/Filee
./Directory4/Directory5/Directory6/Directory9/Directory10/Directory11/Filef
./Directory4/Directory5/Directory6/Directory7/File18
./Directory4/Directory5/Directory6/Directory7/.File17
./Directory4/Directory5/Directory6/Directory7/.File16
./Directory4/Directory5/Directory6/Directory7/File19

Output =>

./Directory4/Directory5/Directory6
|-- Directory7
|   |-- .File16
|   |-- .File17
|   |-- File18
|   `-- File19
|-- Directory8
|   |-- Fileb
|   `-- Filec
`-- Directory9
    `-- Directory10
        `-- Directory11
            |-- Directory12
            `-- Filef
            
6 directories, 7 files

I pmed you the other one.

1 Like

Merged.

The interface wouldn’t let me do without deciding for a difficulty level, so I put Medium for lack of a better inspiration. Feedback and counterproposals welcome.

The problem I see with this puzzle, it’s more ASCII art and edge case tweaking to match an arbitrary display format than anything algorithmic. It can be very time-consuming to discover all the little discrepancies between some detail interpretations and what is actually expected. Especially in a string-unfriendly language like C++.

On the positive side:

  • Tests are very comprehensive and seem to cover pretty much all angles. I had no trouble at all with the validators.
  • Explanations are pretty good, though some points could be made clearer IMO.

My suggestions:

  • State more clearly that directory and file count shall still be printed in case of error

  • Remove this wrong and confusing explanation about name sorting. What is expected is a basic case-insensitive sort, not a weird prioritization of lowercase vs uppercase.:slight_smile:

  • The first input line is not “the path in which ‘tree’ will work” but the actual parameter passed to ‘tree’ on the command line. That’s why it can have a leading “./” or not depending on the scenarios. I had a standardized path printing routine up and running before some test showed me I had written it in vain.

  • A more meaningful example could be useful (showing things like depth limit, hidden files or directory filtering, a case of name sorting, etc.) to plan ahead instead of writing useless code that will be revealed by successive tests.

God this one was a bunch of hassle
Simple but terrible to code

I am failing to pass just the LePoulpeVolant Validator, even I can pass the one posted in this page. Any idea what could I be missing? Thanks!

According to statement:

The tree needs to be sorted in ascending alphabetical order , letters in lowercase having priority on uppercases…

In reality, sorting must be case insensitive, as IDE TEST 09 shows, where .much goes after Love but before We.

hi there… i spend a lot of time of this one… i don’t know why :wink: but get finally 100% IDE and 94% submission due to “The poulpe volant” validator… is it a kind of input problem? I m a little sad not to see where to improve my work. thanks.

ps: my sort seems good

.
10
./Directory1/B
./Directory1/b
./Directory1/A
./Directory1/a
./Directory1/2
./Directory1/1
./Directory1/1A
./Directory1/1a
./Directory1/1aa
./Directory1/0

i get

`-- Directory1
    |-- 0
    |-- 1
    |-- 1a
    |-- 1aa
    |-- 1A
    |-- 2
    |-- a
    |-- A
    |-- b
    `-- B

sad, sad, sad… i want my xP. what mean “the poule volant” validator… is it a secret message ?

I’m not sure that it is a real hint…

If you want a hint i give you a test similar to this validator

in

./.Directory2/DirectoryB
-a,-L 2
16
./Directory1/File1
./Directory1/File2
./Directory3/File3
./Directory1/File4
./Directory1/DirectoryA
./Directory3/DirectoryB/File5
./File6
./.File7
./Directory3/DirectoryB/.File8
./Directory3/DirectoryB/DirectoryIV/File14
./Directory3/DirectoryB/DirectoryIV/.File15
./.Directory2/File11
./.Directory2/File13
./.Directory2/.File12
./.Directory2/DirectoryB/DirectoryI/DirectoryIII/File9
./.Directory2/DirectoryB/DirectoryI/DirectoryIII/File10

out

./.Directory2/DirectoryB
`-- DirectoryI
    `-- DirectoryIII
2 directories, 0 files
1 Like

@dwarfie thx dude ! it is work and i fell happy. my path finding was not consistent. thiss puzzle is cheese *****