Coder Social home page Coder Social logo

java-baseball's Introduction

숫자 야구 게임 연습 (기능별 분류/단위테스트/TDD/리팩토링)

![](../../스크린샷 2022-11-19 오후 1.40.04.png) ![](../../스크린샷 2022-11-19 오후 1.40.10.png)


기능 목록

1.기능 목록에 기능 이름(메서드) 지어주기

  • [] 1부터 9까지 서로 다른 숫자 랜덤 숫자 3개를 생성한다 ->createRandomNumbers()
    • [예외] 받은 값이 3자리가 아니다
    • [예외] 받은 값이 숫자가 아니다
    • [예외] 받은 값에 중복이 있다.
  • [] 컴퓨터의 수 & 플레이어수를 비교한다 ->compare()
    • [] 몇개의 숫자가 같은지 확인한다 -> correctCount()
    • [] 특정 자리에 숫자가 있는지 확인한다 ->hasPlace()
  • [] 같은 숫자만 있으면 ball
  • [] 같은 숫자 + 같은 위치면 strike
  • [] 같은 숫자가 나도 없으면 낫싱
  • [] 3숫자가 모두 같은 위치에 있으면 게임종료.

2.이러한 기능들을 어떤 클래스에 모아줄까?

  • [] 1부터 9까지 서로 다른 숫자 랜덤 숫자 3개를 생성한다 ->NumberGenerator- createRandomNumbers()
    • [예외] 받은 값이 3자리가 아니다
    • [예외] 받은 값이 숫자가 아니다
    • [예외] 받은 값에 중복이 있다.
  • [] 컴퓨터의 수 & 플레이어수를 비교한다 ->Refree-compare()
    • [] 몇개의 숫자가 같은지 확인한다 -> Judgement-correctCount()
    • [] 특정 자리에 숫자가 있는지 확인한다 ->Judgement-hasPlace()
  • [] 같은 숫자만 있으면 ball
  • [] 같은 숫자 + 같은 위치면 strike
  • [] 같은 숫자가 나도 없으면 낫싱
  • [] 3숫자가 모두 같은 위치에 있으면 게임종료.

java-baseball's People

Contributors

hongxeob avatar

Watchers

 avatar

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.