Hi Adam,
I've been trying the site out a bit more and enjoying it!
I've also got a couple more suggestions:
But first, I think my earlier issue was wrong or incomplete. I said players should be allowed to swap right through the winning condition, allowing them to make that mistake. I do think that should be the default, but there should also be a config option to force the win in that situation. The reason is that for beginners who are just learning crumble, it would be better for them to struggle a little more to be able to identify the winning condition, even during official tournaments. More advanced players would want to use the official rule, which is that if you swap through the winning condition (for either player), the win stands. And official tournaments for more advanced players would probably choose to use that config option too.
Suggestions:
* In supporting long splits, you currently allow the user to click first on the edge of one piece, and then on the far piece that defines the long split. But this also means that in the most common case (splitting just a single piece), the user must click first on that piece to split it, then again on the same piece to lock it in and move on to the swap phase, and then a third time to actually swap. That's essentially a wasted click. An improvement might be that when the user clicks on a piece to split it, if they then click on the same piece, it means they are selecting which half of the two split pieces they want to swap.
* This one relates to my earlier suggestion of enabling starting a turn again from the beginning: it might even be better to allow a step-by-step undo/redo of the steps of the current turn. So, if I start doing a long swap, it's possible I could get lost and want to start over rather than retrace my steps backwards. This is especially true if I am in the middle of a complicated swap and accidentally swap through a capture that I didn't intend to make. In that case I would want to undo only the most recent steps of the swap, rather than having to do the whole long swap again up to that point. Maybe the backspace key could be used to undo the steps of the current turn. Or maybe ctrl-z to undo, ctrl-shift-z to redo.
* It would be cool to give players the option of "golden crumble" in addition to classic. In golden crumble the rules are identical to classic crumble, except that the 'square' pieces have a ratio of 1:sqrt(2), and the 'half-square' pieces have a ratio of 0.5:sqrt(2). This one difference changes the entire game tree and complicates a lot of strategic and tactical motifs, because it allows players essentially to split a square into two squares, which can't be done in classic crumble. When playing 6x6 (or any XxX) golden crumble, the playing field has the same ratio as a starting piece, and players face off across the longer side, i.e. the two players sit so as to be closer to each other.
I haven't looked at your code, but when I tried to write my own crumble engine awhile back, I thought up what seemed like a relatively simple implementation for golden crumble. You treat it internally like classic crumble, i.e. all plain ratios of 1:1 and 0.5:1 for all calculations. The only change is that half-squares may or may not have the option to split into yet-thinner 0.25:1 quarter-squares, depending on a piece of state stored in the piece they came from. And that's it, you've got the fundamental change that creates golden crumble. Then at the final step when you actually display the board, you just squash the playing field and everything in it visually into the necessary ratio. That way internal calculations/comparisons can avoid messy square roots, and users don't need to keep piece state in their heads. I could be missing something with this idea -- I never actually implemented it. See what you think.
Be well,
Zack