Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

hokita / 課題3-1 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hokita wants to merge 2 commits into master
base: master
Choose a base branch
Loading
from kadai3-1-hokita
Open

hokita / 課題3-1 #19

hokita wants to merge 2 commits into master from kadai3-1-hokita

Conversation

@hokita
Copy link

@hokita hokita commented Jul 24, 2020

課題3-1 タイピングゲームを作ろう

課題内容

  • 標準出力に英単語を出す(出すものは自由)
  • 標準入力から1行受け取る
  • 制限時間内に何問解けたか表示する

ヒント

  • 制限時間にはtime.After関数を用いる
    • context.WithTimeoutでもよい
  • select構文を用いる
    • 制限時間と入力を同時に待つ

動作

$ go build -o typing
$ ./typing
ddd
>ddd
Good!
aaa
>aab
Bad..
aaa
>aaa
Good!
bbb
>
------
Finish!!
Result: 2 points

カバレッジ

$ go test -coverprofile=profile github.com/gopherdojo/dojo8/kadai3-1/hokita/typing
ok github.com/gopherdojo/dojo8/kadai3-1/hokita/typing 0.046s coverage: 46.7% of statements

(低い。。)

工夫したこと

  • 入力は「【TRY】チャンネルを使ってみよう」を参考に作成
  • 過去のgopherdojoのレビューコメントを確認してscanner.Scan()のエラー処理を書いた。

わからなかったこと、むずかしかったこと

  • run()関数の良いテスト方法が思いつかなかった。
    • input()のようにテストしやすい単位でメソッドとして外だしをしたかったがこちらも思いつかなったか。
  • エラーハンドリングが合っているか自身がない。

@hokita hokita changed the title (削除) 課題3-1対応 (削除ここまで) (追記) hokita / 課題3-1 (追記ここまで) Jul 24, 2020
@hokita hokita added the kadai3-1 課題3-1 label Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

kadai3-1 課題3-1

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /