B1 中級 1 タグ追加 保存
what's going on?
And welcome to part five of our Hal I tw three or hell I 2018 Competition video.
Siri's in this video.
We're gonna be working on just kind of continuing to build this script.
So right now we've got our ships going out and, uh, somewhat, reasonably finding how light and collecting it.
But as we saw in the last video, everything's ending with ships that are just full.
So within a relatively short order our ships get full of highlight.
They elect to stay still or not move anymore.
They definitely don't need to be collecting Hal it anymore.
And now it's time that they go back to the actual shipyard to drop off the things they've collected.
So that's what we're gonna be doing now.
So to do that, basically, outside of the wild true loops So inside of this, this is updated every frame.
But there are certain things that we're gonna want to track even outside of that.
So what I'm gonna do is say we're gonna say ship states, and this will be an empty dictionary.
And them, uh, we're gonna start iterating over our ships now.
If our ship uh, if if shipped up the i d is not in ships states at all.
This is probably because the ship was literally, like, just bond.
We're gonna say ship, uh, ship states shipped out.
I d equals collecting.
So if it's just bond, it's a collecting ship.
I can't imagine any other reason why wouldn't be in ships states, Uh, so I'm gonna assume that that will handle things.
Then what we want to do is I kind of want to leave these things in because I'm trying to decide if I want to leave Position options are Lex.
If we leave this in, we can always do it.
Check as faras If we're about to, like, run over somebody or at least we can upend that ship's position.
Ah, to make sure our other ships don't run into them because right now I kind of want to show a different navigation method.
So if we go into here, um, I'm trying to think where it even comes from is probably let's do Hal.
I ts, uh, position als maybe.
I mean, just look for a navigator.
I forget where where it is.
Ah, let's see.
It must be Let's try game map.
So naive.
Now you've navigated.
So here they've got this get unsafe moves, and then you can mark as unsafe.
And that appears to be very similar to what I'm doing.
So you may wanna, uh, check out this method rather than using what I'm doing, but I'm going to continue, I think my way.
But basically, what naive navigates going to do is return either a direction or directions.
Still, in both cases, we can still collect that position.
Um, and both system should work with each other because at some point, you're gonna want something more complicated than naive navigate.
And I might maybe at some point here, I'll show you guys what I'm talking about.
As far as why do I even navigate or my navigate is not yet good enough.
Um, and we'll get to that.
So anyways, but what's nice about naive navigate is you get your input a destination.
So it's not just like a singular move that you're gonna make you input.
Where do you want your ship toe end up?
And then from there, it attempts to calculate how it's gonna actually get itself there.
So anyway, let's go back here.
So, yes.
So after this.
So at this point, I'm gonna say we're gonna run a run.
This stuff if, uh, if the idea is collecting.
So if ship states, uh, ship that I d equals collecting, then let's see.
Then we'll just run this.
But in this case, okay, if the Hallen amount so the ship will stay still for this or ship is full.
I'm gonna remove this because this is not, um not really what I want.
I don't think so.
Because at some point, you were basically gonna want to say if the ship is, you know, has more than some amount of Hal I ts So now this is the game at, like, what?
What's the Hallet on the game map there?
So I think I'm just going to remove that worship is full bit and do this, um, and then maybe here So then we'll see.
If Hallet amount is less than Constance Max.
Well, we definitely don't want that.
Is that where we had the divide?
Yeah, that's where we have to live by 10.
So we'll keep that, uh and then else.
So if it's less than 1/10 of a blessing 100.
Then it's gonna move.
Um, in which case I'm not even sure I like that one.
I mean, pardon me, wants to just do this.
Um, we're even more so if it's just collecting, let's just make it collect because it's going to collect based on the most wise decision to move anyways, So that should be enough.
So if it's collecting, duel that, then what I'm gonna want to say is, if ship dot hal I amount is greater than, um, I don't know if we're bringing Yeah, we're bringing constants constants dot max Hell I And then let's say, divided by three for now.
So this is kind of a parameter that you're gonna wanna decide for yourself, and probably it's gonna change depending on where you are in the game as well.
But if two ships collide into each other, they both sink, and that might sound like it's equal battle.
Like if your enemy Clyde's into you, you both just lost a ship.
But it's not really true.
So if you're always collecting up to 1000 Halle in your enemy only collects like 100 Hal I per ship.
And if it's a one V one, then starts being advantageous for them to just run their ships into your ships because you're going to sink with 1000.
How light?
And they're only gonna sink with 100.
So anyway, you probably wanna always collect and fill up your ship completely.
So if the ship that Hal I'd amount is greater than 1/3 of the max so greater than 333 what do we want to do?
Well, let's just say, uh, let's do this Shipped out states, and then we'll call this depositing.
So then, if now, at this point and in fact here, uh, could be problematic.
So if let's do this so we'll call this LF because obviously this is depositing that I'm about to ask if it's if it is depositing some almond say if Ship States shipped out I d equal.
Don't do that.
Uh uh.
Depositing the positing.
Then we want to actually go on deposit.
The reason why I wanted to flip that is you can't.
So here we're sending the command.
If you send the command que, um, you have, you can't you can't send to commands per ship.
If you do that, it's not like it's gonna take the most recent one or something.
No, it's gonna error, so So don't do that.
So, uh So that's why I wanted to flip these, because here we change it to depositing.
And then after that, you asked this question.
Well, you're in trouble.
Um, we could also use now left, but I'm gonna do it this way.
So anyways, if ship states shipped out, I d equals depositing.
Ah, what do we want to do?
We're going to say now the move equals and we're going to use that game map naive.
Navigate that naive underscore, navigate.
And we want to navigate the ship to me dot shipyard underscore position.
There's also, like, get drop offs.
Um, I don't know.
I forget where get drop offs is drop off.
Yeah, OK, so it's in game map so you can get drop off so later.
If you've added Maur, drop off locations on you're not sure you know which one you want to navigate to.
You can do this.
You Also there's ways to calculate, like the Manhattan distance to all the drop offs associate close to your ship so you can pick the closest one and so on.
So anyways, but for now, we just have a shipyard.
So we're going to say our move is game map naive navigate.
Shipyard position.
So this is gonna navigator ship back to the shipyard.
Now, what you're gonna want to do is from here we add that command q dot upend ship dot move.
Whatever that move is.
But we also are going to want to so naive navigate, since we're running this first already is going to mark certain moves unsafe for itself.
So we should get away with running this one first.
Um so But the other thing we want to do is at least notify our other little system that we've got going on here.
The position choices.
So again, we want to, um where is position choices?
Uh, what do we do it before?
Oh, here we go.
So position, dict.
So we'll just take this copy paste.
And instead of so directional choices actually move in this case, and then we'll append.
Um, we do this shit move, and that should be good.
Let's see what we screwed up this time.
Something for sure?
We didn't make it very far.
So ship states invalid syntax.
What's the imbalance in tow?
I'm just not seeing it.
Okay, It's that That one.
I'm looking over here for the colon.
Okay, Save.
Look at us.
We made it.
Ah, good distance this time.
Okay, so now let's go back here into replays.
And 7 41 See what we did.
It doesn't look like Oh, wow.
We definitely crash into ourselves.
Okay, so at no point here do we actually collect.
And why is this guy is that just me?
Maybe that means he's full actually crashed into each other.
Very nice.
Very nice.
Good work, team.
So in this case, and they just all went to the same spot, which is kind of weird, because they definitely weren't.
They shouldn't have.
So there are.
At least they're definitely so crashing into each other and depositing collecting.
Positive depositing.
So the other only other thing I think I could try is converting the like we could rather than moving.
So after you've upended the move, positional choice, uh, move here is already a naive navigate.
What we could do is convert our other move to and I even navigate possibly, um it might be the case that we aren't were unable for whatever reason to actually access this.
I'm not really sure.
Um, let me try that.
So shipped up directional choice.
So directional choices, the actual direction.
Ah, position dicked is the directional choice that we wanted.
So what if we did?
Shipped out, Move game map dot Naive navigate ship, too.
That coordinate that we chose.
So what if every move is a naive navigate cause they're definitely using that mark and safe thing.
I'm just curious if that'll solve the problem or not.
Uh, let's go here banned, but they still don't want to actually go in deposit.
It's really frustrating.
He's got 1000 allied.
So something is clearly wrong in my logic, depositing if Oh, uh oh, my gosh.
Okay, so we had double equal.
That's obviously a true false kind of thing.
Not a assignment depositing.
So now this is not happy.
Okay, In this case, the issue was me dot shipyard dot position, not underscore position.
So, uh, running that again, the game ends, and this is an example of one of those replays.
So in this case now, we're just getting all jammed up at the actual drop off location.
So the only other thing that you would need to do at this point is, once you've dropped off, it's time to, uh, move over and, uh, make way for the other ships.
So, um, I think what I'm gonna do is stop it here in the next tutorial will focus on doing that in some of the other little things that we need to do.
Thio get our ships a little more efficient and also out of the way here.
So anyways, questions, comments, concerns, whatever.
Feel free to leave those below.
Otherwise, I'll see you guys in the next video.


Moving to drop off halite - Halite III coding competition p.5

林宜悉 2020 年 4 月 1 日 に公開
  1. 1. クリック一つで単語を検索


  2. 2. リピート機能


  3. 3. ショートカット


  4. 4. 字幕の表示/非表示


  5. 5. 動画をブログ等でシェア


  6. 6. 全画面再生


  1. クイズ付き動画


  1. クリックしてメモを表示

  1. UrbanDictionary 俚語字典整合查詢。一般字典查詢不到你滿意的解譯,不妨使用「俚語字典」,或許會讓你有滿意的答案喔