WhalesJin
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # EeE-e조 - 숫자야구 ###### tags: `커리어` `iOS` `Swift` `숫자야구` `EeE조` > 순서도 ![](https://i.imgur.com/FDYhad9.png) > 4.25 19:29 N-K, D-S - 변수 생성 - randomNumbers - userNumbers - strike - ball - 함수 생성 - createRandomNumbers() - randomNumber 배열에 1~9 임의의 숫자 3개 넣기 > 4.25 20:21 N-S, D-W - 함수 삭제 - calculateStrikeAndBall() - 변수 추가 - attemptCount = 9 - 시도 횟수를 담은 변수 - 함수 생성 - tryGame() -> createUserNumers()로 변경 - 변수 attemptCount로 횟수를 1개씩 차감 - useNumbers에 추후 readLine할 예정! - 현재로서는 랜덤으로 유저 숫자를 생성(1~9사이) > 4.25 20:40 N-W, D-K - 함수 생성 - checkBall() - 지역변수 ballCount=0으로 설정 - ballCount 1씩 추가 - index 0...2 - 함수 수정 - createRandomNumber() & createUserNumbers() return값 배열로 수정 - 함수 호출 - checkBall() from/to로 호출하여 두 함수 사이에 겹치는 부분 확인 > 4.25 21:40 N-S, D-W - 함수 생성 - checkStrike() - 두 개의 배열을 매개변수로 받아서 자리와 숫자가 같은지 확인 - 맞는 개수를 strike가 센다. - 전역 변수 제거 - 지역 변수를 활용한 리턴값으로 활용 > 4.25 22:09 N-W, D-S - 함수 생성 - playBall() - 게임 시작 함수 - 볼, 스트라이크 개수 출력 - 할 일 - playBall() 의도는 볼 스트라이크 개수 출력인데 제가`if문`을 쓰다가 베렸어요.... - 이거 수정이랑 (전역변수, 지역변수 문제랑) - 출력 조건 - 반복 함수 > 4.26 15:27 N-K, D-S - 함수 삭제 - createUserNumbers(중복이라서) - 변수 변경 - playBall의 userNumbers를 create함수로 받음 - playBall 함수 변경 - if문을 while문으로 - usernumbers 를 while 안에 넣으면서 상수로 선언 - randomNumbers를 userNumbers로 프린트 출력 변경 - if문으로 사용자승리/컴퓨터승리 프린트 출력 - 확인용 프린트들 삭제 > 4.26 15:50 N-S, D-W - 함수 수정 - createRandomNumbers() - !를 사용하지 않기 위해 guard로 변경 시도, 사용해도 된다는 조언을 바탕으로 처음과 동일하게 변경 --- # 숫자 야구 [STEP 1] Karen, Serena, Whales ### PR작성 야호!!!!!@sehoong0429 !!!!!!!! 저희가!!! 드디어!!!!!보냅니다 PR!!!!🐕🐷🐋 ### 고민한 점 > 짝프로그래밍 - 처음 해보는 짝프로그래밍에 인원수가 3명이어서 어떻게 할까 고민이 많았는데 세홍이 조언주신대로 내비게이터, 드라이버, 옵저버로 나눠서 진행했습니다!! 옵저버는 핵엠디를 이용하여 상황을 적고, 적은 내용을 커밋메세지나 트러블슈팅에 유용하게 썼습니다. 시간도 확인할 수 있어서 좋더라고요 👍 - 아직은 모두가 아는 부분이 한정적이어서 서로의 코드를 이해하는 부분이 수월하지 않았습니다. 그래서 짝코딩 사이사이에 이해하는 시간과 대화하는 시간을 가져서 서로의 부족한 부분을 채웠습니다. 대화를 많이 한 소통 부자 EeE조 ~~(제가 많이 사랑해요💕)~~ > 코드 - 처음에 `create` 함수를 두 종류를 만들었다가 기능이 같다는걸 Karen ~~(머쨍이)~~ 이 알려주셔서 `createRandomNumbers` 함수만 남겼습니다! - 느낌표(!)를 쓰지말라는 제약사항을 보고 조건을 부정으로 바꾸는 `!`도 안되는 줄 알고 조건문을 바꾸려 고민하다가 언래핑 느낌표 얘기라는 8기 선배님 말씀에 고민이 해결되었습니다! ~~(머쨍이 8기 🫶🏻)~~ - 전역변수 vs 지역변수 처음에는 나중에 `class`나 `struct`를 쓰기 위해 전역변수로 접근을 하려 했는데 사용자 정의 타입을 구현하지 않고, 함수를 이용하라는 제약사항을 보고 함수 안에서 함수끼리 작업하게 만들기 위해서 지역변수로 변경했습니다. > 코드 외 - [커밋메시지 수정](https://velog.io/@mayinjanuary/git-%EC%BB%A4%EB%B0%8B-%EB%A9%94%EC%84%B8%EC%A7%80-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0-changing-commit-message) 커밋메세지에 최종 수정으로 넣었더니 나중에 알아보기 어려울 수 있다는 8기 선배님 ~~(vetto 머쨍이)~~ 의 조언을 받고 Serena ~~(검색천재)~~ 가 수정하는 법을 찾아오셔서 새로운 도전을 해볼 수 있었습니다!! 하던 중에 <img width="788" alt="스크린샷 2023-04-26 오후 5 33 08" src="https://user-images.githubusercontent.com/124643545/234517939-8d80f062-9200-41f9-9050-f88d80f7586d.png"> 처음 보는 오류(위 사진)와 [해결법](https://velog.io/@yunu/git-pull-%ED%95%A0-%EB%95%8C-fatal-Need-to-specify-how-to-reconcile-divergent-branches.-%EC%98%A4%EB%A5%98)을 알게 되었습니다!! ### 조언을 얻고 싶은 부분 > 코드 - 부정으로 바꾸는 !도 사용하지 않고 코드를 작성을 한다면 어떤 방법이 있을지 조언을 얻고 싶습니다. if문에 false라는 형식으로 해결해도 괜찮은지 의문입니다. 아니면 더 좋은 방법이 있을까요? <수정전 코드> ![](https://i.imgur.com/tH8lQg6.png) <수정후 코드> ![](https://i.imgur.com/061vVVl.png) - 클린 코드를 작성하고 싶은데 혹시 저희가 놓친 부분이 있다면 아낌없는 조언 부탁드립니다. - 되도록이면 하나의 함수는 한 가지의 역할만을 할 수 있게 구현하고 싶었습니다. - 가독성이 좋고 처음 보는 분들이 읽기에도 수월한 코드인지 아니면 구성이나 구조 부분에서도 미흡한 점이 있다면 꼭! 조언해 주시면 최대한 적용할 수 있게 해보겠습니다. > 코드 외 - 깃허브에서 commit 후 push한 commit메세지를 수정하고 싶은데 결국 수정은 하지 못하고 merge를 하는 방법으로 마무리를 짓게 되었습니다. "git config pull.rebase false"명령어를 마지막으로 하여 해당 내용을 일단락시켰습니다. 결국 commit메세지는 수정하지 못하고 마무리하였는데 이럴 경우에 저희가 해결할 수 있는 방법이 있을까요?(지금도 수정이 가능할까요?) - 제대로 일단락 지은것인지도 의문입니다. 일단 merge한 방법으로 마무리를 지었다고 이해하고 있는데 맞게 이해한것일까요? - 하단 이미지를 보시면 최종적으로 commit된 상태인데 저희가 맞게 마무리를 지은것일까요? 아니면 추가적으로 무언가를 더 해줬어야 되는 걸까요? ![](https://i.imgur.com/DAJMIHp.png) - commit할 경우에 카르마 스타일을 따라서 메세지를 남기라고 조언을 해주신대로 남기긴 했는데 너무 짧게 남기지 않았나 싶습니다.(캠핑사이트 내용을 숙지하지 못한 상태에서 진행을 해서 type부분만 적용하고 나머지는 너무 자유롭게 적은것 같습니다.) - commit메세지를 한글로 입력해도 되는건지요??(캠핑사이트 내용을 보면 영어로만 적어놨어요...) - commit메세지를 조금 더 자세하게 남기는 것이 좋을까요? - commit 메세지를 남길 때 Tip같은 것이 있을까요? - 내용을 좀 장황하게 써도 괜찮을까요? 예를 들어서 'refactor: createRandom()함수에서 if문을 while문으로 수정하고 전역변수 userNumbers를 지역변수로 수정하고 매개변수를 추가하였다.' <--이렇게 세세하게 써도 괜찮을까요?? --- ### Step1 수정 - 함수명 수정 - checkBall()/checkStrike() -> checkBallCount()/checkStrikeCount() - 배열 표시방법 통일 - Array<Int> -> [Int] ### Step2 짝코딩 > 4.27 11:00 N-W, D-K - 전역 배열 정의 : `menu = [String]` - 메뉴 선택 함수 정의 : `getChosenMenu()` - 메뉴 프린트 1. 게임 시작 2. 게임 종료 원하는 기능을 선택해주세요 : > 4.27 11:42 N-K, D-S - `getNumbers()`함수 - `readLine()`으로 숫자 입력받기 - 조건문 `guard`했다가 `if`로 변경 - `while true`로 잘못된 입력 다시 받기 > 4.27 16:35 N-S, D-W - 함수 getNumbers()에 if let 조건문에 가독성을 올리기 위해 개행 추가 (컨벤션 이슈) - ~~while문 추가, selectMenu함수를 넣어 준 뒤 선택메뉴 입력 되었을 시 실행될 함수 switch로 구분~~ -> whales의 코드와 중복으로 생성해서 삭제 함. - ~~selectMenu()의 구조 수정~~ -> 삭제 - ~~programRunning 변수 선언해서 While에 조건으로 넣어줌.~~ - 삭제함 - ~~while에 selectMenu(), getNumbers() 함수를 호출~~ -> 삭제 - Whales이 만든 메뉴 함수에 karen이 만든 입력 조건 받는 함수를 불러오는 함수를 만들고 싶었다고 함. - 처음에 게임시작할 때 호출할 excuteGame() 생성 > 4.27 20:00 N-W, D-K - 지역변수를 전역변수로 수정 - randomNumbers, attemptCount, ballCount, strikeCount - 함수 리팩토링 - executeGame 안에서 selectedMenu에 따라 게임시작/게임종료 구현 > 4.27 21:51 N-W, D-S - 9회 플레이 될 수 있게 리팩토링 - playBall() else문에 있던 "컴퓨터 승리"구문을 위로 올림, attemptCount == 0 으로 수정, 컴퓨터 승리가 나오게 수정 - getNumbers()에서 while삭제함 - executeGame()수정 while문을 추가함 > 4.28 10:04 N-K, D-S - 숫자 중복 제한 조건 추가 - Set(input).count == input.count - Int($0)! 수정 - compactMap() 사용 > 4.28 10:30 N-S, D-W - 리팩토링 - ~~전역 변수를 지역변수로 수정~~ > 4.28 10:32 N-W, D-S - 리팩토링 - 마지막기회에 맞추면 남은 기회 0도 뜨고 컴퓨터 승리, 사용자 승리 같이 뜨는 문제 해결 - getNumbers()에 있는 컴퓨터 승리 조건을 playBall()에 사용자 승리 밑에 else if로 조건 걸어서 해결 - 각 함수들 역할에 맞게 파일 분리 ![](https://i.imgur.com/b4NFPhn.png) ### 조언을 구합니.. > 전역변수 처리에 대한 고민 - 함수 안에 변수를 넣어 암호화 처리를 권장한다고 들었습니다. 하지만 여러 함수에서 같은 변수를 받아야하는 경우 어떻게 지역변수를 활용하여 전역변수처럼 사용가능할지 궁금합니다. > 옵셔널 - readLine으로 받는 값의 경우 옵셔널 처리를 할 수밖에 없는데, 이번 과제 조건에 ! 사용 금지 조건이 있었습니다. 그래서 map함수로 받은 readLine값(변수명 input)을 옵셔널 강제 추출을 하지 않기 위해서 compactMap함수를 활용하였는데, 다른 방법이 더 없을지도 궁금합니다. > 짝프로그래밍의 어려움 - 짝프로그래밍 할 때 서로 전체적인 방향성이 다를 때 어려움이 있었습니다. 서로 번갈아가면서 코드를 짜는 식으로 진행되는 짝프로그래밍 상 서로의 코드를 바로 이해하고 진행해야하는 데, 바로 이해하고 코드를 짜야하는 게 너무 어려웠습니다ㅜ 이런 경우 어떤 식으로 준비를 해야할 지 혹은 이를 방지할 방법이 있을지 궁금합니다. --- # 숫자 야구 [STEP 2] Karen, Serena, Whales ### PR 작성 안녕하세요 @sehoong0429 . 세홍께 보내는 두번째 PR입니다. 🐕🐷🐋 여전히 짝코딩이 낯설지만 어떤 부분에서는 익숙해지기도, 또 어떤 부분에서는 어려워지기도 했는데 저희 모두 많이 배우면서 즐겁게 하고 있습니다. ### 고민한 점 및 해결방법 > 전역변수 vs 지역변수 - 전역변수를 지양하면 좋다 라고 듣고 지역변수를 활용하다가 Step2에서 숫자를 `readLine()` 으로 받게 되면서 컴퓨터의 숫자는 고정되고 입력 받는 숫자는 반복이 되어야해서 전역변수로 수정했습니다. > ! (강제추출) 사용금지 - 중간에 `commit` 파일에는 `map`함수를 쓰면서 `nil` 값이 있을 수 있어서 임시로 `map{Int($0)!}` 이렇게 강제추출을 넣었다가 마지막 리팩토링 때 수정했습니다. `nil`을 걸러주는 `compactMap` 함수로 수정했습니다. ### 조언을 얻고 싶은 부분 > 전역변수 처리에 대한 고민 - 여러 함수에서 같은 변수를 받는 경우에 전역변수를 사용하는게 좋을지 지역변수를 사용하는게 좋을지, 또 지역변수를 활용한다면 어떤 활용 방법이 있을지 여쭤보고싶습니다. > `map{Int($0)!}` 수정 대안 - 저희는 `compactMap`함수를 이용해 수정했는데 다른 어떤 방법이 더 있을지 궁금합니다. > 짝프로그래밍 - 짝프로그래밍 할 때 서로 전체적인 방향성이 다를 때 어려움이 있었습니다. 서로 번갈아가면서 코드를 짜는 식으로 진행되는 짝프로그래밍의 특성상 서로의 코드를 바로 이해하고 진행해야하는 데, 바로 이해하고 코드를 짜야하는 게 너무 어려웠습니다. **이런 경우 어떤 식으로 준비를 해야할 지 혹은 이를 방지할 방법이 있을지 궁금합니다.**

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully