[Cuis] Solitaire updated for 2203

Ken.Dickey Ken.Dickey at whidbey.com
Sat Mar 21 11:40:45 CDT 2015


I updated Solitaire to work with asynchronous animation. Solitaire used to use synchronous animation, which has been removed.

The main problem to be solved is how to interleave animation with control logic.  For example, in auto-moving cards from columns to piles, one wishes to check each card column and if any card has been moved to a pile, check each column again.

The style I used here, CPS (Continuation Passing Style), makes control flow explicit.  Instead of returning, the last thing code does is invoke a closure passed in which does "the next thing".  This lets an asynchronous animation, as its last step, "pick up where it left off", e.g. to continue looping through card columns, checking for legal moves.  [Note CardTable Class>>cpsOverColl:do:next: and class side examples].

This is a style experiment.  I am not totally happy with this style as it can be painful to debug.  Perhaps we should re-introduce the Continuation Class to capture continuations directly.

In any case, we have Solitaire working again with the current Cuis version.

Enjoy!
-KenD




More information about the Cuis mailing list