# CubeTeacher



## dougbenham (Mar 19, 2009)

*Website with features, to do list, and history located here: http://acesoftware.110mb.com/cube/cubeteacher/*

*Background:*
Alright so this whole project started as a science fair project for my junior year in high school. In the beginning I had simple solver that had a Fridrich solve method.

*What it is now:*
I have added more features, optimizations, and annotations to the solver. I also made a graphical representation of the cube from scratch (no external libraries needed). You can freely rotate the entire cube with the mouse; however, in order to manipulate the cube you use the keyboard. The default key mappings are similar to the online cube created by Ryan Heise. It has a natural and flowing feel once you get used to the keys.

The program allows you to reset, scramble, and solve the virtual cube. There is also a mode called 'user solve mode' which you can learn about once you run the program. Now the main goal of this program is to be a teacher. So I have included a music-player type system. You can fast-forward through the solution, watch the solution backwards, pause it, play it, etc. In addition to this, I have also put it small annotations for each algorithm that is executed during the solve.

In my opinion, one of the best features is called 'Phase focus'. When solving the cross, the solver will gray out all the other pieces except the cross pieces. When solving the F2L, the solver will gray out the last-layer pieces. When solving the OLL, the solver will gray out the last-layer horizontal faces so that only the top color is shown.

Its not necessarily a 'Cube Teacher'. It is simply designed for you to have fun and find optimal Fridrich solutions. It can also help you to learn things that you can use for FMC competitions. I will add some algorithm accessibility so that users can input custom algorithms/scrambles/etc, that way it can also be used in a similar fashion to this online cube: http://cube.garron.us/tools/algsolve.php?alg=R. It is simply to help those visual learners out there.

*What you can do to help me out:*
I am releasing the program to the public now in its beta stage in hope that you can explore every possibility that it has to offer currently. I am hoping that you'll find bugs and possibly you'll have some suggestions for improvement. Constructive criticism please. Now before you give me a suggestion, try to think like a programmer and ask yourself, "Hmm. Is this suggestion going to be almost impossible to implement or is it a reasonable idea?"

Here are some things that I am already planning to implement in future version:

2x2, 4x4, etc.
Multi-threaded solver
External solvers
COLL, Winter-variation, MGLS, ZZ capabilities

And you could also help me out by donating through paypal 


*History:*
v1.0.0.0:

Added instant scramble.
Added solution chooser.
Added user-definable OLL + PLL algorithms.
Added cube manipulation by mouse.
Added context-sensitive help in the form of tooltip balloons.
Sequence log now scrolls as new lines are added.
Reorganized menu items.
Fixed minor bugs.
v0.9.2.1 Beta:

Fixed minor solver bugs.
Added new algorithms to solver that will result in the cross solutions using some relativity techniques.
v0.9.2.0 Beta:

Fixed bug that with double-turns (eg. R2).
Fixed bug with control focus that didn't allow hotkeys.
v0.9.1.9 Beta:

Added ability to use an external cube configuration.
Fixed minor bugs (including improper menu item graying, and logging of user turns).
v0.9.1.8 Beta:

Added apply instant sequence.
Added website link to About dialog.
Renamed FPS to DPS (draws per second) for reasons explained in the documentation.
Reworked internal coding a bit. Support for double-slice turns added.
v0.9.1.7 Beta:

Fixed sequence log bug.
Fixed sequence apply bug.
v0.9.1.6 Beta:

Added sequence log.
Added sequence apply.
Added donate button.
v0.9.1.5 Beta:

Fixed updater bug.
Fixed scrambler bug.
Fixed save bug which didn't save the 'Gray opacity' option.
Reworked settings dialog.
Added option to force solver to solve cross on certain sides only.
Added option to prefer F2L slots solved during cross (X-Cross tendency).
Added option to not cancel moves between phases and between F2L pairs.
Added new algorithm to solver that will result in the cross solutions using some 'helper' techniques.
v0.9.1.4 Beta:

Fixed 'User solve mode' bug.
v0.9.1.3 Beta:

Added FPS on/off option to the settings.
Added 'Check updates on startup' option to the settings. Updater is now run on a separate thread.
Fixed bug where user could turn cube while a sequence was active.
v0.9.1.2 Beta:

Fixed FPS bug.
v0.9.1.1 Beta:

