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.