# HARCS (JARCS Replacement) - Cube Solver

#### Teoidus

##### Member
prolly tried to malloc() some **** you shouldn'tve malloc()'ed

keep in mind that movegroup 3 = <RUMr> -> branching factor of 12 at each new depth
so depth 8 prune tables are 12 times as large as depth 7

so for example if your computer has like 2 GB RAM free for HARCS and depth 7 tables are at 256 MB, depth 8 = 12 * 256 = 3 GB = rip

#### mDiPalma

##### Member
I type "custom" and as it is loading, the program crashes for no apparent reason... If I set the prunedepth and searchdepth to 7 and 7, this doesn't happen.
the above explanation is correct. you are using too much ram (RUMr is an interesting movegroup because three of those moves are along one axis and the code does not know how to cancel these to prune off duplicate branches - as a result the tables are much larger than they need to be. i never had any reason to implement that until now)

by 'EPBL', I'm assuming you are trying to permute edges in the U and D layers with RUMr (would movegroup 9 work better for you?). that seems like you are trying to generate long algs.

that is really not what HARCS was designed for. this was really just supposed to replace the old, defunct JARCS, which generated optimal solutions for short substeps of human methods. although it CAN do what you are asking, it is really just suited for small problems.

there is built-in functionality to define algsets from a text file, which i recommend you do instead. get these algs from ksolve or cube explorer.

#### crafto22

##### Member
the above explanation is correct. you are using too much ram (RUMr is an interesting movegroup because three of those moves are along one axis and the code does not know how to cancel these to prune off duplicate branches - as a result the tables are much larger than they need to be. i never had any reason to implement that until now)

by 'EPBL', I'm assuming you are trying to permute edges in the U and D layers with RUMr (would movegroup 9 work better for you?). that seems like you are trying to generate long algs.

that is really not what HARCS was designed for. this was really just supposed to replace the old, defunct JARCS, which generated optimal solutions for short substeps of human methods. although it CAN do what you are asking, it is really just suited for small problems.

there is built-in functionality to define algsets from a text file, which i recommend you do instead. get these algs from ksolve or cube explorer.
Okay, I see. Thanks a lot for the help, I guess I'll stick to Cube Explorer for the longer algs.

#### Teoidus

##### Member
Out of curiosity though, what makes Cube Explorer so much better for algs compared to HARCS? They both use similar algorithms, right?

#### mDiPalma

##### Member
Ya probably the same algorithm - but those programs are much more efficient because they are written by people with nonzero programming experience.

HARCS just evolved from my personal eoline/eo3x2x2 solver

if SOMEBODY wanted to work on optimizing harcs, i already have a bunch of ideas.

#### mDiPalma

##### Member
After implementing a host performance-related recommendations from @Teoidus and others, we have managed to significantly improve the speed for HARCS-08.

Code:
   -move conversion from string to char
-sequence conversion from string to vector < char >
-active prevention of congruent candidate solutions in all movegroups, even custom
-conversion of if-statements to else-ifs and switch (live and learn kiddos)

Here are some comparisons of characteristic test cases from v0.7 to v0.8 (run on my machine):
Code:
    test case                    |    HARCS-07    |    HARCS-08    |    improvement
-----------------------------------------------------------------------------------
applying 1e6 scrambles       |    14382 ms    |    406 ms      |    3542 %
pruning 6gen to d=6          |    877 kcases  |    624 kcases  |    141 %
|    446 ms      |    120 ms      |    372 %
pruning RUMr to d=6          |    162 kcases  |    25 kcases   |    650 %
|    108 ms      |    6 ms        |    1800 %

*kcases=1000 cases
As you can see, these are some pretty substantial improvements that will be immediately obvious when you run the code. There are still some improvements to be made in the next version.

Other things added in v0.8 are:
You can now define the cubestate with the "set" command instead of a scramble string. This is helpful when you want to generate algorithms. The next version will allow for command-line inputs and/or input files to simplify this. Type help for more details.

You can now define stepwise "solved" states with hexadecimal strings. Here is an example with @rice 's first step. We are solving the first layer with the BL and BR edges at DF and DB. See the readme for more details.