Added updater
Fixed bug where Phase focus, F2L Pair Highlighting, and Phase text highlighting couldn't be turned off.
Removed setting for 'Remove hidden surfaces'.
Internally modularized the entire cube graphical interface to a component-like class.
v0.9.1.0 Beta:

Added timer.
v0.9.0.0 Beta:

Original release for beta testing.

I'm also working on a general website for solving the cube if you want to keep an eye on that (I've only got the cross page and the methods page done...):
http://acesoftware.110mb.com/cube/

*Screenshots:*


----------



## Lucas Garron (Mar 19, 2009)

dougbenham said:


> The program requires Microsoft .NET Framework 2.0 which you probably already have



I would totally try this if I wouldn't have to get out my old laptop...


----------



## dougbenham (Mar 19, 2009)

Lucas Garron said:


> dougbenham said:
> 
> 
> > The program requires Microsoft .NET Framework 2.0 which you probably already have
> ...



You don't have the .NET Framework installed on your desktop computer?


----------



## tim (Mar 19, 2009)

dougbenham said:


> Lucas Garron said:
> 
> 
> > dougbenham said:
> ...



There are other operating systems than Windows . Maybe it'll work with Mono, but i'm currently too lazy to install it.


----------



## dougbenham (Mar 19, 2009)

tim said:


> dougbenham said:
> 
> 
> > Lucas Garron said:
> ...



mm.. I suppose thats the price I pay for using .NET


----------



## Karthik (Mar 19, 2009)

dougbenham said:


> tim said:
> 
> 
> > There are other operating systems than Windows . Maybe it'll work with Mono, but i'm currently too lazy to install it.
> ...


True. Not working with WINE on linux too. Will try when I am on a Windoze machine.


----------



## Lord Voldemort (Mar 19, 2009)

This sounds like a nice program to have, especially when doing example solves and such. Unfortunately, I don't have .net installed, but something to suggest when expanding this would be to maybe include more methods. I think Petrus would be nice, if it's possible. I don't know about programming at all, but since it's block building for a lot of the solve, that might simplify things. I'm trying to switch to ZZ, so a system that could give my optimal solutions that I could study and improve on would be nice.

I know it's probably not easy to program all this, but just throwing this out there.


----------



## dougbenham (Mar 19, 2009)

Lord Voldemort said:


> This sounds like a nice program to have, especially when doing example solves and such. Unfortunately, I don't have .net installed, but something to suggest when expanding this would be to maybe include more methods. I think Petrus would be nice, if it's possible. I don't know about programming at all, but since it's block building for a lot of the solve, that might simplify things. I'm trying to switch to ZZ, so a system that could give my optimal solutions that I could study and improve on would be nice.
> 
> I know it's probably not easy to program all this, but just throwing this out there.



Those are great ideas. Originally I intended to include petrus as a method in the solver. However, if you think about it, the petrus method is a lot of reasoning and thinking. Not much of the method is concrete algorithms, etc. It would be difficult to program this method because it would be hard to let the computer "reason" different ways to combine pieces and form blocks, which is fundamental for the method.

Coincidentally I just started learning ZZ. It seems very promising. However, the EOLine is going to be very difficult to master.. But it seems easy enough to program so perhaps when I have finished mastering it I will attempt to write an extension to the solver for this method.


----------



## Lord Voldemort (Mar 19, 2009)

I don't know if this will help, but I have a link to an optimal EOline solver if that would help. Maybe you could try to contact the programmer for the source code? Oh, I got the program installed. It would be nice to see a menu of commands, not like buttons or anything, but like a text file that we could see on the main screen. It's kind of cumbersome to have to try to memorize all those commands.

Overall, though, this seems like a really good program. 
Seeing how those F2L pairs and crosses come together will most certainly help a lot of people.


----------



## EmersonHerrmann (Mar 19, 2009)

Sick, I love it 

P.S. - Please, add a timer!!! If not, I can use my stackmat


----------



## dougbenham (Mar 19, 2009)

Lord Voldemort said:


> I don't know if this will help, but I have a link to an optimal EOline solver if that would help. Maybe you could try to contact the programmer for the source code? Oh, I got the program installed. It would be nice to see a menu of commands, not like buttons or anything, but like a text file that we could see on the main screen. It's kind of cumbersome to have to try to memorize all those commands.
> 
> Overall, though, this seems like a really good program.
> Seeing how those F2L pairs and crosses come together will most certainly help a lot of people.



