Open
Conversation
betachelsea
approved these changes
Apr 29, 2023
betachelsea
left a comment
There was a problem hiding this comment.
提出 & 感想ありがとうございました! 参考にして、プラクティスを公開のために調整していこうと思います ✨ 助かりました〜! 🙌
| # target_posはひっくり返す対象セル | ||
| def turn!(board, target_pos, attack_stone_color, direction) | ||
| return false if target_pos.out_of_board? | ||
| return false if target_pos.out_of_board? || pos_stone_color(board, target_pos.col, target_pos.row) == BLANK_CELL |
There was a problem hiding this comment.
[IMO] 早期returnをしているので、あえて別行にしておくという案もありますね〜
いっぱい条件があって無限に右に長くなるときは、こういった形を思い出してもらうと良いかもしれません 👀
return false if target_pos.out_of_board?
return false if pos_stone_color(board, target_pos.col, target_pos.row) == BLANK_CELL
Owner
Author
There was a problem hiding this comment.
ありがとうございます!!
このような記述方法も使ってよいこと、覚えておきます🙌
|
|
||
| def finished?(board) | ||
| false | ||
| [WHITE_STONE, BLACK_STONE].each do |attack_stone_color| |
There was a problem hiding this comment.
[IMO] FBCの方にもコメントさせていただきましたが、書いていただいた実装と、 placeable? のメソッド定義とを見比べていただくと発見があるかも…と思いました! 👀
Owner
Author
There was a problem hiding this comment.
こちらご指摘ありがとうございます🙏
placeable?メソッドの存在にプラクティス取り込み中には気づかず、今見てみたらそのまま流用できそうでした・・😅
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.
お疲れ様です!
期限に対しだいぶ遅くなってしまいましたが、自分のデバッグ力向上のために取り組みましたので、一応提出させていただきます🙏
レビューなどは不要ですので、以下感想など参考になれば幸いです!
感想
難易度
rowとcolの並びがメソッドの引数と配列の添字で前後していて、バグの箇所はわかっても直せないのが少しきつかったです解決するにあたってデバッグツールは活用したか
その他感想など
今まで Rails プラクティスもすべてデバッガを使わずに来てしまっていたため、本プラクティスのおかげでデバッガに触れるきっかけをいただけたこと感謝しています🙇♂️
レベル感的には wc プログラムよりは難しいと感じました。なのでこれの後にあるとよさそうに個人的には感じました。
問題点というほどではないですが、`finished?`メソッドの中身を自分で考えて実装しなければならない点は、本プラクティスの目的を少しズレがあるかも、、と取り組んでいて少し感じました😅
「バグカフェ」のプラクティスは、『頑張って目で追えば解けてしまう』とおっしゃっている通り、簡単すぎるとは思うのですが、「リバーシ」のプログラムは、『デバッガ+頑張って目で追い、プログラム自体をしっかり理解できないと解答まで辿り着けない』点で難易度はかなり上がったと感じました。
それと、
test_finished?のみをテストする際、?の前に\を付けてエスケープしないとエラーになったしまうので、その点もプラクティスに書いてあげると戸惑わずにすみそうです😊