feat じゃんけんゲーム用のハンドラを作成#5
Open
Yosh8g wants to merge 6 commits into
Open
Conversation
masakichi41
reviewed
Jun 21, 2026
masakichi41
left a comment
Collaborator
There was a problem hiding this comment.
いくつかコメントしました!
main.go の方は修正お願いします!
ロジックも正確で全体的に良いと思います!
make up でサーバー起動して動作チェックできるので自分で色々試してみるのもおすすめです!
Comment on lines
+61
to
+67
| result := "lose" | ||
|
|
||
| if req.UserHand == cpuHand { | ||
| result = "draw" | ||
| } else if winningMap[req.UserHand] == cpuHand { | ||
| result = "win" | ||
| } |
Collaborator
There was a problem hiding this comment.
もっと良くするのであれば、ここの「勝敗を判定する処理」を、別の関数に切り出すと動作テストとかがやりやすくなります!
Collaborator
There was a problem hiding this comment.
Janken を追加したけど、main.go でそれを作って渡す部分がまだないから、main.go の方で Health と同じようにJankenも追加してもらえると!
s := server.New(cfg, server.Handlers{
Health: handler.NewHealthHandler(database),
// ここ
})現時点では特にDBとの接続とかはないけど、将来的に追加するときに必要になってくるのでお願いします!
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
関係するissue
やったこと
ユーザーの手を受け取り、CPUとの勝負結果とCPUの手を返すAPIを作った
具体的には...