This page is under development. Comments are welcome, but please load any comments in the comments section at the bottom of the page. Please include your wiki MONIKER in your comment with the same courtesy that I will give you. Its very hard to reply reasonably without some background of the correspondent on their Wiki bio page. Thanks,[gold] ---- <> ***Preface*** [gold] Here is some TCL calculations on Texas Hold Dem Poker and Probability ---- ***Introduction*** ***Conclusions*** By inspection ---- *** Table 1: Tables*** ---- *** Table 2: Tables *** ---- ---- ***Testcases Section*** **** Testcase 1 **** ---- **** Testcase 2 **** ---- **** Testcase 3 **** ---- ---- ***Screenshots Section*** ****figure 1. Calculator Screenshot**** [Babylonian Multiplicatiion Algorithm and example demo eTCL calculator screenshot ] ****figure 2. Console Screenshot **** [Babylonian Quarter Square Multiplication procedure algorithm png console screenshot] ---- ***References:*** * google < Texas Poker Wikipedia > * Wikipedia search engine < Texas Poker algorithm > * Wikipedia search engine < multiplication algorithm > * Wikipedia search engine < Texas Poker Math > * Wikipedia search engine < Texas Poker lograrithms > * Wikipedia search engine * Wolfram Alpha search engine < Texas Poker > * precision math procedure used in TCL calculator [Arjen Markus] [AM] * [Computers and real numbers] * [Floating-point formatting] ---- ***Pseudocode & Equations Section*** ====== more than one formula for 1) tables and 2) calculator shell ====== ---- **Appendix Code** *** Trial Shell *** ====== ######)))))) TCL source code follows # pretty print from autoindent and ased editor # program Texas Hold Dem Cards. # adapted from Mahjong_Style_Deletion # written on Windows XP for TCL # working under TCL version 8.6 # The original base M. was adapted # from aricb on the Ask page. # Probably could start a post, # since it is a good baby game # engine. Wish to study dealt values and # probability of Texas Hold Dem Cards. # Need to evaluate hands and bet on them. # I added a few buttons at the bottom # and tried to keep the clean code separate up top. # Richard Suchenwirth RS wrote lpick routine below. # de on TCL Club, 15nov2018 package require Tk namespace path {::tcl::mathop ::tcl::mathfunc} global deck suit global selectedid selectedtext global new_card_state set new_card_state 0 set deck {} set suitfrenchblack { \u2665 \u2666 \u2663 \u2660 } set suitfrenchblanc { \u2664 \u2661 \u2662 \u2667 } # utilities # suchenwirth_subroutine RS proc lpick L {lindex $L [expr {int(rand()*[llength $L])} ];} proc plainsub {text item replacewith} { set text [string map [list $item $replacewith] $text] } proc deal {args} { global deck suit foreach suit { \u2665 \u2666 \u2663 \u2660 } { foreach item $args { set kay "$item $suit " set value 1 if {$item == "J"} {set value 10} if {$item == "Q"} {set value 10} if {$item == "K"} {set value 10} if {$item == "A"} {set value 10} set kay "[append item $suit \ $value ]" lappend deck $kay }} return $deck } deal 2 3 4 5 6 7 8 9 10 A J Q K puts "$deck new_card state equals $new_card_state" proc self_help {} { set msg "Texas Hold Dem Cards V2 from TCL , # self help listing # >>>> Copyright Notice <<<<< # This posting, screenshots, and TCL source code is # copyrighted under the TCL/TK 8.6 license terms. # Editorial rights retained under # the TCL/TK license terms # and will be defended as necessary in court. # >>>> Push Button Operation <<<< # Push left mouse to activate buttons. # Deal shuffles all hands. # Move_right_mouse_for_one_card deal. # All cards listed with value. # Deck is 52 cards, no jokers. # Report allows copy and paste # from console to conventional # texteditor. For testcases, # the testcase number is internal # to the calculator and # will not be printed until # the report button is pushed # for the current result numbers. # Where the program defaults are recalled, # canvas colors/features/variables/globals/calculations/clear displays # may reset prior to calculation # ( in push button list) . # Buttons on the calculator are not # limited to a single action procedure # or single shot. A button command may # call multiple statements and procs, # effectively a separate program or # subprogram installed as # a list of procedures in a button. # Alternately, the list of procedures # need not be installed in a button, # but in a separate procedure. Conventional text editor formulas or grabbed from internet screens can be pasted into green console. Try copy and paste following into green screen console set answer [* 1. 2. 3. 4. 5. ] returns 120 # gold on TCL Club, 15nov2018 " tk_messageBox -title "self_help" -message $msg } proc populateCanvas {canvas cols rows} { variable ids ;# links text ids with respective rect ids variable boxes ;# lists text id and text associated with each rect id global deck suitfrenchblack suitfrenchblanc catch {unset ids boxes} # parameters for drawing boxes set boxwidth 50 set boxheight 20 set padx 10 set pady 10 set colors {red orange yellow green blue purple} set money_color { red } set labels {one two three four} # draw the boxes for {set row 0} {$row < $rows} {incr row} { for {set col 0} {$col < $cols} {incr col} { # calculate coordinates set x1 [expr {$col * ($boxwidth + $padx) + $padx}] set x2 [expr {$x1 + $boxwidth}] set x3 [expr {$x1 + ($boxwidth / 2)}] set y1 [expr {$row * ($boxheight + $pady) + $pady}] set y2 [expr {$y1 + $boxheight}] set y3 [expr {$y1 + ($boxheight / 2)}] # choose color and text set color [lindex $colors [expr {int(rand() * [llength $colors])}]] #set text [lindex $labels [expr {int(rand() * [llength $labels])}]] set text [lindex $deck [expr {int(rand() * [llength $deck])}]] # create the boxes set boxid [$canvas create rectangle $x1 $y1 $x2 $y2 -fill $color -outline black] set textid [$canvas create text $x3 $y3 -text $text] # remember which text item goes with which box and what the text says set boxes($boxid) [list $textid $text] set ids($textid) $boxid set ids($boxid) $boxid } } } proc clearSelection {canvas} { # if there is an existing currently selected box, change its border back to # black; set variables selectedid and selectedtext to empty strings variable selectedid variable selectedtext if {$selectedid ne "" && [$canvas find withtag $selectedid] ne ""} { $canvas itemconfigure $selectedid -outline black } set selectedid "" set selectedtext "" } proc handleSelection {canvas id} { # determine the "next step" by comparing the newly selected box id and text # to the box id and text of the previously selected box (contained in # the variables $selectedid and $selectedtext) variable ids variable boxes variable selectedid variable selectedtext set boxid $ids($id) lassign $boxes($boxid) textid text if {$boxid eq $selectedid} { # user has selected the same box twice; deselect the box clearSelection $canvas return } elseif {$text eq $selectedtext} { # user has selected two boxes with the same text; delete both boxes $canvas delete $boxid $textid $selectedid [lindex $boxes($selectedid) 0] clearSelection $canvas return } else { # user has selected a box when there is no selection, or user has # selected a box with different text than the previously selected box; # try to deselect the previous box, then select the new box clearSelection $canvas set selectedid $boxid set selectedtext $text $canvas itemconfigure $boxid -outline white return } } proc processClick {canvas x y} { # determine whether the user has # clicked on something; if so, call # proc handleSelection set id [$canvas find overlapping $x $y $x $y] if {[llength $id] > 0} { handleSelection $canvas [lindex $id 0] } } set win [toplevel .demo] wm title $win "Texas Hold Dem Cards" set canvas [canvas $win.canvas] pack $canvas -expand 1 -fill both bind $canvas [list processClick %W %x %y] set state 1 proc deal2 {} { global selectedid selectedtext global coloritem canvas details set coloritem gray # mahjongstyle { $state } populateCanvas $canvas 5 5 set selectedid "" set selectedtext "" } proc flip_new_card {} { global deck suit canvas x y global selectedid selectedtext global new_card_state # determine whether the user has clicked on something; # if so, flip to random new card # set id [$canvas find overlapping $x $y $x $y] set id "" if {[llength $id] > 0} { configure $id -text "switch" } } proc mahjongstyle { state } { global coloritem canvas details set coloritem gray set details { # program Texas Hold Dem Cards. # adapted from Mahjong_Style_Deletion # written on Windows XP for TCL # working under TCL version 8.6 # The original base M. was adapted # from aricb on the Ask page. # Probably could start a post, # since it is a good baby game # engine. Wish to study value and # probability of Texas Hold Dem cards. # Need to evaluate hands and bet on them. # I added a few buttons at the bottom # and tried to keep the clean code separate up top. Mahjong-style deletion. press in succession two tiles with the same text. both tiles should be deleted. The Mahjong-style deletion is for the right mouse press.} $canvas create window 100 200 -window [button $canvas.a -width 10 -text deal \ -bg $coloritem -command {deal2;}] $canvas create window 100 250 -window [button $canvas.b -width 10 -text swap_card \ -bg $coloritem -command {swap_new_cards 2 ;}] $canvas create window 200 200 -window [button $canvas.c -width 10 -text about \ -bg $coloritem -command {tk_messageBox -message $details}] $canvas create window 200 250 -window [button $canvas.d -width 10 -height 1 -text report \ -bg $coloritem -command {puts "new_card_state equals $new_card_state"; console show }] $canvas create window 300 200 -window [button $canvas.e -width 10 -text self_help \ -bg $coloritem -command {self_help}] $canvas create window 300 250 -window [button $canvas.f -width 10 -height 1 -text exit \ -bg $coloritem -command {exit }] } mahjongstyle { $state } populateCanvas $canvas 5 5 set selectedid "" set selectedtext "" $canvas configure -background aquamarine4 -highlightcolor brown -relief raised -border 10 proc swap_new_cards { state } { global new_card_state set new_card_state 1 flip_new_card return 1 } proc moveobject {object x y} { global deck suitfrenchblack suitfrenchblanc global canvas $canvas coords $object [expr $x-25] [expr $y-25] set new_card [ lpick $deck ] puts $new_card $canvas itemconfigure $object -text $new_card -fill orange } set egg [$canvas create text 450 200 -text move_right_mouse_for_new_card -fill red ] $canvas bind $egg {moveobject $egg %x %y} console hide console eval {wm title . "Texas Hold Dem Cards, screen grab and paste from console 2 to texteditor"} console eval {.console config -bg palegreen} console eval {.console config -font {fixed 20 bold}} console eval {wm geometry . 40x20} console eval {. configure -background orange -highlightcolor brown -relief raised -border 30} $canvas configure -highlightcolor brown -relief raised -border 10 # This posting, screenshots, and TCL source code is # copyrighted under the TCL/TK license terms. # Editorial rights retained under the TCL/TK license terms # and will be defended as necessary in court. # end of file # gold on TCL club, 5nov2018 ====== ---- ***appendix : Script on Tables for TCL console *** ---- ***appendix, ---- ---- [gold] This page is copyrighted under the TCL/TK license terms, [http://tcl.tk/software/tcltk/license.html%|%this license]. **Comments Section** <> Please place any comments here, Thanks. ---- <> Numerical Analysis | Toys | Calculator | Mathematics| Example| Toys and Games | Games | Application | GUI