Yes I'm using the EOLine solver right now  its pretty good. I just need to practice a bit and watch the EOLine solver do then try to learn from it.

Well, I suppose I could put a list of the key mappings on the screen for easy reference. However, the keys are meant to be natural. For example, when you do a U turn on the cube. You push the top layer with your right index finger. The right index finger corresponds to the letter J on the keyboard (at least my keyboard, maybe you have a different keyboard layout). Similarly, U' can be executed by pressing F (left index finger). When I first tried to manipulate the cube with this key configuration I thought it was insane and stupid. But after about 2 hours of trying, it finally made sense and I could cube just as fast as I can in real life.


----------



## Lord Voldemort (Mar 19, 2009)

I tried it out, and wow, this is pretty cool. 
Well, off to do some homework now. 
I'll play around with it some more later, and see if I have more improvements.


----------



## dougbenham (Mar 19, 2009)

EmersonHerrmann said:


> Sick, I love it
> 
> P.S. - Please, add a timer!!! If not, I can use my stackmat



Ah yes. Excellent suggestion. I almost forgot about that =). I'll add a menu item called 'Start Timer', which will change to 'Stop Timer' when the timer is active. I'll add an option in the settings: It will be a checkbox labeled 'Stop timer when cube solved', which will be checked by default.

Any suggestions of what the hotkey for the timer should be?


----------



## Lord Voldemort (Mar 19, 2009)

Spacebar would be good, if it's not already taken.
It's standard for all of the cube timers, so why not?


----------



## dougbenham (Mar 19, 2009)

Lord Voldemort said:


> Spacebar would be good, if it's not already taken.



Nope haha. Sounds good. I'll add the new feature now.


----------



## dougbenham (Mar 20, 2009)

Alright, update made. Added feature of timer. Version 0.9.1 Beta.
Updated main post with history and new screenshots. Let me know if its alright.


----------



## EmersonHerrmann (Mar 20, 2009)

You could also try making bigger versions of this, although it might be hard


----------



## dougbenham (Mar 20, 2009)

EmersonHerrmann said:


> You could also try making bigger versions of this, although it might be hard



Bigger versions meaning 4x4, 5x5, etc? Yes that would definitely be more difficult and would probably require much more time to compute the solutions, however it has crossed my mind and I may get around to writing solvers for big cubes.


----------



## badmephisto (Mar 23, 2009)

This is great. couple of things:

- when you go through the solution using arrows, could the moves be animated? Its hard to see what goes on when it snaps into places, especially with the rotations

- could there be a way to force the cross color?

- it doesnt look like its doing OLL/PLL, but it doesnt matter too much. I would really like to use this to find better ways of doing the F2L. It would be great if it spewed out F2L solutions, and you could go through all of them and see how they play out or something. but that seems like a lot of work (especially interface ***** work, the one noone ever wants to do)

anyway, nice!


----------



## qqwref (Mar 23, 2009)

This is cool, a few ideas based on what you already have:
- Try to focus on keeping the computer to a human-like solving method. That is, use one or two algs per OLL/PLL/F2L case (and maybe allow the user to enter their own alg if they want), and try not to be *too* optimal. For instance the idea of solving the cross to try to preserve edge pairs is a good idea for FMC, but not so good for speedcubing since most people won't have time to do that in inspection until they get way more advanced. Similarly, if your computer is trying to find really nice solutions for the entire F2L at once, try not to do anything that a human wouldn't be able to think of in a solve (like solving three pairs at once with blockbuilding). Or you could try not to cancel between steps. I'm assuming here that someone who's just learning to use Fridrich won't be doing movecanceling or multislotting on the fly.
- I like the "greyed out" idea, but it might be better to use an only partial grey - what I mean is, instead of just making the pieces completely grey, maybe just make them much darker or greyer but still colored. It's definitely true that people should concentrate on the step they're doing, but it should still be possible to see the other colors to remind them that on a real cube they will be able to (or to allow them to do basic lookahead). I guess a sliding bar thing would be most appropriate here.
- For a full-cube solution, if this is reasonable, each step (cross, each F2L pair, OLL, PLL) should be on a new line - keeping the whole thing in one textbox looks kind of cluttered and is hard to read.
- I don't know how your program behaves at the end of the solve, but how about showing the solution and showing you what you did in each part? The program could offer suggestions on how to do the cross and F2Ls more efficiently, so that you could easily see if something needed work (and what to do instead).


