Placeholder Image

字幕列表 影片播放

  • what's going on?

  • Everybody.

  • And welcome to part three of the highlights Siri's in this part of what we're gonna be doing is building some logic from the ground up.

  • So in the previous video is, we've just really been working with the starter bought.

  • We made some tweaks and even just with those little tweaks, right now, our rank is 934 which is, you know, about 1500 ranks better than running with starter bought.

  • And really, we just made it a couple tweaks.

  • Um, so that's pretty good.

  • Now what I want to do is kind of change gears a little bit and start thinking about place strategies.

  • So generally like the game is not just a things change as the game evolves and at least at the most basic level.

  • I see this is kind of two major tasks right when the game first come first starts, let's say in the environment, pry, your primary objective is to get to planets as quickly as possible.

  • So you really want to prioritize doing that rather than, say, attacking the other player.

  • But once you have the planet's, um, once you've got planets that you're mining.

  • Probably your best bet is to go attack the other player.

  • Especially if you're capable of getting tow more planets more quickly than your opponent.

  • This means you can shut the game down immediately by going and attacking your opponent.

  • So anyways, um, they're likely if if you want to get really advanced and get really highly ranked, there's gonna be a few, many more states that you're gonna have.

  • But for now, let's just say initially we want to mind the planet's.

  • Once we've done that, let's go ahead and attack the other players.

  • So with that, let's go ahead and get started.

  • So what I'm gonna do is, you know, my body the one I'm gonna go ahead and just copy Paste.

  • And I'm gonna rename this one to my bought Dash V two.

  • And now I'm gonna edit my bods.

  • And what I'm gonna do is I'm just gonna clear this out because we're gonna right, Let's just rewrite basically the entire thing.

  • We're still gonna use some some familiar functions and stuff, but we'll start off fresh.

  • So what I'm gonna go and do is import h l t an import logging from collections all import ordered addict, and we're ready to rumble.

  • So let's go and say game equals H lt dot game.

  • And this time I'm gonna call it, Sent the bots.

  • You can call it whatever you want.

  • Um, you call that?

  • So now we can do a logging dot info.

  • Kind of like what they had before, and we'll just say, starting center bots and then some familiar code.

  • While true, the game begins.

  • We every turn, we want to know where the game map is.

  • So game dot update, underscore map.

  • And then just like before, we'll have a command.

  • Que, um, that's gonna hold basically the operations that we want to take.

  • So, um, now ready to begin iterating over ship.

  • So we're gonna say four ship in game underscore mapped out, get me dot All ships.

  • Um, and that's actually has an underscore.

  • Er, all underscore ships.

  • What do we want to do?

  • Well, um, I think we might need ship.

  • I d I can't remember if we're gonna end up using.

  • I'm just gonna comment that Put that in there for now.

  • Uh, if ship dot docking underscore status does not equal ship dot docking status dot all caps fun docked.

  • We want to continue this.

  • Basically, if if the ship is docked, we want to skip the ship.

  • Now we want to do is we need to figure out what's the state of the game.

  • So the game map tells us some information, but we actually kind of want to know the information and according to each, each individual ship.

  • So the way that we're gonna do that is with a few bloops here.

  • So first of all, we're going to use entities by distance entities underscore by underscore distance.

  • And this is just going to use a built in function from that Hlt directory that's going to game underscore mapped out nearby underscore entities underscored by underscore distance.

  • And we do that by the ship.

  • Next.

  • What we kind of I mean, we care about the distances, but generally we care about the distances in order.

  • So right now, this is not in any serious order.

  • So I'm actually going to say entities by distance now is equal to the ordered ordered dicked of the sordid, uh, entity lips.

  • Actually, I saw a copied soldiers paste entities by distance dot items where the key is just gonna be a quick lambda function, so we'll just do land a t colon t zero.

  • So that will start us off as the key is just going to be that zero.

  • So it's it's gonna be the distance.

  • So all this did was just order our dictionary and maintain that order for us.

  • Okay, now that we have that order dictionary, this dictionary contains all entities, including our ships, enemy ships, planets, undocked, planets, um, so planets in terms of being both undocked and owned by us or other people and so on.

  • So the first thing that we're curious about is empty planet.

  • So I'm gonna say, closest underscore empty underscore planets.

  • And this is gonna be a big old this comprehension.

  • But we'll get through it.

  • So it's gonna be entities by distance, um, zero with element, uh, four distance in entities by distance.

  • Um, if is instants So if, uh, entities by distance, distance, which is the key distance?

  • Zero.

  • Uh, if that is also an h l t dot entity dot planet.

  • So if it's roll over, if, um, it's just gonna iterated over entities by distance.

  • Um, so for distance and Adnani's by distance.

  • The entity itself is going to be, um oops.

  • I made a mistake there.

  • The entity itself in question basically is gonna be entities by distance, distance, and then the zero with element that will be, ah, the specific entity.

  • So long as entities.

  • Ah, by distance, long as that entity itself is a planet so long as that's the case.

  • But also, we want this to be an empty planet.

  • So we need to say and not, um and basically, we're just gonna highlight this.

  • This dot is underscore owned.

  • So it's quite the doozy I do.

  • I will put links in the description.

  • So if you missed any of that, um, you can go to the text based version of Suit Oriole and just copy and paste it because that's that's kind of Ah long list there now, but again, we're just iterating over the entities by distance, we make sure it's a planet and that it's unknown owned.

  • And if that's the case, we're just building a list in order of the distance, and we're kind of throwing away the distance.

  • We're just we're all we're doing is we're saving the planet itself at this point.

  • So that's closest empty planets.

  • Uh, now we want to get, um would be a good idea to know our ships because basically, we want to know what are the closest enemy ships and the with the way that I'm going to do that is just by getting the like, just like we did here with empty planets only we're just going to say if the entity is a ship and not one of our ships.

  • So to get our ship's team underscores, ships equals game underscore map dot Get me don't all ships.

  • And in fact, we probably could define that up here rather than doing it every time down here.

  • Mmm.

  • I think I will actually want to do that.

  • So let's say team ships, because we don't need Thio.

  • Reiterate that every loop so team ships equals this.

  • And since we're doing that here, let's go ahead and copy and paste there.

  • So now it's We saved it here, but we also don't need to be calculating that list for every single ship that's a little inefficient, so this will run a little quicker doing it that way.

  • Um and then let's say closest.

  • Underscore enemy underscore ships equals.

  • And again, this one is gonna be very similar to this one.

  • So I'm actually gonna copy paste.

  • So it's gonna be enemies by distance, with the key of whatever that distances in the zeroth element, which will just be okay, that entity for distance in entities by distance, if is instance entities by distance, distance is rather than being a planet, this time we want to make sure it's a ship.

  • And, uh, this also needs to be a capital P for planet.

  • And then and not in this case, we want to make sure that the entity and not entity and not entities by distance.

  • Um, we gotta take that, not there.

  • And that's not in team underscore ships.

  • Well, see, that was a lot of logic.

  • I I might wind up having a copy and paste it myself just to make sure I didn't screw it up, But I think I got it.

  • So once we have that, now we know, uh, the closest enemy ships we have our ships and then we also have the the closest empty planets, or at least planets in order.

  • Closest is probably not the right word.

  • I'm kind of naming these based on what I'm after, but closest would actually be the zero of element, right?

  • Anyway, the show must go on.

  • So So we've got the enemy ships.

  • Now what we're ready to do is we're going to go say if the length of closest empty planets, if that's greater than zero.

  • So if there's atleast one empty planet, let's say we want to run towards that planet.

  • Were going to say the target planet Make sure a stolen screen target planet, um, is going to be the closest empty planets.

  • Zero.

  • Okay, then what we're going to say is, basically, if we conduct that planet, let's docket.

  • Otherwise, we navigate to its senses.

  • Pretty.

  • This is code that you should have already seen before.

  • So if ship on dot can underscore Doc, if we conduct at that target linnet great, let's go ahead and command Q u e.

  • You see there we get a pan ship dot doc at the Target planet.

  • So if we can dock, let's dock at it.

  • Otherwise, let's issue one of those navigate commands, So navigates underscore command equal ship dot navigates, and we're gonna do this ship dot Closest underscore point underscored, too.

  • Target.

  • Underscore planets.

  • Uh, just just for the record, if you want to blow up planets, like, get rid of the planet, Um, you actually just fly into the planet, You just suicide into the planet.

  • So if you wanted to know if another one of your strategies was to blow up a planet, you wouldn't actually navigate to the closest point to the target planet you would actually navigate to the center of that planet.

  • Just just so you know, just case you want to do that sort of thing.

  • Now, you know how, uh Anyway, uh and then we pass game map, we pass.

  • What speed do we want to go at?

  • Um, in this case, we're just going to hlt dot constant Stop, Max, underscore speed.

  • And then finally, ignore underscore ships equals I'll set it to false.

  • Uh, you can do whatever you want to do.

  • Um, I haven't really tested turning these honor off.

  • I imagine maybe there'd be a little less calculations We could run faster, but honestly, this runs pretty fast, in my opinion.

  • So we make that navigate command, if navigate, underscore Command, Uh, we're gonna command underscore to you eat?

  • You eat dot Upenn the navigates command.

  • Okay, Now, uh so that's if there are empty planets.

  • What if there aren't empty planets?

  • Well, l if the length of closest enemy ships, if that is greater than zero, what do we want to do?

  • Well, we're going to say that a target underscore ship is going to be equal to closest enemy ships, the zero with element.

  • And then again, we're basically gonna navigate to that ship.

  • So the way that this works, the way combat in hell it works is you just need to be close enough to the enemy ships, and you will just automatically engage in combat.

  • So that's all you have to do.

  • So props to them, by the way, for making that super simple.

  • There's somebody like things that you can do and how I and yet basically all you really do is navigate.

  • Um, And you I guess you, doc, But you're pretty much always just gonna try to, Doc, if you could dock.

  • Right.

  • So So I mean, I guess you wouldn't necessarily always do that, But for the most part, the biggest thing in this game is you just simply navigate, and you do stuff automatically, which is pretty cool.

  • Anyway, target ship.

  • Let me just paste this in.

  • Um oh, I guess because this was under it else.

  • That's why it was tabbed over.

  • Anyway, it's removed it that extra tab, and then rather than target planet, we're going towards the target ship.

  • Um, everything else remains the same.

  • Cool.

  • So at this point, um, where we need to send a send that final, um, basically run the command Q.

  • So game dot Send command Q And then what is our command?

  • Cute.

  • Well, it is a command, you know.

  • Oh, my goodness.

  • Wow.

  • We got it.

  • Don't worry.

  • Everybody okay?

  • Okay.

  • And then just just to make our eyes feel better, this is when the turn ends, and then the game is ended here.

  • Well, ok.

  • Quite the doozy I probably made near.

  • Listen, I'm just gonna run this real quick check for syntax.

  • Errors know, syntax air, okay, but probably made a logical heir, but we're going to see, So now we're gonna do is run my bought versus that settler bought.

  • So let me figure out where we were.

  • Yes, Um, I guess my about the one.

  • That was our settled, but just basic settler.

  • If I Yeah, so we just run them against that, I think.

  • Let's just check this bat quick.

  • See what?

  • Or running.

  • If we run that, it'll run my bought versus my bought V one.

  • Okay, I'm I'm content with that.

  • Let's, uh let's also delete these just so I know what is fresh and what isn't Scented Body came in, drank one good.

  • Let's run it again.

  • Also came in rank one more time.

  • Okay, So he's he's he seems to be doing pretty well for himself.

  • S Oh, let me.

  • I'm gonna be really surprised if we just wrote all that out and there's no air and see Let's run this replay real quick.

  • Oh, what just happened?

  • Please work.

  • Thank you.

  • Okay, Cindy bought is purple.

  • So so far, he's looking pretty good.

  • I'll know more once we take over all the planets, though, that's embarrassing.

  • Yeah, we definitely attacked good stuff.

  • Let's run one of the other replays.

  • Let's just make sure it seems like the game, the game's air ending really quickly, mostly because poor little cellar doesn't know what to do with himself.

  • He's also traveling really slow.

  • We actually should run him versus V two, which is faster.

  • Let me do that real quick before we submit it and embarrass ourselves with a bad rank.

  • So I'm gonna change that to my bought vite to this time.

  • And let's run that.

  • There we go.

  • We got to at least a few more turns.

  • Scented body came in rank one.

  • Let's run one more.

  • Um, okay, rank one again.

  • So he's doing very well.

  • Let's let's see, though, that second to last one took a little longer.

  • Let's just see if we made any mistakes.

  • So we book is it's a lie because we both Blore ships up yet another major mistake everybody seems to be making, um, I haven't yet figured out how many ranks that will save you if you don't make that mistake, but I'm gonna wager it's probably a decent number, I think probably just at the beginning of the game.

  • Maybe just make your ship's temporarily fan out, and that might solve the problem anyway.

  • Okay, Our bots looking good, I'm content.

  • Let's upload this bad boy.

  • So let me go and highlight Hlt.

  • Highlight my but, uh, send to you can't see it, but I'm doing it.

  • Ah!

  • Oh, Did you just do that to me?

  • I think it was this one.

  • Submission three.

  • Okay, so let's make the submission now, Dragon Inn, Submit it.

  • And I think what I'll do is I'll just kind of pause this and I will restart it.

  • Ah, once we start playing some games and I can confirm that we're actually playing and then we can kind of see how the rank does, but it takes a pretty good amount of time for your rank to drop.

  • Um, so probably even initially, it a little jump, depending on how we how we do in those initial games.

  • Anyway, I'm deposit for a little bit and I'll restart once we've played some games.

  • All right.

  • I've only really played a few games, but we've already dropped our rink.

  • Uh, clips.

  • I'm not sure why I went to submit about.

  • Anyway, we've dropped a rank pretty soon.

  • OK?

  • Really wants me to be on this page?

  • There we go.

  • We've dropped a rank pretty significantly.

  • As you can see, we've got quite a few wins here, so, uh, we're doing pretty good.

  • And then here's Ah, one of the recent games.

  • Um, it's looking pretty good.

  • We're definitely populating much, much faster.

  • Yellow Player really could do himself a favor by going faster.

  • Really?

  • All these guys could have done themselves favor.

  • I actually, anybody wants comment below.

  • I I have not seen really any player negatively impacted by zooming around fast.

  • So because even on the starter, But the most basic logic you're you're so much better if you just running around quick.

  • Um, anyway, yeah, so it looks like me and orange player moving fast.

  • The other two were moving slow.

  • One of the guy's already dead.

  • Another Charles.

  • Yeah.

  • This is the game over.

  • Nice.

  • Uh, okay, maybe.

  • But we've dropped further rank.

  • We're gonna almost certainly make it into the least seven hundred's.

  • Um, look at all these wings.

  • We did make some losses that Let's check out these losses.

  • I'm gonna wait till we run into ourselves.

  • Let's see Formed.

  • Carla, am I blue?

  • Oh, my Whoa.

  • Sorry.

  • I have to replay that.

  • I wasn't even looking, so let's see so immediately.

  • Um, you know, the game launches boom.

  • We've run into two overs like two of our players.

  • Our ships are gone, and then we go to the same planet, an attempt to dock at the same time, which is just auto death for every unfortunate person involved.

  • So were knocked out of this case.

  • Oh, my gosh, That's pretty funny.

  • It's comical.

  • Anyway, um, yeah, that's gonna That's a really simple fix.

  • Or at least that's a simple problem.

  • Um, I'm thinking you could just fan out really quickly in the beginning, and that won't be an issue anymore.

  • Um, anyway, I bet that's going to save a lot of games, though.

  • Man.

  • That looks really good.

  • All those winds.

  • Look at this.

  • We almost had a full page of winds.

  • Uh, 801 We will be intothe 700 soon.

  • Um, I can't remember.

  • Is this one that we are?

  • I can't remember which one already played.

  • Let's see if we blow ourselves up immediately.

  • No, this is a different one.

  • I know it.

  • This is a different one.

  • And we did blow ourselves up.

  • I think we only and we started with one ship, right?

  • Yeah.

  • So we just start with this guy, and then he runs of this planet by now.

  • We've pretty much lost the game, but we're still zooming around, doing our best.

  • Oh, the last guy.

  • He lasted a long time, but, yeah, we are out of the game.

  • At that point again.

  • This game could have gone a completely different direction if we just didn't make that one tiny mistake.

  • So, yeah, definitely worth worth fixing that one.

  • Uh, now into the coming stuff.

  • I'm probably pretty done covering rule based bots.

  • There's I'm still gonna keep messing around it.

  • I think it's kind of a fun challenge, but I can't keep messing around and sharing everything with everybody.

  • Otherwise, what's the point?

  • It's not a competition anymore.

  • If I recall, right, the competition ends January 20 sick, and I think it is.

  • Let me look real quick.

  • See if I get the official date.

  • No.

  • January 26th.

  • So the competition goes all the way till then.

  • Maybe after that point, all brakes break some of the other rules down that I'm playing with.

  • Just to give you some ideas, though, think about what other people are doing as well.

  • So like, so like, a lot of people are likely to do things like first.

  • We'll run into themselves fix that.

  • But also think about that.

  • The strategy's other people have an attempt to contra contradict one of those strategies there.

  • Take advantage.

  • So, for example, um, what's one of the flaws that you could take advantage of in our body?

  • Well, if we look at our code here, um, lips, that's not the one I wanted.

  • I want to do my bought that pie.

  • Basically one of the things that are bought is always gonna adhere to is right here, right?

  • It's always gonna go towards an empty planet.

  • So one of the strategies you could plausibly take is leaving one of the little planets as kind of baked, right?

  • Just leave it there.

  • Right.

  • Um, some of the other things you could take advantage of to is like if if if you're in, like a one v one V one V one situation, you could purposely not attack the player that's clearly gonna lose the game or that has no chance of beating you like all the plants are occupied.

  • Uh, you might not want toe waste time and lose ships going after this.

  • Small guys kind of let the bigger other people take care of those because most people are just gonna randomly do it.

  • Like like what we've done.

  • Where does going toe is the closest enemy ship.

  • That might not necessarily be the best idea.

  • And like I said before, it might also be a good idea to leave a small little bait planet off somewhere else.

  • Let other people waste their time going to that planet, or even kill ships that code to that planet.

  • Just don't mind that planet.

  • Just protect the planet.

  • So anyway, um yeah, stuff like that where you kind of want to start, not thinking in terms of how quickly can I mind.

  • And how do I get my stuff and all that?

  • I think in terms of how do you how do you counter other people's strategies?

  • But anyways, that's all for me.

  • For now, I'm also curious about trying to do some deep learning, or at least just some machine learning.

  • I'm not really confident.

  • Deep learning is required on this task.

  • It it's probably gonna be solved.

  • Almost just is accurately with something like a nears neighbors or something like that.

  • Um, but, uh, not unless I am gonna be kind of poking around with that.

  • If if I come up with something basic enough to share, I'll be sure to share that one with us.

  • Well, um, anyways, one final rank check for a sign off.

  • This here yet.

  • Okay, so we definitely breached into the seven hundreds.

  • So pretty cool.

  • And now we're actually starting to lose some games, so we're probably gonna be somewhere in the seven hundreds.

  • Anyways, I hope you all have enjoyed.

  • If you got any tips or tricks you want to share with us, feel free to leave it below.

  • Otherwise, I will see you in another video and good luck in the competition.

what's going on?

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

定製機器人--2017年海利特二期人工智能大賽第3頁 (Custom Bot - Halite II 2017 Artificial Intelligence Competition p.3)

  • 5 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字