字幕列表 影片播放 列印英文字幕 what's going on? Everybody. And welcome to part four of the highlight 2018 or highlight three to trail Siri's leading up to this point, we at least got our ships to begin to navigate to something a little more reasonable than random. And we've noticed we have two major issues. One is ships never go and actually deposit their the collected headlight. And two, they tend to go to the exact same position, crashing into each other and sinking to the bottom of the ocean. So, uh, we kind of want to start working on those two things now. And I think the first thing is, we need to stop losing ships. So we're gonna we're gonna stop our ships hopefully from crashing into each other. Now there's, ah few ways that we can do this. The first way that I'm gonna try is just as we generate over ships. First of all, we should always know where all of our ships are as well as where they intend to be. And if there's any conflicts, we should maybe pick a different direction. So So the first thing that I want to add here is right before we start iterating over the ships were just going to say position choices. Our biggest issue is gonna be when two ships opt to move to the exact same position. Now, if you recall, though, we don't actually move ships until the very end. When we've upended everything to the command, Hugh. So position choices will not contain, like, 01 or 10 and so on. Instead, position choices is actually going to contain, um, the physical coordinate on the actual map itself. So with that, we've got position choices. Basically. Now, what we want to do is, um, before we actually upend the command that we want to move. So now we're moving at this like Max Hallett dicked instead. What we want to do is let me just cut that out. And I think really, what I'm gonna do is, uh if shit, I think I'm gonna put trying to decide if I want to put the movement here. Price shouldn't matter too much. Um, maybe I put it in here. So anyway, it doesn't matter that much. Uh, we're gonna say directional choice or really even better put. Um Mmm Mmm mmm. Mmm mmm. Yeah. Yeah. We'll go with the rational choice. And then that'll be the equal to Max. Why did that? Oh, how much made the same mistake I made before. So ship move. Close that off. So that's the directional choice that we want to make. But that's not the actual coordinate choice that we want to make. Um, so directional choice. What we're gonna do is we're going to say position choices dot upend, and then we want to upend the position dicked of that directional choice. So position dicked, directional choice. So if we go back to the position dicked that is on a per ship basis, it maps the actual movement you want to make to the actual coordinate you'll wind up at. So now we have the coordinates of the ships are at least a cornet for this specific ship. Where is it going to be headed? Uh, now we know. So, uh, let me just Where was that? Okay. Here. Position. Directional choice. So then, uh, now this ship just wants to move that directional choice. So at that point, we have we now at least know the coordinates that that ship is going to go, uh, go, too. But Of course, All we do is all we have right now is we just know where those coordinates are. We don't actually, we're not doing anything with them. So the next thing we want to dio is do something with them. Well, the way we make our decision is based on the maximum how light value in that Hal addict and that Hal Addict is based on the move. So instead, what we probably would want to do is when we start iterating over, um, the direction in that position dicked we probably let's just, like, not populate the highlight dicked If it's a conflicting coordinate. So what we should say now is, before we actually upend, we want to make sure that if position, uh if position dicked for the direction that it's thinking of, you know, storing hay at these coordinates, this is how much how late we have. So if position direction is not in already made position choices, position choices, So position, dick direction, maps to coordinates. So if that direction is not our if those coordinates are not already being planned to be headed towards, then let's go ahead and say, OK, we'll store that to, uh, the position choices. Otherwise we we obviously don't want to make that move. Now, that won't help us if a ship is going to stay still, um, and continue to collect Hal i TTE especially if we are like, for example, like it's by per turn. So we would still need thio also collect current ship positions. Uh, and and probably change those as well. But this should help quite a bit. So on Lee time we're gonna add That is, if no other ship is planning to head to that exact same point. Okay, So let's go ahead and save that and see how many errors I've hit for myself this time. What if it does Iran? That would be great, wouldn't it? I want to make sure we didn't hit any errors. Let's see, uh, were in fact, what we could do is let's just delete all of these, and then I could just run it here. That's still open. Game has ended. It looks like that was like a legitimate ending. Let's just watch real quick, pull up the replay, so there's still definitely running into each other. Um, curious. What would they run into each other gets surrounding cardinals bond. Because before we actually navigate to that spot uh, just this do we not upend? Possibly to the note. We definitely upended it. Position choices. So if let's do this else, uh, logging dot info attempted attempting to move to same spot. I don't have my attempting to move the same spot. Let's save that. Yeah, let me just run this again. I don't want to do it. There wanna come into here? Is your so there? It's staying still. And I think our issue is I think they're opting to stay still. Okay, so, uh, let's see. So position dick. Directional try. So what we need to do is we need to handle for if the ship ops to, uh, not move. So if Helen or ship, it's full because I think with staying still, let's try this real quick. Let me do this. This and then this would be the directional choice. Would be direction. Diet. Still, if I recall, right? Yes. So let's go ahead and pen that it's still over so quickly. So watch our replay. If you guys go to the same spot, I'm gonna be so angry with you guys. Okay? Its search seemed like it went really quick, but maybe it just processed really quickly. Faster. I wish this one would go to 10 X as well. Always. Oh, we paused for something. Like what we stopped, or are we actually stopped? Okay. They just stop here for some reason. That's curious. Oh, they got full. That's the issue. Okay, so I guess that's why I went so fast. Is it just didn't actually have to do anything. Okay, great. So, um, so at this point, we have Ah, we at least are to the point we're collecting. Everything that we have to do is code the logic that's gonna be required to go back and deposit everything. So at some point, probably not even at this point. Uh, you know, before your ship is full, you probably wanna start making the trek to go back and deposit or drop off the house that you've collected. So in the next tutorial, that's what we're gonna do. And in order to do that, we need to start tracking, like some state and stuff like that for the ship. So the ship kind of stays on its whatever its task is to do whether it's, you know, go out and collect some more or find the closest place to drop off. So that is what we're gonna be doing in the next video. If you've got questions, comments, concerns, whatever. Feel free to leave those below. Otherwise I will see you all in the next video.
A2 初級 儘量不要碰到自己--海利特三期編碼大賽第4頁 (Trying to not run into ourselves - Halite III coding competition p.4) 2 0 林宜悉 發佈於 2021 年 01 月 14 日 更多分享 分享 收藏 回報 影片單字