[Community puzzle] Advanced Tree


#46

100%

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

Thanks a lot!


#47

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

#48

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.


#49

Yes.

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

  • danBhentschel

#50

OK, thanks for your reply!


#51

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


#52

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


#53

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


#54

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:


#55

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!


#56

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.


#57

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.