----------



## badmephisto (Mar 23, 2009)

qqwref brings up good points.

also for example moves like B should be disallowed? You can't feasibly, in an actual solve, perform those moves efficiently... stuff like that


----------



## dougbenham (Mar 24, 2009)

Excellent suggestions and thank you for your input!



qqwref said:


> Try to focus on keeping the computer to a human-like solving method. That is, use one or two algs per OLL/PLL/F2L case (and maybe allow the user to enter their own alg if they want), and try not to be *too* optimal.


Exactly my thoughts. I thought of having another file for settings for algorithms. Currently the program stores settings in 'Settings.xml', so I might have another settings file called 'Algorithms.xml' that will contain all the algorithms to use for solving. Now the useful thing about this is that you'll be able to have multiple files which you can just replace with the 'Algorithms.xml' when you want to use a different set of algorithms. You could have a 'SimpleAlgs.xml' that you designed with just one algorithms for every situation. Then you could have an 'AdvancedAlgs.xml' with maybe 5 solutions for every single case possible which would find an extremely optimal solution. This is one of the top things on my todo list for this application as it is very practical and should be easy to implement. I may get rid of the options in the solver tab for 'Beginner F2L', 'Beginner OLL', and 'Beginner PLL' so that the user can simply control which algorithms to use instead (eg. 'FridrichAlgs.xml' and 'BeginnerAlgs.xml'). Now don't worry, these .xml files will not require the user to manually input algorithms into the file. There will be a graphical interface for setting up all the algorithms. Perhaps I'll have the program open up a dialog which will show you the list of situations, then you can click on a situation and it will display the situation on the main cube, then you can perform an algorithm to solve the situation, which will be recorded by the application and stored in the algorithms file. As you can see, I love this whole concept of user-defined algorithms.. 



qqwref said:


> For instance the idea of solving the cross to try to preserve edge pairs is a good idea for FMC, but not so good for speedcubing since most people won't have time to do that in inspection until they get way more advanced.


I think it'll be a simple matter to be able to turn this setting on and off. So I'd say if the cross does solve one F2L pair, subtract say.. 5 moves from the overall solution, given that the average F2L pair can be solved in around 5 moves. If someone has a more accurate F2L pair solution pair average then please let me know. I will make a setting for that number which can be user-defined (but it will have a default of 5 moves).



qqwref said:


> Similarly, if your computer is trying to find really nice solutions for the entire F2L at once, try not to do anything that a human wouldn't be able to think of in a solve (like solving three pairs at once with blockbuilding).


Something like blockbuilding is very difficult to implement programmatically as it is all based on reasoning. So I don't think people will have trouble with the computer solving 3 pairs at once.. Maybe one in every 10,000 solves will this happen 



qqwref said:


> Or you could try not to cancel between steps. I'm assuming here that someone who's just learning to use Fridrich won't be doing movecanceling or multislotting on the fly.


This will be a simple matter to implement as well. I can make a simple setting for not reducing redundant moves in between steps. Good suggestion.



qqwref said:


> I like the "greyed out" idea, but it might be better to use an only partial grey - what I mean is, instead of just making the pieces completely grey, maybe just make them much darker or greyer but still colored. It's definitely true that people should concentrate on the step they're doing, but it should still be possible to see the other colors to remind them that on a real cube they will be able to (or to allow them to do basic lookahead). I guess a sliding bar thing would be most appropriate here.


I fear that you have not looked through the settings enough. In the settings there is a tab for the solver, then there is a grouping with a caption called 'Phase focus'. This lets you set what color to gray the cubies with, what opacity to use for the actual color of the tile when grayed, and what opacity to use for the graying. Very customizable. Very simple to use. 



qqwref said:


> For a full-cube solution, if this is reasonable, each step (cross, each F2L pair, OLL, PLL) should be on a new line - keeping the whole thing in one textbox looks kind of cluttered and is hard to read.


