-
Notifications
You must be signed in to change notification settings - Fork 0
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
ジャッジサーバのスコア状況を利用した効率的な移動 #57
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
処理の内容理解できてないけど、とりあえずどうでもいいかもしれない文法のことだけ書きましたー
|
||
with open(path_waypoints_depending_on_score) as f_score: | ||
lines_score = csv.reader(f_score) | ||
for l_score in lines_score: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f.readlineで一行ずつ読んだ方がメモリ効率いいんじゃなかったっけなー
読もうとしてるcsvがそんなに行数大きくないなら気にしなくていいけど
if Waypoint.waypoint_reverse_flag_for_blue: | ||
# blue side の場合は,180度ひっくり返す | ||
if self.warState.my_side == 'b': | ||
for i in range(len(self.points_depending_on_score)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
range(len(hogehoge))はenumerateに書き換え
if self.warState.my_side == 'b': | ||
for i in range(len(self.points_depending_on_score)): | ||
self.points_depending_on_score[i][0] = - self.points_depending_on_score[i][0] | ||
self.points_depending_on_score[i][1] = - self.points_depending_on_score[i][1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hoge = -hogeは
hoge *= -1で書いてもいけるよ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
俺これいっつも迷うんやけど,
hoge *= -1
この書き方NGな言語あるやん?
なんか自分の中では一つに統一したくて,結局
hoge = -hoge
にしてまう...笑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
言語によっては・・・を言い出すとjavascriptではスライスは.slice()やし、、、
とかになるから、言語に合わせていくべきなんじゃないかと思ってるなー
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほど
slice() とかはさ,メソッドやん
上のhoge *= -1はさ,四則演算やん
なんかね,個人的には気持ち悪いんよね笑(直しときます)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほどなー笑
その考えはなかった
どっちの方が速いんかな
一緒な気もするけど
for i in range(len(self.points_depending_on_score)): | ||
self.points_depending_on_score[i][0] = - self.points_depending_on_score[i][0] | ||
self.points_depending_on_score[i][1] = - self.points_depending_on_score[i][1] | ||
self.points_depending_on_score[i][2] = self.points_depending_on_score[i][2] - 3.141592654 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hoge -= 3.14….,
way_point = 0 | ||
next_lap_flag = False | ||
count_waypoint = 0 | ||
waypoint_reverse_flag_for_blue = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この辺のクラス変数ってinitのところで初期化しないのは初期化のタイミングをinitよりも先にしたいから??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
puperun の実装的に,Mode 切り替えのたびに,
新たにインスタンス生成するから,init 以下に入れると,毎回値初期化されるかなと思って.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あーそういうことかー
じゃあ、このクラスが持つべき情報ではないってことな気がするけどどうやろ
puperun側で持つべきなのかも?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
puperun はメインであり,従順な奴隷でしかないとおもってるから
puperun から他ノードに出ていく情報は増やしたくないな〜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
何やったら使い方的には,この情報ってほかから絶対参照しやんから,
データ属性,より,クラス変数のほうがしっくりくるんやけど,普通の使い方的には,
なるべくデータ属性にしとくべきなんかな??
これ言い出したら,self.marker_no_offset = 6 もクラス変数かなとも思ってしまう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
確かにノードとやり取りする情報は増やしたくないな
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
たとえばほかのモードで使う可能性があると考えるとpuperunで持っとくべきかもとは思った!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これ見ずに言ってた!
絶対に参照しないんやったらそうやなー
何やったら使い方的には,この情報ってほかから絶対参照しやんから,
データ属性,より,クラス変数のほうがしっくりくるんやけど,普通の使い方的には,
なるべくデータ属性にしとくべきなんかな??
これ言い出したら,self.marker_no_offset = 6 もクラス変数かなとも思ってしまう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これpuperunのselectModeCallBackのなかでいちいちmodeの初期化してるから悪いんじゃね???
初期化はpuperunのほんとに最初にやっといて、selectModeCallBackのなかはそいつらをself.naviに渡す感じどう??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
puperun をそもそも変えるならそれで問題ないと思う
ただ,strategy は今のほうが美しいとは思う笑
self.warState.is_enem_left_marker_gotten = True if self.all_field_score[0]==0 else False | ||
self.warState.is_enem_back_marker_gotten = True if self.all_field_score[1]==0 else False | ||
self.warState.is_enem_back_marker_gotten = True if self.all_field_score[0]==0 else False | ||
self.warState.is_enem_left_marker_gotten = True if self.all_field_score[1]==0 else False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool(hoge)でhogeが0ならfalse、0以外ならtrueって判定できたきがする
可読性はびみょーかもやけど
print('get data!') | ||
print(self.warState.enem_get_wall_marker_no) | ||
|
||
if Waypoint.waypoint_reverse_flag_for_blue: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callbackの中でsideの判定するのは、callbackのたびに毎回呼ぶことになるからよくなさそう?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
初回以外,1つ目のif文で弾かれるんやけど,それでもしんどいかな??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sideの判定は初期化感あるから最初に一回だけのイメージない??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
いやそれは絶対にそう
シンプルにいいやり方思いつかんかった笑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
完全に上の話
#57 (comment)
とつながってるな
このあたりやりだしたら(気になりだしたら)きりないので,一旦敵検知行きます笑 |
これマージしといていい? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge了解
#58 で引き続き検討 |
#55
以下やり残したことありだが,一旦これで.
やり残しリスト