Placeholder Image

字幕表 動画を再生する

  • what's going on?

  • Everybody.

  • And welcome to part two of our hell light three and slash highlight 2018 tutorial.

  • Siri's in this video we're gonna do is start adding some logic to our bond to hopefully get it to not move so randomly, maybe move with a purpose.

  • So, uh, I'm gonna start doing this locally, So if you want to follow along locally, uh, just QO to the learned tab here and then downloads and then download the python three version for your operating system.

  • When you do that, you will get something that looks like this, Um and this is the file that we're gonna be modifying them My bought file, so s So go ahead and do that.

  • And let's go ahead and get started.

  • So the reason why I really want to do this is because logging doesn't seem to work as well on the Web editor, for some reason.

  • Like I don't actually get all my log output on the Web editor, whereas locally, when I do logging dot info, I get it and you can't print Ah, with the, uh, you know, built in Web editor because of the way how it is actually processed.

  • You're gonna it's gonna it's going to see those things that you print and think that's an input to the game engine.

  • And it's not so anyways, we're gonna start working locally.

  • So, um and then this file is exactly the same file you get if you download it.

  • I just removed basically all the comments because we went through everything.

  • I only left this one because it's important to remember that this is where the two second timer begins.

  • Okay, so let's go ahead and get started.

  • And, um, basically, our main issue here is that our ships are just moving randomly to collect how light.

  • And now what I want to do is start moving to wards.

  • Highlight instead.

  • So after a quick, you know, kind of poking around the documentation, um, I found that every ship a ship has a position, and from that position, you can't so from any positions, it's not.

  • It's not a ship attributes.

  • It is a method of any position you could need.

  • So, um, so from any position you can do a dot get surrounding cardinals.

  • So that means get the north, south, west and east, so you can get, um, that the information Not only the position of those positions, but also the you can use that to start figuring out.

  • Okay, Well, how much how light is at each of those positions?

  • So you could start at your ship's position and be like, Okay, what are the surrounding cardinals here?

  • Where is the best?

  • How light in the next closest move I could possibly make.

  • And that's what we're gonna D'oh.

  • But you could later, you know, kind of expand that out as many iterations as you could possibly handle and then choose the direction that is the most advantageous to you.

  • Probably taking into some consideration the other ships that you've got.

  • But yeah.

  • So anyways, we're gonna We're gonna make use of this, uh, this method here.

  • So coming back over to you, or bought four ship in media get ships.

  • The first thing that we want to do is our choice is to move because each ship can only move, like for each turn.

  • Each ship could only move once, like one position, and it can only go up down left, right.

  • So we have choices, so choices will be shipped dot position so shipped opposition is that position object?

  • And then we can do the dot Get surrounding, uh, get surrounding cardinals.

  • Yeah, so we can get those surrounding cardinals now.

  • What we can dio is in fact, I think I might should have less than I might.

  • I might have us actually keep this logic.

  • This is probably pretty good starting logic here.

  • Um, but we don't necessarily want to move randomly, But the next thing I'd like to do is let's just do a If game dot turn number equals 15 we're in a logging dot info choices.

  • So at turned 15 we're gonna save a bunch of choices.

  • Now, let's just run this game really quick, so to run it, you can look at this run game batch file, and in fact, this should work right out of the box because we've kept our name is my bought dot pie.

  • So you could either run it right from here, Or you could, you know, like you could modify it, and then just you just double click this, or you could just open a command.

  • You know, don t x c and run it.

  • But I'm just gonna double click it That was pretty quick.

  • Um, and I also don't see any really errors.

  • Let me do that again.

  • Okay, so I think we're hitting some sort of error here.

  • So let me go ahead and just copy this.

  • I want to actually see there, so I'm gonna open up command prompt.

  • Let's run this real quick.

  • Oh, okay.

  • Some sort of python issue about tabs.

  • And so I just put it, I just installed, um, sublime text.

  • Let's see.

  • So I'm pretty sure we're the ones.

  • Yeah.

  • Who?

  • I don't know what the option is in.

  • Uh, shoot.

  • Okay in, then.

  • Using spaces.

  • Maybe.

  • Who?

  • Okay, now I got okay.

  • Now we just gotta find the rest of them, so it looks like this one might be the last one.

  • Okay, Now, let's try again.

  • Run game.

  • Okay?

  • It looks like it works.

  • So whenever game runs, you get your logging information comes here, So if we click on one of these will see indeed at turn 15 we got the positions.

  • The cardinal positions at the surrounding cardinals per ship, and we should have gotten the same thing for bought one.

  • Yeah, there it is.

  • Also, whenever you run you also get replays in here and some of these air air logs from before.

  • So in fact, let me just delete those.

  • And then let's just run this one more time so we get the right log.

  • So now, going into replays, we can see we got a replay, and then we get a row logs for each of the bots.

  • So I click on this and this is currently just contains warnings about, um, about our ship.

  • So, for example, each time your ship moves, it needs to exhaust Hal.

  • I TTE eso.

  • In this case, it was directed to use four.

  • How light.

  • So it could move south, but only had zero Hal.

  • It's so the ship could no longer move, for example.

  • So anyway, uh, closing out of that, we've got a replay in.

  • If you wanna watch your replay, you can just go in here, click watch, and then just click and drag the replay anywhere on that page and boom, Here's our replay.

  • Uh, the other thing we can do is change your theme, which I'm going to do now, too.

  • Ooh, there's a new theme.

  • So there's color blind highlight to which is what I had been using and then rogue like I'm not sure what that does.

  • Besides, apparently not let us change it immediately.

  • Interesting.

  • It's like, uh, I've never heard of Rogue like before.

  • Um, but it looks like asking or something stuff.

  • Okay.

  • Anyway, I'm gonna go with highlight, too, though dragged that in.

  • Okay, so yeah, because with rogue, late rogue, like, how could you can't see the actual highlight.

  • So I'm not really sure what the deal is there any way?

  • Cool.

  • So that's basically kind of the workflow that I tend to use at least when I'm starting.

  • Eventually.

  • If I'm just tweaking little things, I'll just go play copying, pays my code, and look at it really quick.

  • There make quick tweaks.

  • But as long as I want a log info, um, I'm gonna do it locally.

  • So Okay, so now that we've got the get surrounding cardinals Ah, the next thing that we want to do is get the hal I TTE for those surrounding cardinal positions.

  • So that's what I'm gonna be doing in the next tutorial.

  • If you've got questions, comments, concerns, whatever feels really below.

what's going on?

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

A2 初級

地元を走り、周囲のデータを手に入れる-ハライトⅢコーディング大会 p.2 (Running locally and getting surrounding data - Halite III coding competition p.2)

  • 0 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語