Placeholder Image

字幕表 動画を再生する

  • what's going on, everybody.

  • And welcome to a tutorial on Correlation one's Game of Terminal, which is a competition where you compete against other players.

  • The kind of a game map, like other games you might have seen, like how light or something like that, although this is a fixed game map.

  • But the idea is you compete against other players at writing.

  • These bots in various languages will, of course, be using python.

  • So Correlation One is just a company that aims to help other companies find data scientists by way of having challenges like this.

  • Really no, not much different than like Kagle or like two segments.

  • How light, for example.

  • So I think the best way to learn terminal is likely.

  • Just go play it by hand a couple of times, or you can follow along with this tutorial.

  • Hopefully learn it.

  • But before we get too far into a to toil, I just want to describe the actual unit types because that's pretty useful to understand what you have.

  • So it kind of falls under the unit types falling or two different categories.

  • You've got Attackers and defenders, so under Attackers, you've got Ping e M.

  • P and scrambler.

  • The ping is a very, very cheap unit, but also it doesn't really do much other than, um, it.

  • Basically, it's It's really fast, but it's weak, so it'll get destroyed quite quickly.

  • You've got the E M.

  • P, which is a lot more.

  • It's a lot slower, but it's quite powerful.

  • And then you've got a scrambler which also affects other enemy information units as well.

  • Then you've got your defenders.

  • You've got a filter.

  • The filter again is cheap.

  • Can't disrupt any enemy units.

  • But it can kind of get in the way.

  • Create a wall.

  • Basically.

  • Also, you can use it to protect your other larger defender units.

  • So you've got a now you've gotta destructor.

  • This is quite expensive, your biggest one.

  • But it can also destroy other enemy units.

  • And then finally, you've got the encrypt our which just strengthens your, um your offensive units or your information units.

  • Okay, so basically, you can read more.

  • There are tons of rules in just documentation in generals for is how things actually work because all you do is you place and you start your enemy units like you deploy at a location and that's it.

  • So the rest, like all the movement and stuff, is just completely automated.

  • So would be wise, probably to go read the documentation to get an idea for exactly how each thing is allowed to move and like what happens in certain scenarios.

  • So, really, it's more about coming up with a strategy and placing units.

  • I kind of like a like a game of chess or something like that, rather than a game like Hal, I TTE where actually your biggest thing is like, How do you want to move?

  • This is more of how do you want a place units?

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

  • There's two kind of major ways you could do this.

  • You could either code locally and then upload your algorithm on and then see how things went.

  • But generally, I think, to develop, you want to be able to see like what errors you might have made and stuff like that.

  • And so if you just upload, its a little challenging.

  • But it can also be challenging to run it locally, especially unlike Windows.

  • But if you go to their get up, we'll put links in the description for all this stuff.

  • You can, um you can get the install.

  • Basically, you're going to need python 3.6 or later you're gonna need power shell, which comes with Windows 10.

  • Otherwise, you can install it.

  • You also will need Java 10 or later.

  • Um, and then you need the starting script.

  • I've already done all the things that I need to do, but again, definitely go to their, um, get up like an ill will link to the get hub in the description, for sure.

  • Also have a text based version of this tutorial s so you can get all the info.

  • But probably the hardest thing is just making sure this part works.

  • It could be a little finicky with power shell.

  • And also, I'm just not that creative power shows was actually the first time I've ever made use of power shell.

  • But like I said, you actually don't have to use power shell.

  • Also, if you're on a macro clinics, you'll be fine just in your terminal.

  • It's really just if you want to run on windows, but it is super useful to be able to develop locally so you can actually see what errors you hit.

  • So anyway, the next thing I'm gonna do is, uh, clone this.

  • I'll download zip, and we'll get started also in terminal.

  • I'm already logged in, but you can log in with your get, huh?

  • Basically, So I'm gonna move this over.

  • I was hoping to stick it to the side of the screen.

  • Somebody that's not working.

  • Okay, so I think what I'll do, I think I'll leave that up.

  • So I'm just gonna extract this great.

  • And if you are on Windows or any other operating system, for example, and you just don't have java or whatever, feel free to pause the video, get the things that you need to actually run, and then come back while it's taking a while to extract and think that was gonna take so long.

  • So once we have that, uh, go into this directory here and than into the master here and just for the record to, like, run things, you can just type our show again.

  • If you're on Windows to get that to pop up here.

  • Cool.

  • So, uh, now for just a quick example of, like, running things, this will be the way that you run pretty much everything.

  • Also, make sure if you do type Python that that corresponds to python 3.6 or greater.

  • Okay, so the next thing is like to run something.

  • I would type like Python, and then we want to run scripts and then it's run, underscore match dot pie And part of me wants to shorten this so it doesn't take up the entire screen, But it's okay.

  • I'll just do maybe this anyway.

  • We want to use run matched up I and then the two things that we want to run.

  • So in this case, we're just gonna run this sample algorithm here, So it'll be python algo so then you just say, uh, python algo versus python algo en er And make sure that works.

  • If that doesn't work, for whatever reason, feel free to come into like our discord.

  • Discord dot g slash Centex and feel free to ask questions.

  • Also, check out.

  • Like I said, the correlation wouldn't get hub, um, in all that because they're like I said on the windows, it could be a little finicky, especially with running various different things and permissions, issues and stuff like that.

  • So just take note of that.

  • Okay, So anyways, this appears to be running just fine.

  • Whenever it is done, we'll get a replay in this replace directory.

  • Looks like we've got one building right now.

  • Uh, and then once you have the replay, you can come into the terminal website and then go to play.

  • And then right here you can drag and drop a replay file.

  • But first, we're just going to get coating and then worry about the replace.

  • But also in here, you can play like by hand and then versus a body or something like that, or by hand versus by hand.

  • It's kind of a good way to figure out a strategy to play.

  • Or you can play like by hand versus one of your bots and stuff like that.

  • It's pretty cool.

  • So, um, minimize.

  • This'd, in fact, what we could do.

  • I could just upload that since that's done.

  • Now, So you just click and drag that over to the replay file Here.

  • Hit, watch, replay, maybe pressure.

  • I clicked it.

  • This machine is going kind of slow today area.

  • Start the tutorial or start the replay rather.

  • Okay, So as you can see, and then you can cut speaking, speeded up by coming down here.

  • And then I can go like a dex Speed.

  • Uh, anyways, eso these air like the defensive units, and then this is like an attacker unit, and the goal is to get to the opponent's edge.

  • And that's kind of how you get points or get word of enemy health stuff like that.

  • So now, um, wait a minute.

  • My status.

  • And I guess I'll leave this up for now.

  • We'll come into here, and I am going to make a new directory, and we're gonna call this tutorial algo, and then we're gonna take some of the files from the python algo Here.

  • Cool.

  • Well, take game, lib, Run, Run!

  • Uh, this is a power shell script, by the way, uh, I'll go Jace on, and I'm gonna copy the algo strategy as well.

  • We're probably just gonna empty it, but it's okay.

  • Uh, and then we'll come into, uh, Where is the one I just made?

  • Tutorial.

  • Algo.

  • I need to zoom in.

  • I can't even see it.

  • There we go.

  • Cool.

  • Okay.

  • Now, the only thing we need to modify here is your strategy and I'm going to use sublime text.

  • You can use whatever you want to use open with blind text.

  • Cool.

  • All right, I'm gonna empty that out.

  • Start nice and fresh.

  • All right, so now what we're gonna do is begin to build our algo first of an import game live.

  • This just has a lot of the helper kind of functions and stuff for interacting with the game for us.

  • Then class tutorial bought.

  • And then in here, we will inherit from game live dot algo core.

  • So then we have a defined on game start.

  • This just is run one time.

  • This is where you going to say any of you like you're kind of constant values or variables that you want to use throughout self dot com big equals.

  • The configuration is past.

  • For now, we're not gonna set anything but pretty quickly.

  • Will set like units there.

  • Is that like, the unit the library of up of the units that we can choose from.

  • Basically, it was not gonna change.

  • So that's like something that you would stay here and you sort of like constant value.

  • Then what we're gonna say is defined on turn itself in turn state.

  • And for now, we'll just pass here and then finally to run.

  • If name equals main algo equals tutorial, but and then I'll go start.

  • So it's just kind of like a quick initial skeleton of how things were gonna work and then basically on.

  • So here you'll define all your starting values or whatever.

  • Then on turn, this is where your logic will go.

  • Now, um, this doesn't do anything, so let's go and do some stuff.

  • First, we'll set some of these starting value.

  • So we're in a global.

  • We're in a global a bunch of stuff here.

  • Filter in crypt, er, encrypt or, uh, d struck door ping MP scrambler unit to i.

  • D.

  • So we're in a global All of those Russian not gonna set unit to I d Ah, here.

  • So we'll take this means you met a little bit cool.

  • And then we're gonna say filter and character destructor paying MP scrambler equals and then we're just gonna do a quick list comprehension.

  • Here.

  • This will be equal to the config or self dot config unit, uh, in formation.

  • And then we'll use index and then shorthand four i.

  • D.

  • X in range six.

  • So that's just gonna generate over these unit types.

  • Basically, eso weaken, save those.

  • So when later we could just reference filter, encrypt er, destructor and so on as the thing that we want to build, right?

  • So those are just our unit types would be nice if the's were just, like, stored in some way that we could just import them.

  • I think that would think a little more sense, but this is the way that I'm gonna do it for now.

  • So, uh, now that we've done that, we're ready to actually do something on on turn.

  • So first we're gonna get the game state.

  • That's gonna change every single time.

  • So game, lib dot game, state, self dot config and turn States such as tells us what the state of the game is so we can get certain values where things were placed in all of that.

  • Then what we're gonna do is game ST dot enable warnings equals false.

  • So right now it seems to be, I don't know, some sort of bug where you get, like, this warning every single time.

  • So I'm just going to turn that off.

  • If something's happening, you'll still get certain errors and stuff just fine.

  • Um, and if for whatever isn't something's happening and we can't figure it out, we can set this back to Troop, but we end up getting this, like, could not spawn at location, um, over and over and over, even when that's not an issue.

  • So we're gonna set that toe false for now, then on turn, Basically, we've got two different types of units that are doing two different types of things.

  • So we're gonna basically have two methods.

  • One for attacking, one for defending.

  • So we're gonna say self defense.

  • And this will take in a game state for now and then.

  • Self dot attack.

  • Also Game State, and then game ST dot Submit, turn, and we should be good to go.

  • So then, obviously we need to have these methods actually exists so real quickly.

  • We'll just add those.

  • So So define the fence.

  • So game states for now, we'll hit a pass here and then define attack.

  • Self game state game Saturday game state and will pass again.

  • So the logic for defending will go here in the logic for attacking will go there.

  • Okay, so now we will start with our defense logic.

  • So what we're gonna do here is, um basically, I think what we'll we'll have ah, quick helper here.

  • So define build defenses.

  • And what this will do is build defences if we can otherwise kind of notify us if something went wrong.

  • Basically.

  • So self location list, uh, location list, firewall unit, game state and ro equals none.

  • So these are kind of like coordinates, or you can pass row here so you would have, like, a row and then an ex location.

  • So Rose.

  • Almost interchangeable with why?

  • Um so it's basically, you know, where do you want to place a unit?

  • So again, pretty much the entire game is all about whether it's a defensive unit or an attacking unit.

  • It's Where do you deploy that unit?

  • That that's all you have to think about in this game.

  • So, um or at least that's what the only action you get to take you obviously need to think about a little more and that probably take into account some of your enemy positions stuff like that.

  • Okay, So, um, so then what Will dio is?

  • You man, It's more as we continue have too long of lines.

  • Uh, four location in the location list that we pass, if not type location if not type location list.

  • Um, then we're going to a location equals a list that is Location X and then what road you want to be on?

  • Why?

  • So then, um that basically is gonna populate the things for in terms of like where we want to place units.

  • And then what we want to say is, if game ST dot can spawn a fire fire wall unit at that location so reasons why you wouldn't be able to spawn something, Maybe something's already in that spot or something is passing through and so on.

  • So, um and you might also can we afford to actually spawn it?

  • So anyway, game State can spawn.

  • OK, so what will say is game, ST dot uh, want to capitalize that game state attempt to spawn a firewall unit at that location, and then we'll use the bugging game lib dot de bug.

  • Uh, underscore right.

  • F strings firewall unit deployed at location, then, um, clips.

  • We will decrease that resource.

  • So game state Staats player underscore.

  • Resource is zero cores.

  • Maya's equals game, ST dot type underscore cost fire, wall unit.

  • So if we've, um, spawned one of those what we want to say, they're basically we want to take away the cost from our resource is so we know later on Can we can we spawn, for example?

  • Okay, so once we've done that, make some space here.