Some TiddlyWiki programming fun: Acey Ducey

176 views
Skip to first unread message

Charlie Veniot

unread,
Feb 11, 2021, 4:32:21 PM2/11/21
to TiddlyWiki
I still have some fine-tuning to do, and might do some refactoring to improve the code.

Good enough, though, for playing with:  


Cheers !

Ste

unread,
Feb 12, 2021, 6:13:42 AM2/12/21
to TiddlyWiki
Very cool! 

clutterstack

unread,
Feb 12, 2021, 9:27:48 AM2/12/21
to TiddlyWiki
Haha, cute! I guess you already said you had fine-tuning to do. I noticed that the first round always seems to be the same, and also that if I bet all $100 in the first round (and lose it), the bet slider goes to zero by itself, but the bet value stays at $100.

Still already a nice demonstration.

Charlie Veniot

unread,
Feb 12, 2021, 10:39:41 AM2/12/21
to TiddlyWiki
I have 25 years of experience programming MS Windows software with Gupta Team Developer (aka Gupta SQLWindows) programming.  I am a huge fan of that particular software development suite, and also a huge fan of SQL programming (Oracle in particular.)

Programming Acey Ducey with TiddlyWiki has me thinking: TiddlyWiki as an application development platform?  I am ridiculously enthused.  To me, programming in TiddlyWiki feels entirely more natural to me, even more so than Gupta Team Developer (which "was" the closest match to how I think/process/organize.)  

(Pause to make a fresh cup o' coffee.)

I just had this thought: TiddlyWiki as application platform, able to access, and manipulate, external data (from a database server, and/or some web service.)  Man o' man, instant brain-freeze-like cognitive overload... 

springer

unread,
Feb 12, 2021, 8:39:24 PM2/12/21
to TiddlyWiki
Fun! 

I just spent a while playing against the house, and formed two hypotheses that were confirmed when I looked at the code. One details actually affects the betting odds; the other doesn't: 

If the dealer had a deck of 52 and happened to flip you the 2 and A, the odds of losing (by getting one of the remaining 2 or A cards) should be 6 out of 50 (12%). But the simpler random value yields higher odds of losing (2 in 13, or 15.4%). 

The other thing I noticed is that the draws compress toward the top of the deck, because you establish an eligible low-end card first, and then find a random value between there and the top of the range. So there are far more turns with a K or an A at right compared with turns with a 2 or 3 at left.

Are those the fine-tuning things you were talking about?

-Springer

Charlie Veniot

unread,
Feb 12, 2021, 9:10:31 PM2/12/21
to TiddlyWiki
That is some might fine sleuthing.

I was going to do a check of my TiddlyWiki code to make sure I stayed true to the Basic language code.  Wherever I didn't, then I want to either alter my code to match, or note the discrepancy.  (I veered off the original code as I got a little tired of those "GOTO's" in the Basic code.)

First thing on my list: handling of no more $cash (i.e. start over again with $100) and ability to "reset" at anytime.)  Well, I'm now thinking of tinkering with the way first and third cards are chosen...

One thing I rather like:  if you save the TiddlyWiki, the game is right back where you left off the next time you open the TiddlyWiki.

ludwa6

unread,
Feb 13, 2021, 5:57:03 AM2/13/21
to TiddlyWiki
TW5 as AppDev platform indeed! This is a nice little demo, Charlie... But when it comes to RDBMS connection, i don't yet see how that can work.  I was trying last year to get it running on Raspberry Pi as front-end to a SQLite database i had implemented as part of a remote sensing system, but could not manage to get front & back ends communicating, ultimately.  If you know of a way to make this work, i'd love to know about it!

/walt  

Charlie Veniot

unread,
Feb 13, 2021, 8:23:49 PM2/13/21
to TiddlyWiki
Yeah, 2-tier Windows software developer over here, so the 3-tier stuff with TiddlyWiki is out of my league for at least a little while.  Yet the wheels are spinning ...

Charlie Veniot

unread,
Feb 13, 2021, 8:33:07 PM2/13/21
to TiddlyWiki
Okay, the code got a bit messy as I pushed this thing into finally surrendering to my stubborn determination.

Please see what you think of the latest Acey Ducey à la TiddlyWiki incarnation.

The random number generator is tricky.  When trying to store something derived from a generated random number, it seems like there needs to be a little time between the generation of the random number (which gets stored in a tiddler) and using that stored random number to generate something else that needs to be stored in a tiddler.  (Ugh, I worded all of that awkwardly.)

The new version seems to work well.  I'll be testing for a day or more before I start refactoring the code, and adding some comments here and there.

That was some aged brain workout...

On Friday, February 12, 2021 at 10:27:48 AM UTC-4 clutterstack wrote:
Reply all
Reply to author
Forward
0 new messages