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.

  • So if if we can spawn Great, we will do that.

  • But l if not, game ST dot Contain station stationery stage.

  • Soon as I could figure out a spell stationary unit at that location, um, we will return fall.

  • So if there's some other reason, like so if we try to spawn that unit, But there's already unit there.

  • Um, that's okay.

  • We haven't run out of resources, for example, but for any other reason, we want to return false.

  • And we're done iterating here.

  • Otherwise, if we make it all the way through return true.

  • All right.

  • So now we want to do is create.

  • Basically, this is what will will pass lists, and then we'll pass a type of unit here in that solar guard build defenses.

  • All it's gonna do is build defenses for basically the locations and the type of unit that we pass.

  • So now coming back to our defensive, our defense method here now we want to populate with locations.

  • So again, the game is a fixed size, this grid right here every single time.

  • So everything's in the same spot, so at least to start the best way I can think of to do it is just by manually figuring out like if you hover over here, you can see here that I'm pointing to it.

  • But they're over here.

  • Um, anyway, you can see where the positions are, and so that's probably the way I think most people are doing.

  • It eventually would be cool to somehow algorithmic Lee pick those locations.

  • But for now, we're just gonna hard code them because there's really no reason not to, um, other than later, you might wanna algorithmic Lee choose it based on maybe where your enemy is deploying units, something like that.

  • Anyways, for now, we're just gonna hard code the positions.

  • So defense, Basically, we're gonna say, Okay, where do we want our filters to be placed?

  • And so we're gonna place those, and this will just be a list of lists.

  • So we're gonna place those at 0 13 than 27 13.

  • So that's basically the edge on one side edge of another sign, then 1 12 and 26 12.

  • Then what we're going to say is we're basically gonna pass those to our function here and then make sure that we didn't hit a false at any point along the way.

  • So what we're gonna say is, if not self, don't build defense's and we're gonna pass filters as the things basically, the locations filter is the unit we want to use.

  • And then Game State is thegame state cool, successful?

  • If not, then, um, we want to build our D structures and all the destructor zehr gonna be on the same road.

  • So we're say, Say, say the road is 11 and then we're gonna say the doors there, uh, exposition will be a 2 25 6 2111 and 16 again to pick those, I would just recommend going and hovering over that map to figure out okay, here the positions that I want to use for now and later on you can get a lot more complicated than that.

  • But I think to start, that's honestly, just the easiest way to do it.

  • So now, if not self, don't build defense is.

  • And this time it's destruct er's than destruct door.

  • And then game State and ro equals Roh in this case return.

  • Okay, so now we've got that.

  • And then we could build even Maur, uh, filters after this.

  • Like you pretty much wanna continue populating until, um, until you've run out of resource is pretty much so.

  • Now I'm going to pass filters and this one is gonna be 3 24 4 23 5 20 to 7 28 19 9 18 10 17 12 15 And again, this will basically happen in the order that you passed.

  • So keep in mind that it's like you're not you.

  • You might get a unit to here, here and here, and then you've run out right, and you can't produce any more units.

  • So you'd want to keep in mind that these air in order of importance So you've got filters and then, if not self, don't build defenses.

  • And in fact, we just do this.

  • Copy that pace there.

  • Done.

  • Okay, So let's say that And now come over to our power shell.

  • I'm just gonna hit the up arrow here.

  • And rather than python algo, I think we would have called tutorial algo tutorial algo versus python out.

  • That's fine.

  • We'll run that.

  • Make sure we just don't end abruptly.

  • Okay?

  • It looks like we ended abruptly.

  • Let me scroll up here.

  • Mmm.

  • Okay.

  • Game State not to find.

  • So I capitalized the S and Game State somewhere.

  • Yea, Find where?

  • I didn't actually see this one, at least.

  • Let's save that.

  • Let's run that again.

  • It's totally possible I made that mistake multiple times.

  • Also, could I while we wait on that forint.

  • Looks like I hit another heir.

  • Let's try 36 for now.

  • Ooh, that's quite large.

  • Okay, Our issue here, I forgot to add the row here.

  • Right.

  • So appear we were passing that as part of the location.

  • But what we need to pass here since we're just we're gonna send them all to the same row.

  • Save that run that.

  • And then now what we should get is an actual replay.

  • While I let that go ahead and play.

  • I am going to come over to the algorithm itself and we'll package that up and also upload it.

  • So let me do this, uh, python way actually want tutorial ago.

  • So all you need to do is just zip it up.

  • So you right, click send to desktop.

  • We'll leave it named the same.

  • No problem.

  • And then you can come to play, and, uh, we're actually let's go to my out goes I thought we could upload it in play.

  • Yeah.

  • Come here.

  • Come to one your empty spots.

  • Actually, that other body is the same thing, but let's make sure it works.

  • S we'll go to desktop, coming to, hear, hear, and we'll grab that zip that we just made been.

  • Okay, I'm gonna bring it in That I'll compile for a little bit.

  • Looks like it's almost almost looks like it's done.

  • You compiled pretty darn quickly.

  • And then eventually you'll start seeing some games here.

  • Um who?

  • We've actually made some winds.

  • But as you get games up here, you can hit play and all that.

  • I'm kind of curious how we won without attacking anybody, but Okay, that's fine.

  • So we can play this one for example.

  • Wait for it.

  • Press here.

  • I wish it would just start automatically.

  • Speed it up.

  • So as we can see here, we've we've got our side here and then as the turns progress, we start adding, are more of our defenses in here as we can.

  • Eventually, we are definitely gonna lose this game, But but soon we'll start adding our own Attackers in hopefully doing a little better.

  • But I think right now is a decent stopping point.

  • So in the next tutorial we will add some attacking and I think we'll do much, much better.

  • I think we'll rank a lot better for sure.

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

  • Feel free to leave those blow.

  • Also, if you want, you can compete in a Centex Onley competition at c one games dot com slash Centex.

  • You can come there.

  • There is a $500 cash prize for the for the competition, and if enough players come in, they'll raise it to 1000 so we'll see how that goes.

  • Um, otherwise I will see you guys in the next video where hopefully we do a little more than defend ourselves.

  • But as you can see, our defenses are working good enough.

  • So anyway, questions, comments, concerns, whatever feel free to leave in below.

  • Come chat in discord, especially if you're having any issues.

  • All that that's discord doggies sent, Dex.

  • Otherwise I'll see you next time.

what's going on, everybody.

字幕與單字

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

B1 中級

終端AI大賽 (Terminal AI Competition)

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