generated from gopherdojo/template
-
Couldn't load subscription status.
- Fork 0
segakazzz / 課題3-1 課題3-2 #21
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
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2872a18
Added Initial Code
3aa0556
Added flags etc.
7a7022c
Done Kadai 3-2
5e862bc
Added sync.errorGroup
2922667
Added Flags
f27b8fa
Added README.md for kadai3-2
783908e
Fixed README.md
02f4e5f
Updated README.md for kadai3-1
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
kadai3-1/segakazzz/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| .idea | ||
| cmd/kadai3-1 |
63 changes: 63 additions & 0 deletions
kadai3-1/segakazzz/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # 【TRY】タイピングゲームを作ろう | ||
| - 標準出力に英単語を出す(出すものは自由) | ||
| - 標準入力から1行受け取る | ||
| -制限時間内に何問解けたか表示する | ||
|
|
||
| ## 回答 | ||
| ### 実行方法 | ||
| ~~~ | ||
| cd cmd | ||
| go build -o kadai3-1 | ||
| ./kadai3-1 -json ../testdata/words.json | ||
| ~~~ | ||
|
|
||
| ### オプション | ||
| - -json 入力データをjsonfileで指定 | ||
| - -sec 制限秒数を指定 | ||
|
|
||
| ~~~ | ||
| $ ./kadai3-1 -h | ||
| Usage of ./kadai3-1: | ||
| -json string | ||
| Path to source json file to import (default "../testdata/words.json") | ||
| -sec int | ||
| Seconds to timeout (default 10) | ||
| ~~~ | ||
|
|
||
| ### 実行出力例 | ||
| ~~~ | ||
| $ ./kadai3-1 -json ../testdata/words.json | ||
| [1] drive >>> drive | ||
| [2] part >>> part | ||
| [3] available >>> available | ||
| [4] yellow >>> yellow | ||
| [5] hollow >>> | ||
| -------------------------------------------------------------------------------- | ||
| Timeout! | ||
| # Your Input Answer Correct? | ||
| ================================================================================ | ||
| 1 drive drive ⭕ | ||
| 2 part part ⭕ | ||
| 3 available available ⭕ | ||
| 4 yellow yellow ⭕ | ||
| [Summary] | ||
| Num of Questions Num of Correct ANS Match Ratio[%] Timeout Duration[sec] | ||
| ================================================================================ | ||
| 4 4 100.00 10s | ||
| ~~~ | ||
|
|
||
| ### jsonのデータ形式 | ||
| - オンラインでランダムワードから生成できるツールを用いて、10000個のワードを作成 https://onlinerandomtools.com/generate-random-json | ||
| - 実行時には、ランダムソートを行うので、10000個の中からランダムに出題できる | ||
| ~~~ | ||
| [ | ||
| "recall", | ||
| "work", | ||
| "cold", | ||
| "star", | ||
| ... | ||
| ] | ||
| ~~~ | ||
|
|
||
| ## 感想及び課題 | ||
| - テストコード生成をする。コード生成と同時にテストを書く癖をつけたい。 |
7 changes: 7 additions & 0 deletions
kadai3-1/segakazzz/cmd/go.mod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| module github.com/gopherdojo/dojo8/kadai3-1/segakazzz/command | ||
|
|
||
| go 1.14 | ||
|
|
||
| replace github.com/gopherdojo/dojo8/kadai3-1/segakazzz/tpgame => ../tpgame | ||
|
|
||
| require github.com/gopherdojo/dojo8/kadai3-1/segakazzz/tpgame v0.0.0-00010101000000-000000000000 |
1 change: 1 addition & 0 deletions
kadai3-1/segakazzz/cmd/go.sum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| github.com/gopherdojo/dojo8 v0.0.0-20200703052727-6a79d18126bf h1:lpYevjFQMxI5VNBc3WXV6Z5pDDrdppdDKwmeBoyt5BE= |
25 changes: 25 additions & 0 deletions
kadai3-1/segakazzz/cmd/main.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "flag" | ||
| "github.com/gopherdojo/dojo8/kadai3-1/segakazzz/tpgame" | ||
| "os" | ||
| "time" | ||
| ) | ||
|
|
||
| func main() { | ||
| var ( | ||
| json string | ||
| sec int | ||
| ) | ||
| flag.StringVar(&json, "json", "../testdata/words.json", "Path to source json file to import") | ||
| flag.IntVar(&sec, "sec", 10, "Seconds to timeout") | ||
|
|
||
| flag.Parse() | ||
|
|
||
| err := tpgame.Run(json, time.Duration(sec) * time.Second) | ||
| if err != nil { | ||
| os.Exit(1) | ||
| } | ||
| os.Exit(0) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.