It will not work for slice/wide moves or rotations (I plan to adjust the way slice moves are done in the next version, so I don't want to fix this just yet).

Because this was a major code rework, I expect there to be a lot of bugs. I tried to test a bunch of typical cases to make sure everything works, but I might have missed something. Please send me a screenshot if something doesn't work.

#### mDiPalma

##### Member
Version 9 is now out! It's some pretty cool stuff. I hope you like it!

The "analyze *" command analyzes and prints statistics for some number of random-state scrambles with the current loaded method (ZZ, Petrus, Roux, or custom). It is extremely useful for calculating and comparing stepwise-optimal movecount statistics for any method. Below is an example of the analyze command for the built-in ZZ method.

I typed "analyze 10000" so it ran the solution algorithm for 10,000 random-state scrambles in around 9.5 seconds (pretty good XD).

It then printed the minimum and maximum movecounts across all ZZ-solutions it found. It looks like our method is bounded by ~ [26, 48] htm.

Then it prints detailed breakdowns for each substep. The mean EOLine length for all the 10,000 solves was 6.125 which is very close to the global mean. The best EOLine was only 2 moves, and the worst EOLine was 8 moves!

The "TOTAL" row at the bottom is the some of the column above. For the "MEAN" column, this is just the mean stepwise-optimal movecount for the method. For the "BEST" column, this represents the luckiest solve you will ever get in your entire life (2-move EOLine, 4-move left block, 2-move right block, and ZBLL skip). For the "WORST" column, this is basically the solve you do right before you smash your new Valk against the wall.

Try it out for yourself on other methods! It's super fast!

This is quite a complicated feature - please let me know if you have any questions/problems or recommendations for details/statistics that I should include!

*NOTE If you are analyzing a custom method, you may get an error about "insufficient depth." This is because your stepwise prune/search depth are not deep enough for some states that are being tested. Just increase your numbers a bit. You may also want to adjust your prune/search depths based off the outputs from the analysis (if the max depth ("WORST") of a step is 12 moves over 10,000 solves, then maybe you don't need searchdepth and prunedepth for that step to both be 10 moves ), which will save time in the pruning/searching stages.

This is for people that want to wrap something around HARCS to generate algs or evaluate families of methods. This makes it possible to call HARCS easily from another program or routine. The syntax is really simple. In your command prompt/terminal, just navigate to the directory of the executable and type "HARCS-09" followed by the string of commands you would like to evaluate. Note that the HARCS instance terminates as soon as the command completes, so you will need to combine all the relevant commands onto a single line.

Here is a sample:

-colored output
-removed LOTS of old code, cutting exe filesize to <1.5 MB
-switched to 64bit (if that's bad, you can compile from source)
-adjusted prune/search depth for compiled methods
-removed rotations from ZBLL.txt
-squashed bugs

I plan for the next version (10) to be my final update. Please let me know what features you think would be useful, or forever hold your peace. Also please tag me with screenshots of any bugs you may find.

Does the current version of harcs allow things like "R2displacement" or "Ddisplacement"?
No, but good idea! I'll try to get that to work.

#### Teoidus

##### Member
Big request: allow for custom methods to take on the form of "regular expressions"

Like, say I define steps: cross, p1, p2, p3, p4, oll, pll, cll, ell, coll, epll for method cfop

Instead of typing "all" I can type "cross (p1|p2|p3|p4) (p1|p2|p3|p4) (p1|p2|p3|p4)(p1|p2|p3|p4) (oll pll|cll ell|coll epll)", which means it will solve the cross, choose the shortest of p1, p2, p3, and p4 4 times (always choosing among pairs not yet solved), then solves the last layer with oll/pll or cll/ell or coll/epll (whichever is most efficient).

You could even get fancy, define algsets wv, sv, and type "cross (p1|p2|p3|p4) (p1|p2|p3|p4) (p1|p2|p3|p4)(p1|p2|p3|p4|wv pll|sv pll) (oll pll|cll ell|coll epll)" to allow for last slot stuff.

#### Arc

##### Member
I have a bunch of suggestions that you could consider adding (don't feel forced of course, I just can't help but come up with ideas and always share them)
• command 'load *.txt' to allow arbitrary name for the custom method file (so you can have multiple without having to rename them)
• command 'random' to put the cube into a random state (and if/when you implement a solver, output the scramble)
• break down analysis time per step
• command 'color' to choose output color from a list (or arbitrary hex value if possible)
• what Teoidus said ^
• during analysis, automatically skip errors, throw out the solves that cause those errors, and report the number of errors after analysis is finished
• if the solve count of an analysis is 1 (command 'analyze 1') automatically show the scramble (if/when you implement a solver) and solution breakdown
• further breakdown of steps in analysis (distribution of move count, total unique solutions)
• command 'export analysis' mimics command 'analysis', except after analysis has been completed, output the solves (solution and, when/if you implement a solver, scramble as well, though it would add a little to analysis time of course) and analysis data in some raw format
• command 'apply' with no parameter applies #1 solution of last step to cube and output regularly as during 'all'
• example usage: 'random' (set cube state to random) then 'EOLine' then 'apply' applies first EOLine solution
• multiple algorithm files per method

Last edited:

#### mDiPalma

##### Member
How can i compile from the sources ??? My computer was 32 bit
I included a 32bit version in this: rpi.edu/~dipalm/HARCS-09a.zip

#### mDiPalma

##### Member
Hey guys, I made a bunch of small updates to HARCS. I still have a few to go before I'm done, but here's what I've done so far.

There are some new commands:
-"random" sets a random cubestate
-"load *" replaces "custom", give it a .txt file
-"export" saves raw analysis solutions to text file
-"histogram *" plots movecount histogram of analysis step

This is what it looks like when you use these commands:

Here is a sample of what raw data will look like in the exported text file.
Code:
D F2 B R L2 U F' , U' D2 R' U D' R2 U' D2 R , D R2 D R2 U R2 U' R2 U' R2 D2 R2 U' , U' M U D M U' M2 D M U D' M' D' ,
D R F' U' L' B R' , U R' U D R' U2 D' R U R , D R2 U R2 D2 R2 D' R2 , M U D M U2 M2 U M' D2 M2 U' D M' U ,
D R D F' L U R' F' , U R U2 R2 D2 R' U R' U2 R' , R2 U R2 D R2 U' R2 D R2 U D' R2 , U M' U D' M' D' M2 D M U D M' U ,
U B L' U' R F B2 , R2 D2 R2 D R U2 R' , D2 R2 D' R2 U' R2 U R2 D' R2 D R2 , U M2 U2 D' M' U2 M U M U2 M' D M2 ,
U R2 L D F' L B , R U' R U' D' R D2 R , D R2 D' R2 U R2 D R2 D R2 U' R2 D , U D2 M U D' M D M2 D' M U D' M' U ,
...
...
...

-fixed many bugs
-increased sb prune depth in roux
-switched to uint64_t for some additional portability
-simplified and pushed error notes to the end of analysis
-improved performance of 2gen testing

There are also cool settings added in "settings.txt" that you can change to vastly improve your user experience.

#### bren077s

##### Member
Hey @Teoidus, Have you made a custom text for the 2GR method?

#### Teoidus

##### Member
@mDiPalma has, here it is:

If you're looking for movecount analysis/histograms/etc, he happened to run those as well:

#### Attachments

• 799 bytes Views: 9

#### bren077s

##### Member
Hey, @mDiPalma,
I have a few feature requests if you ever get the chance.
Main Request: add a total solve movecount histogram
Side Requests:
• add E and S moves
• @Teoidus idea:
Instead of typing "all" I can type "cross (p1|p2|p3|p4) (p1|p2|p3|p4) (p1|p2|p3|p4)(p1|p2|p3|p4) (oll pll|cll ell|coll epll)", which means it will solve the cross, choose the shortest of p1, p2, p3, and p4 4 times (always choosing among pairs not yet solved), then solves the last layer with oll/pll or cll/ell or coll/epll (whichever is most efficient).
• during analysis, automatically skip errors, throw out the solves that cause those errors, and report the number of errors after analysis is finished
• multiple algorithm files per method
Also, thanks for the great application, Harcs is amazing.

#### dboeren

##### Member
Is there a Mac version of this? I'd love to try it out.

#### mDiPalma

##### Member
Is there a Mac version of this? I'd love to try it out.
some people have told me it works in Wine

I have a few feature requests if you ever get the chance.
E and S moves should already work, i will definitely add the full-solve movecount histogram, and the rest of the upgrades are in progress