- 플레이어 이름을 입력받는 기능.
- 이름은 쉽표를 기준으로 분리된다.
- 딜러와 게임 플레이어에게 카드를 분배하는 기능.
- 분배한 카드를 출력하는 기능.
- 딜러의 카드는 한 장만 보여준다.
- 플레이어의 카드는 두 장 모두 보여준다.
- [xs] 카드 draw는 플레이어 먼저 진행하고, 딜러가 진행한다.
- 플레이어 draw 기능
- 점수가 21을 넘지 않을 경우, 원한다면 얼마든지 카드를 계속 draw가능.
- 플레이어로부터 draw 여부를 입력받는 기능. (y 입력 받는 경우 draw)
- 버스트할 경우 draw 불가능하며, 다음 플레이어의 draw를 진행한다.
- (draw할 플레이어의 순서는 플레이어 입력 순서와 일치)
- 버스트할 경우 draw 불가능하며, 다음 플레이어의 draw를 진행한다.
- 딜러 draw 기능
- 딜러는
- 합계가 16점 이하이면 반드시 1장의 카드를 추가로 draw.
- 합계가 17점 이상이면 추가로 카드를 받을 수 없다.
- 딜러에게 Ace 가 분배된 경우
- 버스트 되기 전까지는 11점으로 계산한다.
- 딜러는
- 카드 draw 결과 출력 기능
- 핸드의 총점을 계산한다.
- Ace는 1또는 11로 계산한다.
- Ace는 우선 11점으로 계산하고, 버스트할 경우 1점으로 계산한다.
- King, Queen, Jack은 10점으로 계산한다.
- Ace는 1또는 11로 계산한다.
- 승패를 계산하는 기능
- 딜러가 버스트할 경우,
- 버스트 하지 않은 플레이어는 승리
- 버스트 한 플레이어가 있을 경우, 해당 플레이어에 대해 딜러는 승리, 플레이어는 패배.
- 딜러가 버스트하지 않을 경우
- 딜러보다 점수가 높은 플레이어는 승리. 딜러는 패배.
- 딜러보다 점수가 낮은 플레이어는 패배. 딜러는 승리.
- 버스트한 플레이어는 패배. 딜러는 승리.
- 승패 결과를 출력한다.