Commit | Line | Data |
---|---|---|
bba7b95e MW |
1 | <!-- -*-html-*- |
2 | - | |
3 | - Deal a hand for study or discussion | |
4 | - | |
5 | - (c) 2013 Mark Wooding | |
6 | --> | |
7 | ||
8 | <table class=table> | |
9 | <tr> | |
10 | <td><td> | |
11 | <& .hand, seat => "N", hand => $deal->{N} &>\ | |
12 | <td> | |
13 | <tr> | |
14 | <td> | |
15 | <& .hand, seat => "W", hand => $deal->{W} &>\ | |
16 | <td><td> | |
17 | <& .hand, seat => "E", hand => $deal->{E} &>\ | |
18 | <tr> | |
19 | <td><td> | |
20 | <& .hand, seat => "S", hand => $deal->{S} &>\ | |
21 | <td> | |
22 | <tr> | |
23 | <td class=info colspan=3> | |
24 | <% $Deal::SEAT[$deal->{dealer}] %> dealer <br> | |
25 | <% $Deal::VULN[$deal->{vuln}] %> vulnerable <br> | |
26 | Hand <a href="<% $ENV{SCRIPT_NAME} %>/hand?\ | |
27 | seed=<% $deal->{seed} |u %>;\ | |
28 | dealer=<% $deal->{dealer} |u %>;\ | |
29 | vuln=<% $deal->{vuln} |u %>">\ | |
30 | <% $deal->{seed} |h %></a> | |
31 | </table> | |
32 | %# | |
33 | <%args> | |
34 | $dealer => undef | |
35 | $vuln => undef | |
36 | $seed => undef | |
37 | </%args> | |
38 | <%flags> | |
39 | inherit => "%html" | |
40 | </%flags> | |
41 | <%method title>Full deal</%method> | |
42 | %# | |
43 | <%def .hand>\ | |
44 | <table class=hand title="HCP = <% $hand{hcp} %>; LTC = <% $hand{ltc} %>"> | |
45 | <& .suit, suit => "S", cards => $hand{S} &>\ | |
46 | <& .suit, suit => "H", cards => $hand{H} &>\ | |
47 | <& .suit, suit => "D", cards => $hand{D} &>\ | |
48 | <& .suit, suit => "C", cards => $hand{C} &>\ | |
49 | </table> | |
50 | <%args> | |
51 | $seat | |
52 | %hand | |
53 | </%args> | |
54 | </%def> | |
55 | %# | |
56 | <%def .suit>\ | |
57 | <tr><th><% $SUIT{$suit} %><td><% @cards ? join " ", @cards : "—" %> | |
58 | <%args> | |
59 | $suit | |
60 | @cards | |
61 | </%args> | |
62 | </%def> | |
63 | %# | |
64 | <%once> | |
65 | use Deal; | |
66 | ||
67 | our %SUIT= ( | |
68 | C => "<span class=club-suit>♣</span>", | |
69 | D => "<span class=diamond-suit>♦</span>", | |
70 | H => "<span class=heart-suit>♥</span>", | |
71 | S => "<span class=spade-suit>♠</span>"); | |
72 | </%once> | |
73 | <%init> | |
74 | my $deal = Deal::deal(%ARGS); | |
75 | </%init> |