| 1 |
# |
| 2 |
# parArticle - an output format used for generating HTML with comments |
| 3 |
# which include ways to load into GIB's bridge.exe or iDeal. |
| 4 |
# |
| 5 |
# Copyright (C) 1996-2001, Thomas Andrews |
| 6 |
# |
| 7 |
# $Id: parArticle 255 2008-09-15 12:43:02Z thomasoa $ |
| 8 |
# |
| 9 |
# This program is free software; you can redistribute it and/or modify |
| 10 |
# it under the terms of the GNU General Public License as published by |
| 11 |
# the Free Software Foundation; either version 2 of the License, or |
| 12 |
# (at your option) any later version. |
| 13 |
# |
| 14 |
# This program is distributed in the hope that it will be useful, |
| 15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
# GNU General Public License for more details. |
| 18 |
# |
| 19 |
# You should have received a copy of the GNU General Public License |
| 20 |
# along with this program; if not, write to the Free Software |
| 21 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 |
# |
| •23 |
source /usr/share/deal/lib/parscore.tcl |
| 24 |
|
| 25 |
set particle(num) 0 |
| 26 |
set particle(dealer) [list north east south west] |
| 27 |
set particle(vul) [list None NS EW Both NS EW Both None EW Both None NS Both None NS EW] |
| 28 |
|
| 29 |
proc par_upcase {word} { |
| 30 |
set first [string toupper [string range $word 0 0]] |
| 31 |
set rest [string range $word 1 end] |
| 32 |
append first $rest |
| 33 |
} |
| 34 |
|
| 35 |
proc write_deal {} { |
| 36 |
global particle particle |
| 37 |
set num $particle(num) |
| 38 |
set dealer [lindex $particle(dealer) [expr {$num%4}]] |
| 39 |
set vul [lindex $particle(vul) [expr {$num%16}]] |
| 40 |
incr num |
| 41 |
puts stderr "$num $dealer $vul" |
| 42 |
set par [parscore $dealer $vul] |
| 43 |
set contract [lindex $par 0] |
| 44 |
set declarer [lindex $par 1] |
| 45 |
set score [lindex $par 2] |
| 46 |
puts "Deal #$num" |
| 47 |
puts "Dealer: [par_upcase $dealer]" |
| 48 |
puts "Vulnerability: $vul vul" |
| 49 |
puts "Contract: $contract by [par_upcase $declarer]" |
| 50 |
puts "N/S score: $score" |
| 51 |
puts "" |
| 52 |
puts -nonewline [format_deal] |
| 53 |
incr particle(num) |
| 54 |
} |
| 55 |
|