Open GoogleCodeExporter opened 9 years ago
Hmm, sorry, didn't meant to classify this as a defect, but I never saw where I
could
specify!
Original comment by Mark.J.A...@gmail.com
on 14 Aug 2009 at 3:20
Sorry I missed this submission. I'd love to see your script.
Original comment by thomasoa
on 24 Feb 2010 at 3:30
Original comment by thomasoa
on 24 Feb 2010 at 3:30
Actually it's not a script. I modified the C source. Attached is a patchfile
suitable
for running from the directory above a deal 3.1.7 source directory.
Original comment by Mark.J.A...@gmail.com
on 2 Mar 2010 at 4:06
Attachments:
I'm currently using this functionality in a "child" Deal process. Having dealt
a pair
of partnership hands that matches some complex constraints for bidding
practice, I
then want to deal a series of opponents hands, and evaluate relevant
denominations
from each side over both permutations of the opponents' hands. Averaging over
100
hands or so gives numbers accurate to around 0.1 trick which is more than good
enough
to decide "Did we reach the right contract?"
The simplest way to do this is to call
eval [exec ./deal -e "north is \"[north]\"; south is \"[south]\"; set
denominations {$calcdenominations}; set format \"%.1f\"" -i averagetricks.tcl
$num_hands_to_analyze]
from the parent script, where averagetricks.tcl is
source format/none
if {![info exists denominations]} {
set denominations [list notrump]
}
set results [dict create]
foreach denomination $denominations {
foreach declarer { north south } {
set name "$declarer$denomination"
sdev $name
dict set results $declarer $denomination $name
}
}
main {
foreach denomination $denominations {
symmetrize {
eval [dict get $results south $denomination] add [deal::tricks south
$denomination]
eval [dict get $results north $denomination] add [deal::tricks north
$denomination]
} { east west }
}
accept
}
deal_finished {
foreach denomination $denominations {
foreach declarer { north south } {
set value [eval [dict get $results $declarer $denomination] average]
if {[info exists format]} {
set value [format $format $value]
}
puts -nonewline "dict set results $declarer $denomination $value; "
}
}
puts ""
}
I believe the ordering of calls to deal::tricks is optimal. You want to recycle
some
of the data when only the opening lead is changing, and can't do so when the
hands
are changing.
Original comment by Mark.J.A...@gmail.com
on 2 Mar 2010 at 4:30
Original issue reported on code.google.com by
Mark.J.A...@gmail.com
on 14 Aug 2009 at 3:20