main は、「ブラックジャックの Perl プログラム」のメインルーチンです。
必要なサブルーチンを呼び出して、全体を制御しています。
#カードを混ぜる
&shuffle;
while ($#stack > 10) {
undef @PlayerHands;#プレーヤーの手札
undef @DealerHands;#ディーラーの手札
printf "--- Round %d ---\n". ++$nround;
#カードを配る
for (0 .. 1) {
push(@PlayerHands, shift(@stack));
push(@DealerHands, shift(@stack));
}
#合計点数を計算する
$PlayerPoint = &calc(@PlayerHands);
$DealerPoint = &calc(@DealerHands);
#プレーヤーの処理を行う
&player;
#ディーラーの処理を行う
&dealer;
#カードを画面に表示する
&display(1);
}
printf "--- Dealer doesn't have enough cards to continue. ---\n";







