 So to begin, one of the things we're going to be having in this class is problem sets. And so I do want to take just a brief video to sort of walk through a lot of the code that you're being given and sort of give you a good idea of even just where to start. So you can see I've got a number of the problem sets sort of already in Eclipse, but I don't have problem set one. So just like the instructions on Moodle kind of say, if I want to say import an Eclipse project, I can right click on the package manager. I believe I can also go to file and select import. So from here, as you can see, there's a drop down menu that's going to appear. And the focus is we want to have projects from folder or archive selected. We click next and it's going to give us a list of where they are kind of looking for it. I've been goofing around with it. So I have one sort of already pre populated. But in our case, I am going to be downloading a dot zip file from Moodle. So I would select archive. You can see I've got a number of them already sort of lined up. For my sake, I'll go ahead and say I'll grab problem set one. You'll get problem set not complete so you don't get all the private test cases. But I'll go ahead and hit open. You know, if you mess around with this a few times, this will appear. We say yes. Now specifically, you're going to see that there are two options here. You don't need this first one. It's like a folder. That's not really the eclipse project. So you can uncheck it and only have sort of the second one listed. You hit finish and congratulations. You have problem set loaded up in a problem set one loaded into eclipse. So let's take a deep dive into it. So very simple structure working off of a few different packages and test cases. So the big things to start off with will go into the source folder and you can see again there are four packages in total, an agent, an environment, a simulation and a utils. Specifically to the assignment, you only are going to be submitting the robot dot Java or the equivalent in the later problem sets. That is the only file you actually need to manipulate or play around with everything else stays sort of static. But we'll get to that in just a second. I actually want to jump into environment. So you can see with environment, there are a number of different classes that all sort of operate, you know, willy nilly or they have a purpose. So specifically, if we're looking at the action dot Java, that's an enumeration. And specifically for problem set one, you're working off of a cleaning robot. So you don't have many options. You have simply moving right, moving left, moving up, down, clean or do nothing. I don't know why you'd want to do nothing, but maybe then if we look at something like position just to jump over environment for just a second position is operating if you are sort of serving on a two dimensional plane, you know, you have rows and you have columns. And so the idea with position is it's just handling that for you. It has those rows, it has those columns. And as you can sort of see, you also have the ability to where they get the positions above you and below you so you can use this as sort of a node in a graph like structure. There are some protected statements that you don't have control over like changing who your neighbors are. But as you can sort of guess, that's sort of to the point. Then we've got tile because our environment is going to have a number of tiles in it. Same kind of concepts going on here as you see, we have just a quick little way to establish a tile to get its status. This is going to be very important in a little bit. And then a protected tile to a protected method to clean that tile again, this is a self cleaning robot. So once it gets to a tile, we don't want the agent to literally go into the code. We want the agent to give the action clean and then environment will do as necessary. And then finally, we've got tile status, which in our case is just three simple kind of metrics or three simple statuses, status I, you've got the clean tile, you've got the dirty tile and you've got the impassable tile. This is sort of my interpretation of what a wall could be. It's simply you cannot pass through this tile. But finally, we've got obviously the environment, the big one that I have skipped over. And so with this one, the big idea is what we're looking at is again, we need some way to represent the world around us. And if I just sort of run this for a moment, and we'll jump into those in a little bit. But if I run this, you know, again, I have 10 tiles going on here, a 10 by 10 map with one impassable wall here, each one of these tiles has to get represented the status of that tile needs to be stored, etc. And so as you can sort of see, I'm storing a number of different things. One I've got both a position and a map of those tiles. The big idea here is that, again, the positions can serve as sort of your graph structure, but then you need a way to take that position and say, well, what tile is that representing? Then I have an array list of robots. This is specifically if I want to implement more than one self cleaning agent, if I wanted to have multiples, I have the ability to store multiple robots, and I can store those robots positions. Then I've got just how many rows and columns and how many robots are going on here. Then if we sort of come down, we've got just a very simple breakdown of instantiating all of those little places. And then we can kind of come down here. And the next little bit is that I go through every row, every column, and specifically make that tile dirty. Then what I'm doing is I'm going through once more, I'm doing the same row and column part. And specifically, I'm now establishing whether or not that row or call or that tile has sort of a neighbor above it, below it, and to the sides of it. So this is just sort of establishing that relationship. And then finally, creating out those robots, specifically when we think about this part, this is saying that this environment has a robot in it. And we are adding it to the environment. You've got a few other ones as well. So for example, you are able to build your own via a string array, which we'll see in just a little bit. But then we've got some our traditional getters. So get what this tile status is for a given position. Get the robot position from a given robot in case you have multiples. Get tiles, get robots, get rows, get columns. Then obviously we've got the add robot, which is adding both the robot's position and the robot to the environment. Next one we've got going on here is get neighbor tile. So again, if we're thinking about where's this robot in sort of our space, again, what's above it, what's below it, what's to the sides of it, this method is what's going to allow you to have that in action. Then we've got a nice little method just to polish off and make that cleaning a tile super quick and easy. Now when we get into something like this, these are metrics that are how we're going to be evaluating specifically how well your agent did. Get number of cleaned tiles. So again, look through all of the rows and columns. See if it is how many were clean, count it. Get number of tiles. Same kind of thing going on here rather than it being get all the clean tiles. Now we're just saying get all the tiles that are not impassable. This is my sort of boundary check. So validating the position. So if you say to go up, but you're at the border or you say to go right and it's a wall right there, are those valid positions. And so this is just checking to see if those happen. I'm doing a simple try catch to see if I can get that tile or if I do an index out of bounds error, again, just handling that. For this first problem set, we are starting our position at the very top sort of left, but that may change. So think ahead. Update robot position. This is specifically when we are moving our robots, again, where are they going to and then making sure that we know that that's the new location of our agent. This is the big one though. This is specifically as our simulation is running update environment. This is going to be called at every single time second. So specifically, again, we have the array list of robots go through all of them because there may be multiple agents operating at the same time. And specifically, this is sort of the focal point of where your code is going to start coming into play at every iteration of update environment. Robot get action there inside of robot dot Java. There is a get action method that is what your single channel of communication to the environment should be. And so specifically, hey, what do you do next? Then obviously, I'm taking and I'm getting the position from that robot. I'm getting its or its row in column specifically. And as you can see, I've got a switch statement of all of the different possible cases. So in this case, if you say to clean, well, then clean that tile, you say to move down. I'm checking to see if that was a valid position. If it is, then go ahead and move down or left or right or up and then do nothing. You do nothing. Let's see. And then as you can see, again, we've got some performance measures. These are just super simple to, again, take the number of clean tiles, take the number of tiles, and then what's the ratio? And then just a little print statement, same kind of things going on there. This is just a way for us to output that stuff. OK, so we've seen the environment, but I was talking about, obviously, this get action. So let's go ahead and jump into robot dot Java. So with robot dot Java, you've got obviously a lot of comments going on there. But more to our kind of focal point is your agent is allowed to do one of six actions, action dot clean, do nothing, move up, move down, move left, move right. That's it. Those are the only things you need to do. And so it's your decision or your agent's decision on how to make those decisions. With that in mind, again, you've got a method called get action. Get actions sole purpose is, again, or at least the code that you're going to be given to start is just so you can see the ways to interact with it. So in particular, you can see I'm creating a map with a string key to a tile value. And specifically, I'm saying environment dot get neighbor tiles, this. Again, I'm saying for this agent that I'm operating with, who are my neighbors? And then from here, again, environment knows that it looks into its sort of mapping of your position, knows kind of the tiles that should be neighbors to it, and it returns them. Specifically, it's going to return five different things, five sort of keys. Self above, below, left, and right. Each one of those is going to represent. Where am I? What's the tile I'm on? What's the tile above me, below me, to the left of me, to the right of me? And so you've got these allowed. One big thing to sort of point out here is that you're either going to have tile or null as the values, and that's specifically when you're dealing with corners or edges and you're not able to pass through, you've hit a boundary. Something to be mindful of as you start to design out your code. Just some little other pieces to sort of go through is we've also got methods that we can work off of. So position.selfPOS. Again, if you're not worried about the tile, you want to work off of your position, which will start to kind of come up when we deal with, say, for example, the path finding agent. Again, here's a method for doing that. And then how I would extract out both the column in a row from there. Then as you can see, the last little piece here is exactly that. All right, I've received all of the neighbors. I know everything that I could possibly know. And so the question becomes, well, given a tile, again, tile.self, right? If self.getStatus, that's going to go into our tile. It's going to grab, where are you? Get status. It's going to grab whatever tile's status is and then make a simple question. Is that a dirty tile? Tile status.dirty. If it's dirty, in this case, my action was to clean. Then as you can see, sort of from the example code, the other little action I'm doing here is simply moving to the right. So again, if we look at that visualization, that's exactly what we should see. Our agent is moving to the right. It sees that a tile was dirty and it cleans it and then it moves to the right again. Now it's just continuously passing, move right, move right, move right. But again, there's a wall in the way. This little kind of darkened squares, what I'm sort of representing as the wall. So since I've got the visualization up as well, the one thing you can start to see going on here is that we're working off of a number of different maps. Specifically, the visualization is just set for map one. However, if you'd like, you can go in and change it to map two. And you've got a list of those in public. You aren't getting private, those are for test cases. But you've got five maps that you can work off of. So map two, for example, if your test case is failing on that, you can run it and see, oh, look at this. As you can see, just moving right's not going to help you much because there's a wall very quickly in the way. The other little bit is just in case your monitor is a little smaller or you've got a very big monitor. There are some different configurations you can work off of. So config has a number of these. And it's just got some of those settings that we're operating with. So how many iterations should the visualization run? What's the pixel size of the given tiles? What's the delay between time steps? Debug is specifically for printing out messages. But again, if I needed to shrink it for whatever reason, I can go in, config small.txt, tiny or square. And then conversely, again, if you want to show this off to your friends or something, config large, big tiles. So each one of those operate perfectly fine. There we are. And let me switch you back to one. So with Visualize Simulation, again, the big idea here is that we're operating with a number of different configurations. So there is a properties method, or sorry, there's a properties object sitting in space that is loading in our configurations. This is coming from Configuration Loader. All this does is it goes in and it takes whatever it was in, say, config normal.txt, and it's attempting to load that in and process that information. So very simple, just reading through that as necessary. The next little bit is it's parsing out what it saw. It attempts to do it. If not, it will throw in some default values. Then we've got the map manager. So map manager, same kind of concepts going on here. Map manager is specifically designed if you're working off of a map. Again, we've got multiple maps here. This is what a map looks like. It's just a single txt file that has d's to represent dirty tiles and a w to represent a wall. So you can see, if I look at map 2, a lot more w's are sort of in places. Map 5, for example, has a nice little corkscrew or spiral effect, so a lot of dirty tiles, then clean tiles, or sorry, walls. And then you can see here's one with sort of a diamond effect going on there. So this processes that. That builds the string array for visualize to process. And then we've got just the visualization. So building out the environment, we've got just a simple panel here. This is, again, some little gooey aspects going on here. Establishing these. I think the big four point is mostly in this timer. So specifically, again, we're talking about this idea that there are time steps occurring. And a time step is occurring every delay, whatever that delay value is. For our sake, it's 200 milliseconds. Every 200 milliseconds do action performed. And so in this case, the first thing it's attempting to do is update the environment. Now, you notice it's wrapped into a try-catch. And that's more specifically because what happens if your agent does a runtime error or crashes for whatever reason? Well, in that case, we don't want the entire environment to blow up. We just want your agent to blow up. And so what we do is a simple little if your agent crashes, we act like that's just a do nothing. And then as you can see, if you're debugging, what you're able to see here is it will tell you, hey, your agent crashed at this time step. It does a little breakdown of trying to explain what was the case in this example or in a prior example. People who attempted to do a null reference, those obviously were not working. So that was where that error was coming in. Then it redraws the entire environment and updates the where are you? There you are. And then updates a time step. This is more specifically to know when to stop our environment. Specifically, we've got two separate options here. One, if you've cleaned everything, I just go ahead and stop the simulation because you cleaned everything. And then the other one is if you run, but after 200 iterations, we just stop it for the sake of stopping it. Then we've got the paint component. This is mostly you can skip ahead if you're not really interested in the GUI aspect. But I do take pride of it, so I will walk through it. So specifically, this first loop is effectively build out all of the different tiles. So going through all of those, again, tiles, grabbing them, going from each one of those positions. And then if it's a clean tile, hey, we're just setting it to a silver tone. This is mostly first just the edge, if you will. Sorry, this is the fill of the tiles. If it's a dirty tile, we give it a brown. If it is a wall, we give it a black. And then as you can see, we are coming in and saying, hey, all right, since we've set the color of our graphics object to whatever, fill in a rectangle of that color from the starting column to however big tile size was set up to be. And then do that for also the outline. And this is where for the outline, we just work off of a simple black outline. Then go through and each one of the agents do the same thing. Get the position of each one of the agents. And rather than just a rectangle, for our sake, we're just representing the agents as an oval, so a circle. And so again, if we just look at it, that's what you see. All of those square tiles, there's that black outline. There's that silver clean tile. And there's our green agent. Now specifically, you can also see there was a color palette in the configs as well. You're more than welcome to change this. This was just based off of NC State's colors and flat UI colors.com of just here's how all of those colors are mapping. If you want to change it, I have at it. I don't. It's fine. But just moving on. Run simulation is the non-gooie version of this. So if I ran it, you can see there's no gooey. It just outputs, hey, the simulation was complete. This is in case you don't want to wait 200 milliseconds every iteration. You just want to have it go through very quickly. It runs off of the same kind of concepts. The bigger focal point here is that instead of a timer, it's using just a simple for loop. It's still doing the same try and catch. And then once it's done or if you clean, exit out of the for loop and then print out the performance metrics. Let's see. The last little bit, I think, to focus in on is specifically your test cases. Those are kind of important because they're for your grade. So the big idea is, again, with this particular problem set, the goal is clean at least 70% of the environment. So let's see. I think, yeah. So if you're looking at the task of this first problem set, I'm not trying to get you to clean the entire thing. I know we're still early on in the semester, so it would be very hard for you to clean everything. So rather, I'm just saying, hey, given the number of dirty tiles in the environment, if you clean 70% of them, good job. Now, that's not enough. And that's actually where we get into problem sets or the test cases. So the big focal point is each one of these environments are just working off of the different maps. So our first J unit test is just working off of map 1, J unit test 2, map 2, 3, map 3, et cetera, et cetera. More to the point is you're noticing that we're not just running the simulation once. We're actually running it a num trials time. Num trials is 100 times. So what that means is, effectively, we're saying that you need to in 100 trials, or we're gonna run 100 trials on your simulation. And specifically, again, here's run simulation. It does it without the GUI, run it, and then we get your performance measure. If you have cleaned 70% of the tiles, you get a thumbs up. So again, we iterate that count, so successful trials. Then, specifically, here's where things try, you need to pass 70% of the trials. So each trial is, did you clean 70% of the room? And then you have to do that 70% of the time. It's not as complicated as it sort of sees with math, but once you sort of walk through it and start cleaning and building, fleshing out your agents, you'll start to see that these pass relatively easy. But again, as you can sort of see here, we take this, we would run it as a J unit test. I gotta accept it. And as you can see, in my case right now, it's failing because all my agent is doing is run right. But again, if you design out your agent to be a little more intelligent and walk to the right, you should be able to pass all of these test cases without too terribly much of a problem. So with that, I hope that gives you enough of a breakdown of how the problem sets and everything is working. Best of luck.