Giter Site home page Giter Site logo

java-baseball-precourse's Introduction

기능 목록

(* 최초 작성한 내용)

  • 1부터 9까지 서로 다른 임의의 수 3개를 선택하는 기능
  • 숫자 두 개를 입력 받아 스트라이크, 볼을 판정 하는 기능
  • 세자리 수 두 쌍을 입력 받아 스트라이크와 볼 개수를 리턴하는 기능
  • 대화형 입출력 기능

구현 기능 목록

  • BallCount Class
    • 멤버변수
      • private int strike: 스트라이크 수
      • private int ball: 볼 수
    • 메소드
      • public BallCount(): 디폴트 생성자
      • public BallCount(int strike, int ball): strike, ball을 파라미터로 전달받는 생성자
      • public void setStrike(int strike): strike 멤버 변수의 setter
      • public int getStrike(): strike 멤버 변수의 getter
      • public void setBall(int ball): ball 멤버 변수의 setter
      • public int getBall(): : ball 멤버 변수의 getter
      • public void add(BallCount ballCount): BallCount 인스턴스를 파라미터로 받아 스트라이크, 볼 수를 더함
  • Baseball Class
    • 멤버변수
      • List answerNumbers: 정답 숫자 리스트
      • private enum Command { START, CONTINUE, FINISH }: 게임 상태
    • 메소드
      • public void Baseball(): 생성자, 1부터 9까지 서로 다른 임의의 수 3개를 생성하고 BallCount를 리셋
      • private void makeUniqueAnswerNumber(): 다른 숫자와 겹치지 않는 정답 숫자 1개를 생성
      • void setAnswerNumbers(List value): 정답을 임의로 설정 (default 제한자로 동일 페키지 내에서만 허용, For Test)
      • public boolean checkAnswer(List numbers): 세자리 수를 입력받아 정답과 비교하여 스트라이크와 볼 개수를 출력
      • private BallCount getBallCountFromNumber(int number, int idx): 숫자와 인덱스를 입력받아 스트라이크, 볼을 판정하여 생성한 BallCount 인스턴스를 리턴
      • public void printBallCount(): 현재 BallCount를 System.out으로 출력
      • private void playGameLoop(Scanner scanner): 정답을 맞출 때 까지 게임 라운드를 반복하는 메소드
      • private boolean playGameRound(Scanner scanner): 게임 라운드를 진행하는 메소드. 입력된 세자리 수로 볼카운트를 판정하여 메시지를 출력
      • public static void main(String[] args): 숫자야구게임 시작점. 게임이 종료 후 다시 시작하거나 완전히 종료하는 기능 포함
  • Utils Class
    • public static List stringToIntegerListWithDelimiter(String input): delimiter 가 포함된 String 형태의 숫자를 입력받아 Integer List 로 변환하여 리턴 (default delimiter: ",")
    • public static List stringToIntegerListWithDelimiter(String input, String delimiter) delimiter가 포함된 String 형태의 숫자를 입력받아 Integer List 로 변환하여 리턴
    • public static List stringToIntegerList(String input): String 형태의 수를 입력받아 자리 수 별로 분리하여 IntegerList로 변환하여 리턴
  • ScannerUtil Class: Scanner를 singleton으로 사용하기 위한 구현체

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.