Skip to content
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

Merged
merged 21 commits into from
Jan 6, 2022

Conversation

ikemuuu
Copy link
Collaborator

@ikemuuu ikemuuu commented Jan 5, 2022

#55

以下やり残したことありだが,一旦これで.

やり残しリスト

@ikemuuu ikemuuu requested a review from EndoNrak January 5, 2022 14:35
@ikemuuu ikemuuu self-assigned this Jan 5, 2022
Copy link
Owner

@EndoNrak EndoNrak left a 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:
Copy link
Owner

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)):
Copy link
Owner

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]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hoge = -hogeは
hoge *= -1で書いてもいけるよ

Copy link
Collaborator Author

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
にしてまう...笑

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

言語によっては・・・を言い出すとjavascriptではスライスは.slice()やし、、、
とかになるから、言語に合わせていくべきなんじゃないかと思ってるなー

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど
slice() とかはさ,メソッドやん
上のhoge *= -1はさ,四則演算やん
なんかね,個人的には気持ち悪いんよね笑(直しときます)

Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この辺のクラス変数ってinitのところで初期化しないのは初期化のタイミングをinitよりも先にしたいから??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

puperun の実装的に,Mode 切り替えのたびに,
新たにインスタンス生成するから,init 以下に入れると,毎回値初期化されるかなと思って.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あーそういうことかー
じゃあ、このクラスが持つべき情報ではないってことな気がするけどどうやろ
puperun側で持つべきなのかも?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

puperun はメインであり,従順な奴隷でしかないとおもってるから
puperun から他ノードに出ていく情報は増やしたくないな〜

Copy link
Collaborator Author

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 もクラス変数かなとも思ってしまう

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確かにノードとやり取りする情報は増やしたくないな

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

たとえばほかのモードで使う可能性があると考えるとpuperunで持っとくべきかもとは思った!

Copy link
Owner

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 もクラス変数かなとも思ってしまう

Copy link
Owner

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に渡す感じどう??

Copy link
Collaborator Author

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
Copy link
Owner

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:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callbackの中でsideの判定するのは、callbackのたびに毎回呼ぶことになるからよくなさそう?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

初回以外,1つ目のif文で弾かれるんやけど,それでもしんどいかな??

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sideの判定は初期化感あるから最初に一回だけのイメージない??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いやそれは絶対にそう
シンプルにいいやり方思いつかんかった笑

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

完全に上の話
#57 (comment)
とつながってるな

@ikemuuu
Copy link
Collaborator Author

ikemuuu commented Jan 6, 2022

このあたりやりだしたら(気になりだしたら)きりないので,一旦敵検知行きます笑

@ikemuuu
Copy link
Collaborator Author

ikemuuu commented Jan 6, 2022

これマージしといていい?

Copy link
Owner

@EndoNrak EndoNrak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge了解

@ikemuuu ikemuuu merged commit e2d6899 into main Jan 6, 2022
@ikemuuu
Copy link
Collaborator Author

ikemuuu commented Jan 6, 2022

#58 で引き続き検討

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants