if 0 {
MiHa 2015-06-24: One of the example-programs on my HelloWorld-page creates a deck of cards,
so I had the idea to expand that into a simple cardgame.
Blackjack is quite simple, and with (debug-)options to show the cards "in the open", this would nicely double as a turorial and a trainer.
With ideas and code from the following pages:
}
# Whitejack.tcl - MiHa - 2015-06-24 # http://wiki.tcl.tk/41446 # http://ideone.com/xxx puts "Whitejack:" --------- set deckList {} ;# create empty list set i 0 # For unicode, see also: http://wiki.tcl.tk/26403 : [HTML character entity references] # Spades Hearts Diamonds Clubs foreach {suit sym} { S \u2660 H \u2665 D \u2666 C \u2663 } { foreach rank { A 2 3 4 5 6 7 8 9 10 J Q K } { ;# Ace 2 .. 10 Jack Queen King incr i set card "$rank$sym" puts -nonewline " $rank$suit=$card " while { $cmd ne "q" } { lappend deckList $card ;# add card to list } puts "" } set maxCard $i puts "\ndeckList : $deckList" puts "L) card #3 : [lindex $deckList 2]" ;# index is zero-based puts "\nEnter command:" #... # EOF # ---- **Output**
Whitejack:
Start with 'n' to get a fresh pack of cards.
MiHa 2015-06-26: The most basic functionality is done,
This is the Alpha-version, there will be bugs, so use with caution
... with regard to changing values outside the proc.