-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdeal.sh
More file actions
executable file
·44 lines (42 loc) · 1023 Bytes
/
deal.sh
File metadata and controls
executable file
·44 lines (42 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
#
# To get a random deal:
# ./deal.sh < /dev/null
#
# To get a random deal with a fixed South hand:
# echo "♠ AKJ74 ♥ - ♦ A95 ♣ KQ832" | ./deal.sh
# echo "S:AKJ74 H:- D:A95 C:KQ832" | ./deal.sh
# echo "AKJ74 - A95 KQ832" | ./deal.sh
# ./deal.sh <<END
# ♠ AKJ74
# ♥ -
# ♦ A95
# ♣ KQ832
# END
#
# To get a random deal with fixed North-South hands:
# printf "♠ AKJ74 ♥ - ♦ A95 ♣ KQ832\n♠ Q92 ♥ AT73 ♦ T3 ♣ AJ96" | ./deal.sh
# echo "S AKJ74 H - D A95 C KQ832
# ♠ Q92 ♥ AT73 ♦ T3 ♣ AJ96" | ./deal.sh
# ./deal.sh <<END
# AKJ74
# -
# A95
# KQ832
# Q92
# AT73
# T3
# AJ96
# END
nocard_line="^[ SHDC:♣♦♥♠]+$"
card_line="^[AaKkQqJjTt1098765432Xx SHDC:♣♦♥♠-]+$"
./solver -m3 -f <((
echo "- - - -"
echo "- - - -"
echo "- - - -"
echo "- - - -"
egrep -v "$nocard_line" | \
egrep "$card_line" | \
sed "N;N;N;s/\n/ /g" | \
sed "N;s/\n/\n- - - -\n- - - -\n/"
) | tail -4)