cubing / twsearch

🔍 Twizzle Search — a program to find algs and scrambles for twisty puzzles
GNU General Public License v3.0
24 stars 8 forks source link

Feature Request: option to show state after applying scramble #44

Closed DougCube closed 7 months ago

DougCube commented 7 months ago

I want a way to give it a ScrambleAlg (in .scr file) and for it to spit out what the state looks like, similar to output of '-r' command that gives random states. It is so I can verify I hand-scrambled properly.

rokicki commented 7 months ago

—showpositions with move sequences on standard input. Check out —compact too.

On Thu, Nov 9, 2023 at 8:35 PM DougCube @.***> wrote:

I want a way to give it a ScrambleAlg (in .scr file) and for it to spit out what the state looks like, similar to output of '-r' command that gives random states. It is so I can verify I hand-scrambled properly.

— Reply to this email directly, view it on GitHub https://github.com/cubing/twsearch/issues/44, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMOLS7Q3U5SHLNM7JKBKH3YDWVJNAVCNFSM6AAAAAA7FTIIGGVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4DMOBWGIYDIMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

DougCube commented 7 months ago

That does what I want, although the whitespace on the piece orientation lines is not aligned. Not sure if this was intentionally offset like that or a typo in the code. Also, I'm having to do a fair bit of piping to get it to do exactly what I want. Is there some switch like '--quiet' to have it suppress printing the first 7 and last 1 line of the output? It would also be nice if a version of '--showpositions' can take from a SCR file instead of stdin.

$ tail -n +2 puzzle.scr | head -n -1 | tr '\n' ' ' | sed -e 's/ \+/ /g' | ./build/bin/twsearch.exe --showpositions puzzle.tws | tail -n +8 | head -n -1
Scramble noname
   CORNER
   3 2 7 1 4 6 5
    2 1 1 2 1 0 2
   TIP
   3 2 7 1 4 6 5 8
    1 1 2 1 0 1 0 2
End
rokicki commented 7 months ago

The --quiet option should suppress the extraneous output. The extra space before orientation lines has been removed.

DougCube commented 7 months ago

That sort of worked. It still prints the Twsearch finished. at the end tho. But this is another example of an undocumented option. The README should be updated.

If it were to take directly from a SCR file, it could transfer the name of the scramble over to have it not have to be "noname."

rokicki commented 7 months ago

The printing of "Twsearch finished." was removed in a recent change. I just checked in a change so that twsearch prints all options if you run it without any arguments (the list is quite long).

On Tue, Nov 14, 2023 at 11:54 AM DougCube @.***> wrote:

That sort of worked. It still prints the Twsearch finished. at the end tho. But this is another example of an undocumented option. The README should be updated.

If it were to take directly from a SCR file, it could transfer the name of the scramble over to have it not have to be "noname."

— Reply to this email directly, view it on GitHub https://github.com/cubing/twsearch/issues/44#issuecomment-1811121220, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMOLS5SDOTLUJXIYJWQSU3YEPD65AVCNFSM6AAAAAA7FTIIGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJRGEZDCMRSGA . You are receiving this because you modified the open/close state.Message ID: @.***>

--

DougCube commented 7 months ago

I just ran it without any arguments and this is what I got instead:

$ ./build/bin/twsearch.exe
# This is twsearch v0.6.4-53-g2a98284 (C) 2022 Tomas Rokicki.
# ./build/bin/twsearch
! please provide a twsearch file name on the command line
rokicki commented 7 months ago

Either your pull or your build failed, most likely. I just did a clean checkout and a build and I got a full list of options.

On Tue, Nov 14, 2023 at 12:07 PM DougCube @.***> wrote:

I just ran it without any arguments and this is what I got instead:

$ ./build/bin/twsearch.exe

This is twsearch v0.6.4-53-g2a98284 (C) 2022 Tomas Rokicki.

./build/bin/twsearch

! please provide a twsearch file name on the command line

— Reply to this email directly, view it on GitHub https://github.com/cubing/twsearch/issues/44#issuecomment-1811152928, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMOLS2QPA4R5FFHBP2BARTYEPFRVAVCNFSM6AAAAAA7FTIIGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJRGE2TEOJSHA . You are receiving this because you modified the open/close state.Message ID: @.***>

--

DougCube commented 7 months ago

I pulled again and rebuilt just now, and it worked. But I think it would be better if '--help' and '-h' were explicitly supported to give a more standard user experience.

rokicki commented 7 months ago

Okay, if you give it an option it doesn't understand (such as -h or -? or --help) it prints all the options. I think this solves the problem without adding the explicit options.

On Wed, Nov 15, 2023 at 9:32 AM DougCube @.***> wrote:

I pulled again and rebuilt just now, and it worked. But I think it would be better if '--help' and '-h' were explicitly supported to give a more standard user experience.

— Reply to this email directly, view it on GitHub https://github.com/cubing/twsearch/issues/44#issuecomment-1812968030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMOLS6BGEQ2GBLI72MMEBDYET4BDAVCNFSM6AAAAAA7FTIIGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJSHE3DQMBTGA . You are receiving this because you modified the open/close state.Message ID: @.***>

--