After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 659623 - New game: Hamilton
New game: Hamilton
Status: RESOLVED FIXED
Product: aisleriot
Classification: Other
Component: games
git master
Other Linux
: Normal enhancement
: ---
Assigned To: aisleriot-maint
aisleriot-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-20 17:09 UTC by Toby Goodwin
Modified: 2015-06-08 20:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
complete implementation and documentation for new game Hamilton (17.94 KB, patch)
2011-09-20 17:09 UTC, Toby Goodwin
none Details | Review
updated hamilton patch (20.21 KB, patch)
2014-10-23 21:27 UTC, Toby Goodwin
accepted-commit_now Details | Review
game: Add 'chooser' slot type (2.60 KB, patch)
2014-11-02 10:43 UTC, Christian Persch
committed Details | Review

Description Toby Goodwin 2011-09-20 17:09:31 UTC
Created attachment 197091 [details] [review]
complete implementation and documentation for new game Hamilton

Back in 1999, according to my notes, I started implementing my
favourite solitaire game for aisleriot. A dozen years later, I got
round to finishing it. (In the intervening years, among many other
happenings, I finally finished reading SICP and implemented my own
Scheme interpreter, so I'm confident that the code is of a reasonable
quality.)

Hamilton is a single-pack game of skill, rather similar to spiderette
(although not as hard), and it has a unique twist. The game has some
history: I learned it as a child in the 1970s, and I have found
references to it in "Games of Patience" by Basil Dalton (London 1924)
and "Teach Yourself Card Games for One: Patiences - Solitaires" by
George F Hervey (London 1965).

I've followed the instructions in games/README, so I hope the attached patch (made against the current git head of 5db5650f8746..) is complete and correct.
Comment 1 Christian Persch 2011-09-20 18:39:12 UTC
Thanks for the complete patch! The non-scheme parts look good to me; I'll let Vincent review the scheme code.
Comment 2 Vincent Povirk 2011-10-27 05:00:30 UTC
I always worry when someone says they know scheme, because it usually means they use all kinds of maps and lambdas and reduces that I have to think really hard to figure out. But you didn't do that until cartesian-product. I'm just going to assume that function is accurately-named and reliable. Same with get-moveable.

Some nit-picky things:
 * If I double-click on a tableau pile that cannot be moved to the foundation, the button-double-clicked function will return a true value but do nothing, adding an empty step to my undo history. It doesn't look like it should do this, but it turns out the function is missing an "else", which I guess makes cond behave strangely.
 * You need to mark the strings users will see for translation, like this: (_"string").
 * I can't wait to hear what our translators will have to say about the string in "(list 2 (get-name (get-top-card chooser)) "a foundation, or flip over the next card of the deck")". The "Move X onto Y." format is pretty broken for translators already, and now Y includes a whole extra sentence? I suggest hinting one thing or the other. If users want to know TWO things they can do, they can read the help.
 * You defined (dealable?) and (deal) but didn't set the dealable feature. Don't you want the pretty deal toolbar icon we (and by we I mean Christian Persch) worked so hard on?
 * If you can move multiple cards from a tableau slot to a foundation, the game will tell you to move the highest-ranked card in the sequence, instead of the lowest card. I find this confusing, as moving multiple cards to a foundation is generally considered a shortcut for a sequence of single legal moves, not a single move.
Comment 3 Toby Goodwin 2011-10-31 12:46:55 UTC
> I always worry when someone says they know scheme

:-)  IMHO clarity always comes first...

> * If I double-click on a tableau pile that cannot be moved to the foundation,

Well spotted! (The value of a cond with no match is unspecified.)

> * You need to mark the strings users will see for translation, like this:

D'oh! I knew that, of course.

> * I can't wait to hear what our translators will have to say about the string

Yes, you're quite right. Hints should offer a single good (or possible) move, and not try to explain the rules.

> * You defined (dealable?) and (deal) but didn't set the dealable feature.

Ah, sorry about that. In my defence, the aisleriot / guile interface isn't documented as well as it could be. (Maybe I should fix that!)

> * If you can move multiple cards from a tableau slot to a foundation, the game
> will tell you to move the highest-ranked card in the sequence, instead of the
> lowest card. I find this confusing, as moving multiple cards to a foundation

OK, I agree with that point. Interestingly, my first implementation had, effectively, two sets of rules embedded in the guile code: one to handle actual moves, and a second to handle hints. That version produced "single card" hints.

I realised that the code would be much cleaner (and shorter and more likely to be correct) if there were a single set of rules, and the hints made use of functions like droppable?. And when I implemented that, the "multi card" hints fell out for free, so I stuck with them.

Anyway, thanks very much for the code review, Vincent. Would you like me to incorporate your comments into a new patch?

#t
Comment 4 Vincent Povirk 2011-10-31 14:26:39 UTC
It's up to you, really. If you don't, I'll (eventually) commit it with fixes.
Comment 5 Toby Goodwin 2014-10-23 21:27:00 UTC
Created attachment 289240 [details] [review]
updated hamilton patch

Here's an updated patch against a recent HEAD (specifically b6eb1a74fb5)

As before, it's a complete documented implementation. I've updated it for changes to the aisleriot api, and I've fixed all the problems Vincent mentioned.

Let me know if there's anything else you need.

Cheers,

Toby.
Comment 6 Vincent Povirk 2014-10-23 23:32:36 UTC
Oh geez, I said I'd fix and commit this eventually, but clearly I never got around to it. Sorry about that. Hopefully I can make up for it this time.
Comment 7 Toby Goodwin 2014-10-24 16:05:09 UTC
(In reply to comment #6)
> Oh geez, I said I'd fix and commit this eventually, but clearly I never got
> around to it. Sorry about that. Hopefully I can make up for it this time.

No worries. :-)

I really appreciate all your hard work on aisleriot. (If I didn't have at least half a dozen other spare-time open source projects of my own, I wish I could help out...)
Comment 8 Vincent Povirk 2014-11-02 02:21:48 UTC
Do we need to do something to make "chooser" as a slot name translatable?
Comment 9 Christian Persch 2014-11-02 10:43:01 UTC
Created attachment 289826 [details] [review]
game: Add 'chooser' slot type
Comment 10 Vincent Povirk 2014-11-02 21:22:14 UTC
The patch looks good to me, and it survived both automated and manual testing.
Comment 11 Christian Persch 2014-11-03 17:46:10 UTC
Ok to commit :-)
Comment 12 Toby Goodwin 2015-05-23 20:00:32 UTC
Bump. I'm not seeing the patch in the git repo.

Anything I can do to help it happen? Thanks :-)
Comment 13 Christian Persch 2015-05-23 20:53:29 UTC
Comment on attachment 289240 [details] [review]
updated hamilton patch

As per comment 10.
Comment 14 Christian Persch 2015-06-08 20:37:26 UTC
Pushed to master.