GithubHelp home page GithubHelp logo

black-jack-cpp's Introduction

black-jack-cpp

Command line black jack game with cpp programming language

블랙잭의 규칙

  1. 게임의 최소 ~ 최대 배팅금액을 통해 시작
  2. 딜러가 플레이어에게 카드를 한장씩 돌리고 자신의 카드를 오픈
  3. 딜러가 다시 플레이어에게 카드를 한장씩 돌리고 두번째 딜러의 카드는 비공개(플레이어의 카드는 전부 공개)
  4. 플레이어는 자신의 오픈된 카드와 딜러의 카드를 보고 자신의 카드 숫자의 합을 21에 맞게 맞춰야한다.
  5. A카드는 1또는 11로 사용될 수 있음. -> 따라서 카드가 두장일 때 블랙잭의 조합은 A카드 + 10카드
  6. 현재 카드의 합이 20이하라면 카드를 더 받을 수 있지만, 받은 카드와의 총 합이 21을 넘어가면 패배(버스트)
  7. 플레이어의 차례가 종료되면, 딜러의 차례가 시작된다. 딜러는 비공개 카드를 공개하고, 합이 16이하면 무조건 히트, 17이상이면 무조건 스테이한다.

블랙잭의 용어

  1. 히트(hit) : 처음 두 장의 상태에서 카드를 한장 더 받는 것
  2. 스테이(stay) : 카드를 더 뽑지 않고 차례를 마치는 것.
  3. 보험(insurance) : 딜러의 오픈된 카드가 에이스라면 보험금을 걸 수 있다.
    • 딜러가 블랙잭이라면 플레이어는 보험금의 두 배를 보상 받는다.
    • 딜러가 블랙잭이아니라면 플레이어는 보험금을 잃는다.
  4. 푸쉬(push) : 플레이어와 딜러의 카드 합이 같은 경우 비기게 되고 배팅 금액을 돌려받는다.
  5. 서렌더(surrender) : 플레이어가 게임을 포기하고 배팅 금액의 절반을 돌려받는다. 단, 딜러가 블랙잭을 가지고 있을 경우 게임 포기는 불가하다.

TODO

  • Card class

    • [변수]
      • 카드 타입
      • 카드 시작 인덱스
      • 카드 숫자
    • [함수]
      • 카드 숫자 정보 반환
      • 카드 타입 정보 반환
      • 카드 인덱스 반환
  • Deck class

    • [변수]
      • 52개의 카드를 담는 벡터
    • [함수]
      • 랜덤 카드 뽑기 (뽑고 지우기)
  • Player class

    • [변수]
      • 예산
      • 현재 보유중인 카드
    • [함수]
      • 플레이가 보유중인 카드 반환 -> 블랙잭 클래스에서 판정
      • 플레이어의 현재 예산 반환
      • 덱에서 뽑은 카드를 플레이어 보유 카드에 삽입 (덱은 reference로 받아오기)
  • Dealer class

    • [변수]

      • 현재 보유중인 카드
    • [함수]

      • 딜러의 행동 결정
      • 덱에서 카드 뽑기
  • UserInterface class (ui 클래스를 제외한 클래스에서 어떠한 출력도 하면 안됌!! 로그용으로만 출력하기)

    • [변수]
      • 카드 출력을 위해 txt파일로 부터 한 줄씩 받아와 삽입한 문자열 벡터
    • [함수]
      • 생성자
      • 게임 로고 (greeting)
      • 메뉴 보여주기
      • 딜러와 플레이어의 카드를 출력(딜러와 플레이어 카드 모두 동시에 출력되어야 함 . 딜러의 카드는 플레이어 차례가 끝나기 전까지 두 장이고, 한 장만 공개 다른 카드는 비공개 상태로 출력해야함)
      • 플레이어의 예산 출력 함수
  • BlackJack class

    • [변수]
      • 배팅 범위
    • [함수]
      • 플레이어의 차례의 게임 진행
      • 딜러 차례의 게임 진행
      • 규칙에 따른 게임의 승패 판정
      • 배팅 요구
      • 플레이어의 입력 받기

black-jack-cpp's People

Contributors

codernineteen avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

devrokket

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.