Excellent idea. I think I got carried away with my neat idea of a scrolling text box like I implemented. I can get rid of the scrolling and just have a nice text box with highlighting, new lines for each phase of the solution, and text wrapping can be turned on and off. Good suggestion. And if the coloring of the solution text is annoying, it is all customizable in the settings under the solver tab in the grouping labeled 'Phase text highlighting'.



qqwref said:


> I don't know how your program behaves at the end of the solve, but how about showing the solution and showing you what you did in each part? The program could offer suggestions on how to do the cross and F2Ls more efficiently, so that you could easily see if something needed work (and what to do instead).


I'm not quite sure what you mean by this. The program executes OLL then PLL at the end. It usually gets a skip on one or the other though.



badmephisto said:


> when you go through the solution using arrows, could the moves be animated? Its hard to see what goes on when it snaps into places, especially with the rotations


By the default settings, the moves are actually being performed at 90 degrees per timer cycle. So if you'd like to see the moves performed more slowly I would suggest simply changing the settings for the fast forward speed. In the settings under the solver tab and in the grouping labeled 'General', there is a setting for 'Turn speed (fast forward)'. Simply turn the speed down a few notches and you'll be able to see the rotations more clearly. There is a similar setting under the scrambler tab.



badmephisto said:


> could there be a way to force the cross color?


Absolutely. I hadn't thought of this but it would be excellent if a user preferred a certain color for the cross. Easy to implement. I'll work on this too.



badmephisto said:


> it doesnt look like its doing OLL/PLL, but it doesnt matter too much.


The program actually encounters a lot of OLL skips and PLL skips. I will get around to making a nice dialog for choosing a solve to execute instead of the best solution. There will be a nice summary of each solve so that you can choose whether to use a solve with OLL and PLL skips involved.



badmephisto said:


> I would really like to use this to find better ways of doing the F2L. It would be great if it spewed out F2L solutions, and you could go through all of them and see how they play out or something. but that seems like a lot of work (especially interface ***** work, the one noone ever wants to do)


Like I said, there will be a nice dialog for picking out many different solutions for the same solve. This isn't too much work as the solver already calculates all the solutions. It may take me a while to find a user-friendly interface that displays each solution for the user to pick from.



badmephisto said:


> qqwref brings up good points.
> 
> also for example moves like B should be disallowed? You can't feasibly, in an actual solve, perform those moves efficiently... stuff like that


This should be avoidable when I implement user-definable algorithms. The user can decide whether to allow the solver to use B moves.


*Overall, excellent suggestions. I have some renewed vigor for this application now from these good ideas and I'll start working on some of these ideas. Please continue to find bugs and give suggestions.*


----------



## EmersonHerrmann (Mar 24, 2009)

For forcing cross color, just put the cross color you want on the bottom...I think that works


----------



## dougbenham (Mar 24, 2009)

EmersonHerrmann said:


> For forcing cross color, just put the cross color you want on the bottom...I think that works


He/she's not talking about forcing cross color for 'User solve mode'. They're talking about the actual solver. Currently, the solver solves the cross on all sides and finds solutions for each. I can easily make a setting to force the solver to omit certain sides for building the cross on.


----------



## Lt-UnReaL (Mar 24, 2009)

> qqwref said:
> 
> 
> > For instance the idea of solving the cross to try to preserve edge pairs is a good idea for FMC, but not so good for speedcubing since most people won't have time to do that in inspection until they get way more advanced.
> ...


I'd say more like 7.25 moves.


----------



## qqwref (Mar 24, 2009)

dougbenham said:


> qqwref said:
> 
> 
> > I don't know how your program behaves at the end of the solve, but how about showing the solution and showing you what you did in each part? The program could offer suggestions on how to do the cross and F2Ls more efficiently, so that you could easily see if something needed work (and what to do instead).
> ...


I was talking about when you do a solve yourself using the heise-style interface. Basically the program should be able to analyze a solve that you do on the simulated cube, and then tell you what to work on.


----------



## AvGalen (Mar 24, 2009)

Lt-UnReaL said:


