I haven't worked on this project in a while, but as I am currently changing servers, I thought I'd do a slight tweak:
-As suit and rulebox have now been easy_installed, I removed the sys.path commands.
Once everything is settled, my main goal regarding this project will be to fix up its horrid SEO. After that, I might go back and look at the Random / Shuffle problem, but I have a lot on my plate, so I honestly don't see it happening in the near future.
Posted by Brandon Evans <[email protected]> on Thu Feb 3 04:54:33 2011:
-Added titles to the tower elements.
-Correctly calculated the Cyclic moves.
Posted by Brandon Evans <[email protected]> on Wed Feb 2 01:53:10 2011:
Fixed star solutions so that they don't try to solve when the star tower is either the from or the to tower.
Posted by Brandon Evans <[email protected]> on Thu Jan 27 03:14:36 2011:
-With James Rhodes' assistance, I made it so that Random / Shuffling presumably only creates solvable and valid cases. This still needs some proof, but I figure that our method (Shuffling the disks into a correct color scheme and then randomly making legal moves that ignore size when we are shuffling) shouldn't cause any issues.
-That said, this method has a limited number of probable configurations. To remedy this, we proposed that in certain cases, we should process random parts of a solution prior to the random placements. This would require some experimentation before implementing, but it seems reasonable, and certainly better than the current situation.
Posted by Brandon Evans <[email protected]> on Wed Jan 26 01:04:04 2011:
Removed the var declarations I used to appease jslint. Yeah, that's not allowed.
Posted by Brandon Evans <[email protected]> on Tue Jan 25 20:38:01 2011:
-Made it so that randomizing never initially breaks any rules unless we are also shuffling.
-Fixed group restrictions when there are less disks on a tower than there are shades.
-Must handle cases where randomizing causes all of the top disks to be the same color and this causes an impasse. These cases have been marked with alerts.
-Make it so that shuffle eliminates configurations that initially break the rules.
-Now item 1 causes an infinite loop with the group restriction. Must fix this.
Posted by Brandon Evans <[email protected]> on Sun Jan 23 08:02:09 2011:
Fixed a problem with indexOf in IE.
Must fix the misalignment of the towers in IE.
Posted by Brandon Evans <[email protected]> on Sun Jan 23 05:03:26 2011:
-Fixed disk limits with multiple stacks.
-Changed how shuffling is done in preparation for some other unsolvable cases.
-Made it so that all changesets can be seen.
-Fixed Lundon solutions.
-Finally fixed the Firefox lag issue. Thank you so much Samuel Sieb of irc.mozilla.org #js
-Begin working n preventing issues with color restrictions.
--Potentially make it so that it randomly places disks again if the placement would cause a color conflict.
---This can't be done when the colors change because it will check based on the new color. This will either need a new parameter or a condition.
--If the disks don't change colors, the we must prevent all of the disks to have the same color on top.
---If before placing this disk, all of the towers but the one you're placing t on's top disk have the same color as it, shift the top disk of the tower you are placing it on to one of the other towers, or perhaps to the same thing with another tower.
--Both of the above restrictions only apply when the colors alternate and we're not shuffling.
Posted by Brandon Evans <[email protected]> on Fri Jan 21 08:59:03 2011:
-Commented out section that cycles the disk colors of the stacks when the disks alternate and change. I don't think this will be necessary after I implement my current plan.
-Made it so that the stacks are populated, and then the program randomly places disks from each stack. This will be used in order to foster more randomness under the previously mentioned plan.
-The plan: make it so that no color rules are broken from Randomization / Shuffling.
--Place disks based on the ability of them to be shuffled into a valid case. If we ignore the possibility of multiple stacks, I know that under the same restriction, a stack can be shuffled if tgiven x = Number of disks of the majority shade and y = The rest of the disks, x - y - 1 < 1. Under the group restriction, given x = Number of disks of the majority shade and y = Number of disks that all other shades have, x - y - 1 < 1. I'm sure I can derive what I need for the multiple stack cases over time.
---Perhaps for the same reason that I did Now item 2, I should also randomize the order in which the disks are placed instead of just shifting them. This and Now item 2 should not apply unless main.random is true. I know that it doesn't actually matter in the case of Now item 2, but I figure we might as well reduce load where we can.
--Shuffle the disks in a way such that no shade restrictions are broken.
-Figure out what's going wrong with jslint. I normally swear by them, but they are throwing tons of bogus indentation errors, so I should contact them so that I can view the actual errors. I should also probably try out the Disallow undefined variables option when it works again.
-Eventually, recomment this all. I have a habit of not commenting while I work. When we get to a stable time period (Random / Shuffle problem, screensaver), I might as well work on this.
Posted by Brandon Evans <[email protected]> on Fri Jan 21 02:30:58 2011:
-Restructured solve.multi functions so that you pass the first stack's parameters and it transforms them for the other stacks.
-Fixed star solutions.
-Made the solutions for Multistack Domino more efficient.
-Made it so that star towers are removed if there are restrictions instead of the other way around.
Posted by Brandon Evans <[email protected]> on Thu Jan 20 21:36:29 2011:
-Converted all cases of val in object to list.indexOf(val) !== -1. More verbose, but also more consistent with my coding practices.
-Implemented Linear with more than three towers per stack. The minimum move calculation for this proved to be much easier than that of the cyclics.
-Must make it so that if Shuffling is enabled with S = Shades restriction that it shuffles in such a way that each stack initially follows the color rules. Presumably, this would make all cases solvable. There's really no way to make this restriction work otherwise. Perhaps I could implement a similar thing for the 'same' restriction, in which initially no disks touch disks of the same color, which should prevent all of the impossible cases, but such a restriction would eliminate several valid cases. Perhaps I should set my priorities such that the goal is to make Random / Shuffle possible while only allowing for cases that break the size rule (Can use main.movable with an inverse to the size parameter).
-Possibly somehow make a screensaver to go along with this.
Posted by Brandon Evans <[email protected]> on Thu Jan 20 06:00:51 2011:
Implemented (Counter)Cyclic with > 3 towers per stack. I have an idea on how to calculate the Minimum Moves with recursive functions, but I'd rather figure out how to do it using the method I use for three towers. This solution is far from optimal, but optimality is never the priority. I will hopefully implement Linear with > 3 towers per stack shortly, so that any solution that can be solved with three towers can be solved with more.
Posted by Brandon Evans <[email protected]> on Wed Jan 19 09:22:30 2011:
-Fixed up cycling. I'm tired of wasting time trying to get main.cycle to handle cyclic movement, so from now on, it will only handle cases where start is less than end. Cyclic movement is handled in a similar manner to linear movement.
-Implemented Multistack Countercyclic. Because of the requirement that disks to disks of the same size, the implementation didn't require any long paths, and as such, this might actually be optimal. Although my initial attempt at an optimal solution to Multistack Cyclic with disks touching disks of the same size failed because of some conflict that caused disk 2 to be placed on disk 1, I still think a similar method can be implemented, and that such a configuration would optimally take 2counter(n) + (S - 1)clock(n) moves to complete.
Posted by Brandon Evans <[email protected]> on Tue Jan 18 20:59:25 2011:
Made an incredibly inefficient solution to Multistack Cyclic. I also applied this solution to a Multistack configuration where disks can't touch disks of a different color, the shades change, there are three shades, the goal is the away tower, and you can end on the third shade.
Posted by Brandon Evans <[email protected]> on Tue Jan 18 18:37:35 2011:
Implemented linear solution to the configuration where disks of different colors can't touch eachother the, the shades change, there are 2 shades, the goal is the away peg, and you must end on the first shade. This is far from optimal, but my goal is to start by solving all of the Multistack problems without paying attention to optimality.
Posted by Brandon Evans <[email protected]> on Tue Jan 18 09:38:06 2011:
Renamed group.three.three.all to group.three.three.solve for consistency.
Posted by Brandon Evans <[email protected]> on Tue Jan 18 09:33:37 2011:
Reformatted Multistack solution code. Originally I thought that I could use the appropriate functions for unrestricted configurations with more than three towers per stack if I slightly modified solve.pick. Although this doesn't seem to be the case, I think I'm going in the right direction with this modification.
Posted by Brandon Evans <[email protected]> on Tue Jan 18 08:58:58 2011:
-Fixed single stack restrictionless Hanoi with more than 3 towers.
-Fixed multistack with more than 3 towers.
Posted by Brandon Evans <[email protected]> on Tue Jan 18 06:25:26 2011:
Removed solve.stacks and merged solve.none.three.pick with solve.pick. I am becoming more and more confident that the only things that need to be changed when it comes to move generation are the moves for the first stack, and that the picking algorithms will all be similar enough that special cases could be handled by a small amount of parameters.
Posted by Brandon Evans <[email protected]> on Mon Jan 17 07:26:16 2011:
-Changed element.blur to element.change. Why didn't I realize that this was a much better option?
-Severely simplified solve.none.three.pick to the point that I no longer need a xor function.
-Implemented Multistack with a linear restriction. Very simple stuff.
Posted by Brandon Evans <[email protected]> on Mon Jan 17 04:42:00 2011:
Fixed Multistack solutions.
Posted by Brandon Evans <[email protected]> on Sat Jan 15 18:05:46 2011:
-Eliminated an unnecessary restriction.
-Reclassified the Four Star solution.
-Fixed issue with marking towers as Star towers.
Posted by Brandon Evans <[email protected]> on Sat Jan 15 02:59:26 2011:
Made configuration URL ignore Mode and Delay. Those things aren't configuration related, nor something that people would want to share.
Posted by Brandon Evans <[email protected]> on Sat Jan 15 01:11:21 2011:
Added base64.js to Mercurial. OK, now it should be ready for a stable release.
Posted by Brandon Evans <[email protected]> on Sat Jan 15 01:09:37 2011:
Ran jslint on the files one more time. This will now become the stable version.
Posted by Brandon Evans <[email protected]> on Fri Jan 14 23:13:38 2011:
-Converted Import / Export Settings into a URL.
-Fixed an issue with importing Stars.
-Added a description for Star Towers and configuration sharing.
Posted by Brandon Evans <[email protected]> on Fri Jan 14 09:13:35 2011:
Implemented Linear Antwerp with two stacks.
Posted by Brandon Evans <[email protected]> on Fri Jan 14 01:33:09 2011:
Implemented a recursive function for the basic linear problem. Interestingly enough, it has a similar format to both Cyclic and the shortcut in Multistack.
Posted by Brandon Evans <[email protected]> on Fri Jan 14 01:10:31 2011:
-Fixed some typos.
Posted by Brandon Evans <[email protected]> on Thu Jan 13 22:06:08 2011:
-Fixed Import Moves.
-Changed Colors to Shades.
-Updated the descriptions.
Pending some peer review, this can become the stable version.
Posted by Brandon Evans <[email protected]> on Wed Jan 12 23:55:01 2011:
\-Reorganized options into different fieldsets and tables.
-Prevented invalid options, and provided appropriate error messages when they are given.
Posted by Brandon Evans <[email protected]> on Wed Jan 12 20:32:48 2011:
-Made it so that the Home option can't be adjusted unless the Top Shade option can be.
-Reclassified the solution functions.
Posted by Brandon Evans <[email protected]> on Wed Jan 12 07:44:00 2011:
Posted by Brandon Evans <[email protected]> on Wed Jan 12 07:43:17 2011:
-Made it so that Top Shade is only a factor when there are color restrictions and colors change.
-Made it so that there must be at least as many towers per stack as colors if disks can't touch disks of a different color. This doesn't really matter at this point considering we have a limit of 3 colors, but I figured I might as well prevent this in the future.
Made it so that there must be more towers per stack than colors if in any group of C = Colors disks, there can't bee two of the same color disks.
-Implimented all of the remaining solutions.
-Fix up the table, mainly separating Options from Controls.
-Rename the solution functions in a format that would better suit the setup. The hierarchy is becoming better defined.
-Never forget about Random / Shuffle Restrictions.
Posted by Brandon Evans <[email protected]> on Tue Jan 11 20:08:57 2011:
Implimented the solutions to all of the problems that didn't involve same colored disk restrictions.
Posted by Brandon Evans <[email protected]> on Tue Jan 11 08:57:28 2011:
Fixed issue that made the disks grow in size sometimes when popping and pushing them to towers. Not sure why I used Math.ceil when Math.round was obviously the better answer.
Posted by Brandon Evans <[email protected]> on Mon Jan 10 21:31:44 2011:
Fixed a restriction.
Posted by Brandon Evans <[email protected]> on Mon Jan 10 21:27:18 2011:
Implemented Star solutions.
Posted by Brandon Evans <[email protected]> on Mon Jan 10 20:35:57 2011:
-Changed the Away / Home toggle to a checkbox.
-Made it so that movement and color restrictions are all under the same option.
-Made it so that games withsStar towers can't have other restrictions.
-Made it so that there are no movement restrictions if the top shade can't be any shade.
Posted by Brandon Evans <[email protected]> on Sat Jan 8 22:08:35 2011:
-Fixed bug with solve.classic.more.rec that considered color rules when not necessary.
-Fixed bug that solved puzzle automatically if you popped a disk and then changed the amount of towers.
Posted by Brandon Evans <[email protected]> on Sat Jan 8 19:17:38 2011:
-Made it so that there must be at least two colors if disks can't touch disks of the same color.
-Moved various functions from main.js to solve.js.
There's a weird bug that creates invalid moves when there are color restrictions. Must squash this.
Posted by Brandon Evans <[email protected]> on Sat Jan 8 08:38:12 2011:
Made it that N/A is replaced with Unsolved when there is no solution.
Posted by Brandon Evans <[email protected]> on Sat Jan 8 08:31:09 2011:
Began implementing the solutions. Far from done.
Posted by Brandon Evans <[email protected]> on Sat Jan 8 07:59:14 2011:
-Added moves exporter / importer.
-Added settings exporter / importer.
Posted by Brandon Evans <[email protected]> on Sat Jan 8 07:21:04 2011:
-Add the solutions to known configurations.
Posted by Brandon Evans <[email protected]> on Sat Jan 8 05:09:21 2011:
Cleaned up code.
Posted by Brandon Evans <adm[email protected]> on Sat Jan 8 02:56:06 2011:
Added star towers.
-Remove impossible cases.
-Apply solutions to known cases.
Posted by Brandon Evans <[email protected]> on Fri Jan 7 22:09:22 2011:
-Added option that decides whether the disks should end on the Away peg or the Home peg.
-Added option that decides what the top shade of each stack should be.
Posted by Brandon Evans <[email protected]> on Fri Jan 7 19:51:26 2011:
-Added option that allows disks of the same size to be placed.
-Added option that changes the style of Multistack games to Antwerp.
Posted by Brandon Evans <[email protected]> on Fri Jan 7 05:54:19 2011:
Fixed issue where moving converted the width of disks from percentages to pixels. I didn't figure jQuery would do that automatically...
Posted by Brandon Evans <[email protected]> on Fri Jan 7 04:12:06 2011:
Removed unnecessary variations.
Posted by Brandon Evans <[email protected]> on Fri Jan 7 04:03:17 2011:
Added color restrictions.
Posted by Brandon Evans <[email protected]> on Thu Jan 6 20:31:26 2011:
Added several color options:
-The number of colors.
-Whether the colors alternate or not.
-Whether the colors should change upon movement or not.
More color options:
-Whether disks of the same color can touch or not.
-Whether disks of different colors can touch or not.
Posted by Brandon Evans <[email protected]> on Thu Jan 6 05:26:46 2011:
Removed cyclic divs.
Posted by Brandon Evans <[email protected]> on Thu Jan 6 05:24:53 2011:
Prevented variations other than Classic from being solved cyclically / linearly.
Posted by Brandon Evans <[email protected]> on Thu Jan 6 05:19:07 2011:
Fixed minimum moves calculation for Star.
Posted by Brandon Evans <[email protected]> on Wed Jan 5 19:12:11 2011:
OK, I'm going to do this rehaul one step at a time, so expect a lot of commits.
-Made it so that the legality of Multistack moves is determined based on color, not relative position.
-Made it so that star towers are marked by a white peg instead of just considering Tower 2 to be the star tower when the variation is Star.
--This should eventually just be marked as a checkbox, because if I decide that a base's color determines what stack started on that tower and that a peg's color determines where it should end, making it so that the white star peg overwrites the goal peg would restrict the amount of freedom I want this program to allow.
Posted by Brandon Evans <[email protected]> on Tue Jan 4 20:11:08 2011:
Began the addition of options that can be used to replace the variation dropdown box.
-Made it so that there can be a restriction on movement Linear, (Cyclic Clockwise, and Cyclic Counterclockwise), and implemented the solutoin for all three in Classic.
-Muspreventct all the variations that can't be solved with restricted movemenfrom solving. Domino can still be solved with linear.
-Must add more options.
---Whether they cycle.
----Whether they can touch any disk, disks of the same color, or disks of different colors.
--Multistack / Antwerp style.
--How many Star towers exist.
--What tower to finish on.
--What color must the top disk in that stack be.
Posted by Brandon Evans <[email protected]> on Sun Jan 2 19:12:56 2011:
-Prevented puzzle from showing impasse message if the same move solved the puzzle.
-Renamed cyclic.far and cyclic.close to cyclic.clock and cyclic.counter respectively.
-Implemented Cyclic Counterclockwise, though it's impossible to solve with multiple stacks.
-Made it so that Cyclic moves can be undone.
-Generated variation list on the server-side instead of the client-side. This was always the preferred way to go, so now that I'm forced to do some server-side work, I might as well convert this.
Posted by Brandon Evans <[email protected]> on Sun Jan 2 07:22:44 2011:
Gave instructions on how tclone the Mercurial Repositories.
Posted by Brandon Evans <[email protected]> on Sat Jan 1 19:53:39 2011:
Updated the copyright. Happy New Year.
Posted by Brandon Evans <[email protected]> on Sat Jan 1 19:41:32 2011:
-Fixed broken Star solution.
-Removed the ugly border on the images in the footer.
Posted by Brandon Evans <[email protected]> on Fri Dec 31 19:45:57 2010:
Added Fred Lunnon's Java implementation to the page. I figured the least I could do for all his help is host his work, and besides, his documentation is very helpful in understanding the math behind the solution algorithms.
Posted by Brandon Evans <[email protected]> on Fri Dec 31 18:18:38 2010:
Fixed link binding issue with jQuery Mobile. I merely commented that code out until I could get an appropriate response to the ticket (https://github.com/jquery/jquery-mobile/issues/issue/745/). I'm hoping this doesn't adversely affect the page elsewhere, but I have no mobile device to test it on, so I'll assume the tap events still work.
Posted by Brandon Evans <[email protected]> on Fri Dec 31 04:54:55 2010:
Made it so that no variation solves when either Random or Shuffle is checked.
Posted by Brandon Evans <[email protected]> on Fri Dec 31 04:39:02 2010:
-Added and removed the appropriate files. I should have done this in the last commit. Still getting used to Mercurial, my bad.
-Fixed Latest Changeset section so that it doesn't use <pre>, and therefore wraps around.
Posted by Brandon Evans <[email protected]> on Fri Dec 31 04:24:12 2010:
-Set up dev repo and linked to it on the front page.
-Converted page to Python / SUIT for any server-sid work I might need.
-For an example of why I might need it, see the new "Latest Changeset" section. It displays the latest Mercurial changeset, effectively providing viewers with the latest updates on the page without any hassle on my end.
-Must fix mobile.js bug. It appears that clicking on either of the repo links causes some kind of hook error.
-Will continue trying to eliminate impasse cases with Random and Shuffle.
I am liking Mecurial so far. This setup allows me to develop Hanoi and keep both a stable and development copy of the page, so now, without fear of taking down the page for repairs, I will finally link the page on my site. I kind of wish I used this from the beginning, but most of the revisions up to this point have been direct conversions of Fred Lunnon's original program, so all that was lost in the process is expendable. Definitely try Mercurial out over SVN, as from what I've seen, it beats it on every imaginable level.
Posted by Brandon Evans on Thu Dec 30 07:55:51 2010:
Committed initial source code.
To get the Mercurial repository for the stable version of this page,
To get the Mercurial repository for the development version of this
To win, following these rules, transfer all of the disks to the tower
farthest to the right in size order. Even in this basic case, this may
prove to be much more difficult than expected, and the number of moves
it takes to finish grows exponentially as you increase the number of
This page provides several ways to play. These methods can be put into
two categories: manual and automatic ones. You can play manually by
clicking a tower to take off the top disk and clicking another tower to
place it. In addition, you can do the same thing by using the number
keys to indicate the tower you want to move to or from, although this
doesn't work for towers greater than 9.
For the automatic methods, depending on what options you have provided,
there might be a built-in Solution that you can watch. To see if
we have implemented a solution for this setup, check the Minimum
Moves field; if it shows something other than "Unsolved", click
Start to begin the solution and Stop to stop it.
Also, if you have come up with your own solution and want to save the
moves you made, check Export Moves, copy the contents of the
box that appears, check Import Moves, paste the contents into
the box that appears, and press Start. It will then execute the moves
you did previously. The program will use this method as long as you
keep the Import Moves box open and it contains moves. For both of these
automatic methods, you can adjust the Delay field to change
the number of milliseconds the the program will wait in between moves.
What happens when the program finishes making the moves depends on the
selected Mode: selecting "Wait" will make it await further
input, "Repeat" will restart the solution with the same options
selected, and "Increase" will restart the solution with one additional
We have also provided some additional information fields in the
Solution fieldset that deserve mentioning:
Once you get a hang of playing the game, you might want to change up
the Settings. Most programs like this one only have you adjust
the number of disks, whereas this one provides many other settings that
If you don't set any additional restrictions, you can also select
Star Towers. To make a tower a star tower, check the checkbox
on top of it. If you have selected star towers, moves must either be
from or to them.
Finally, if you want to share the options you have set, copy the
URL for this configuration.