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> | |
bba7b95e MW |
38 | <%method title>Full deal</%method> |
39 | %# | |
40 | <%def .hand>\ | |
41 | <table class=hand title="HCP = <% $hand{hcp} %>; LTC = <% $hand{ltc} %>"> | |
42 | <& .suit, suit => "S", cards => $hand{S} &>\ | |
43 | <& .suit, suit => "H", cards => $hand{H} &>\ | |
44 | <& .suit, suit => "D", cards => $hand{D} &>\ | |
45 | <& .suit, suit => "C", cards => $hand{C} &>\ | |
46 | </table> | |
47 | <%args> | |
48 | $seat | |
49 | %hand | |
50 | </%args> | |
51 | </%def> | |
52 | %# | |
53 | <%def .suit>\ | |
54 | <tr><th><% $SUIT{$suit} %><td><% @cards ? join " ", @cards : "—" %> | |
55 | <%args> | |
56 | $suit | |
57 | @cards | |
58 | </%args> | |
59 | </%def> | |
60 | %# | |
61 | <%once> | |
62 | use Deal; | |
63 | ||
64 | our %SUIT= ( | |
65 | C => "<span class=club-suit>♣</span>", | |
66 | D => "<span class=diamond-suit>♦</span>", | |
67 | H => "<span class=heart-suit>♥</span>", | |
68 | S => "<span class=spade-suit>♠</span>"); | |
69 | </%once> | |
70 | <%init> | |
71 | my $deal = Deal::deal(%ARGS); | |
72 | </%init> |