Command line black jack game with cpp programming language
- 게임의 최소 ~ 최대 배팅금액을 통해 시작
- 딜러가 플레이어에게 카드를 한장씩 돌리고 자신의 카드를 오픈
- 딜러가 다시 플레이어에게 카드를 한장씩 돌리고 두번째 딜러의 카드는 비공개(플레이어의 카드는 전부 공개)
- 플레이어는 자신의 오픈된 카드와 딜러의 카드를 보고 자신의 카드 숫자의 합을 21에 맞게 맞춰야한다.
- A카드는 1또는 11로 사용될 수 있음. -> 따라서 카드가 두장일 때 블랙잭의 조합은 A카드 + 10카드
- 현재 카드의 합이 20이하라면 카드를 더 받을 수 있지만, 받은 카드와의 총 합이 21을 넘어가면 패배(버스트)
- 플레이어의 차례가 종료되면, 딜러의 차례가 시작된다. 딜러는 비공개 카드를 공개하고, 합이 16이하면 무조건 히트, 17이상이면 무조건 스테이한다.
- 히트(hit) : 처음 두 장의 상태에서 카드를 한장 더 받는 것
- 스테이(stay) : 카드를 더 뽑지 않고 차례를 마치는 것.
- 보험(insurance) : 딜러의 오픈된 카드가 에이스라면 보험금을 걸 수 있다.
- 딜러가 블랙잭이라면 플레이어는 보험금의 두 배를 보상 받는다.
- 딜러가 블랙잭이아니라면 플레이어는 보험금을 잃는다.
- 푸쉬(push) : 플레이어와 딜러의 카드 합이 같은 경우 비기게 되고 배팅 금액을 돌려받는다.
- 서렌더(surrender) : 플레이어가 게임을 포기하고 배팅 금액의 절반을 돌려받는다. 단, 딜러가 블랙잭을 가지고 있을 경우 게임 포기는 불가하다.
-
Card class
- [변수]
- 카드 타입
- 카드 시작 인덱스
- 카드 숫자
- [함수]
- 카드 숫자 정보 반환
- 카드 타입 정보 반환
- 카드 인덱스 반환
- [변수]
-
Deck class
- [변수]
- 52개의 카드를 담는 벡터
- [함수]
- 랜덤 카드 뽑기 (뽑고 지우기)
- [변수]
-
Player class
- [변수]
- 예산
- 현재 보유중인 카드
- [함수]
- 플레이가 보유중인 카드 반환 -> 블랙잭 클래스에서 판정
- 플레이어의 현재 예산 반환
- 덱에서 뽑은 카드를 플레이어 보유 카드에 삽입 (덱은 reference로 받아오기)
- [변수]
-
Dealer class
-
[변수]
- 현재 보유중인 카드
-
[함수]
- 딜러의 행동 결정
- 덱에서 카드 뽑기
-
-
UserInterface class (ui 클래스를 제외한 클래스에서 어떠한 출력도 하면 안됌!! 로그용으로만 출력하기)
- [변수]
- 카드 출력을 위해 txt파일로 부터 한 줄씩 받아와 삽입한 문자열 벡터
- [함수]
- 생성자
- 게임 로고 (greeting)
- 메뉴 보여주기
- 딜러와 플레이어의 카드를 출력(딜러와 플레이어 카드 모두 동시에 출력되어야 함 . 딜러의 카드는 플레이어 차례가 끝나기 전까지 두 장이고, 한 장만 공개 다른 카드는 비공개 상태로 출력해야함)
- 플레이어의 예산 출력 함수
- [변수]
-
BlackJack class
- [변수]
- 배팅 범위
- [함수]
- 플레이어의 차례의 게임 진행
- 딜러 차례의 게임 진행
- 규칙에 따른 게임의 승패 판정
- 배팅 요구
- 플레이어의 입력 받기
- [변수]