[Cuis] Solitaire updated for 2203

Casey Ransberger casey.obrien.r at gmail.com
Sat Mar 28 20:14:07 CDT 2015


So did you do the continuation passing thing entirely with block closures? If so, I have to say I kind of like not having to add a class. But making the code easy to debug has some goodness to it as well.

Anyway, cool:)

> On Mar 21, 2015, at 9:40 AM, "Ken.Dickey" <Ken.Dickey at whidbey.com> wrote:
> 
> 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
> 
> _______________________________________________
> Cuis mailing list
> Cuis at jvuletich.org
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org




More information about the Cuis mailing list