> > qqwref said:
> >
> >
> > > For instance the idea of solving the cross to try to preserve edge pairs is a good idea for FMC, but not so good for speedcubing since most people won't have time to do that in inspection until they get way more advanced.
> ...


 
For speed, I would say slightly above 7 indeed (http://stefan-pochmann.info/misc/F2Lstudy/, deduct about 6 moves for the cross)

For greedy optimality (doing 1 pair optimal but not caring about the next one) you should look at http://stefan-pochmann.info/hume/
Short summary: Pair1: 5.33, Pair2: 5.48, Pair3: 6.03, Pair4: 6.59

And even humans can do a lot better than the greedy optimality, just look at my FMC solution from this weeks weekly competition that use a cross + 4 pairs approach: U2 F R' U2 L2 D2 F2 D' F' U L2 F2 U2 L2 U R2 B2 U' D2 R2 D2

U R L2 F' B (Cross + save Pair 1)
U2 B' R U' R' (Insert Pair 1, create Pair 2)
B2 U2 B2 U' B (Insert Pair 2, create Pair 4)
D' U L U' L' D (Insert "keyhole" Pair 3, orient edges)
U2 B' U B (Insert Pair 4, permute edges)
B' R' B L' B' R B L (Last 3 corners with an inverted-mirrored OLL that is simply a commutator)


----------



## dougbenham (Mar 24, 2009)

AvGalen said:


> Lt-UnReaL said:
> 
> 
> > > qqwref said:
> ...



Ok so I think you have 33 moves?

Here's CubeTeacher's solution with the current version 0.9.1 Beta.
Cross: BD2UL2U'B'RB2 (8)
Pair 1: yR'U2R2UR' (5)
Pair 2: yU'R'UR (4)
Pair 3: U'F'U2F (4)
Pair 4: y2URU'R' (4)
OLL: yF'LF'L'F2U2R'FRF' (10)

35 moves. Thats pretty close to your solution length considering the computer doesn't even have to do any reasoning. Not sure why it picked a cross solution that long though... I guess it had the best results with that cross solution..

Alright I'm going to start adding on some of the new features you guys have suggested


----------



## AvGalen (Mar 24, 2009)

dougbenham said:


> AvGalen said:
> 
> 
> > Lt-UnReaL said:
> ...


No, mine is 31 because the end of the 4th pair and the beginning of the last 3 corners cancel perfectly, but for a "human solver" your program is doing very nicely. I heard you mentioning that it gets OLL/PLL skip almost always. Is that because it just tries lots of OLL's, even if they are longer (so it basically just tries to get a 1 look last layer)? Or is it because it chooses a different F2L, if that gives shorter last layers?


----------



## dougbenham (Mar 24, 2009)

AvGalen said:


> dougbenham said:
> 
> 
> > AvGalen said:
> ...



It chooses a different F2L, if that yields a shorter total solution length. The main goal is to get the shortest possible total solution, not just get an OLL skip and/or PLL skip.


----------



## dougbenham (Mar 27, 2009)

Small update made. You can view the version history and download link in the first post made in this thread.


----------



## dougbenham (Mar 28, 2009)

Small update made for v0.9.1.3. You can view the version history and download link in the first post made in this thread.

Over the weekend I'll start adding some of the features you guys requested. *If any of you have any suggestions on how to rework the settings dialog to be less cluttered and more user-friendly, please let me know.*


----------



## dougbenham (Mar 30, 2009)

Small update made for v0.9.1.4. You can view the version history and download link in the first post made in this thread.

*If any of you have any suggestions on how to rework the settings dialog to be less cluttered and more user-friendly, please let me know.*


----------



## dougbenham (Apr 16, 2009)

Large update made for v0.9.1.5. You can view the version history and download link in the first post made in this thread.


----------



## dougbenham (May 1, 2009)

Update made for v0.9.1.6. You can view the version history and download link in the first post made in this thread.

*Just curious, who actually uses this program as their primary virtual cube to toy around with?*


----------



## dougbenham (May 4, 2009)

Minor update made for v0.9.1.7. You can view the version history and download link in the first post made in this thread.


----------



## dougbenham (May 4, 2009)

New website with all the information on it: http://acesoftware.110mb.com/cube/cubeteacher/index.htm

I will be posting the documentation on that page when I finish it.


----------



## dougbenham (May 7, 2009)

Update made for v0.9.1.8. You can view the version history and download link at this website: http://acesoftware.110mb.com/cube/cubeteacher/


----------

