I have a project in which I need to create a "robot" that goes around and picks up batteries in a space (100x100 or whatever). I am stuck on the best way to hold his AI instructions. I want to create a list of some kind that has all instructions the robot would ever need. Example: if the robot is in a spot it would check the surrounding spots for a battery, empty space, or a wall. I want to create a lot of robots and give each scenario a random action (go up, down, left, right, etc) Each turn the robot does something. The robots with the best outcome (highest batteries) get to the next level.

Maybe this was too many details for my question but, would an array be the best way to hold the instructions?

Looking for a push in the correct direction. I am new to Java having gone through just 1 beginner class of it so far. Not looking for the code itself (examples are nice but I want to do my own work), of course, just ideas as to where to begin with the AI instructions.

有帮助吗?

解决方案

To start with you should forget about what sort of data structures you are going to need, and start from the beginning. What are the robots legal moves - write that down, and get it crystal clear on how you want the robot to run.

You should write step by step use cases for each of the options which include what the positions are, sensors, batteries etc.

Once you have written all this down, the data structure will be much simpler to identify.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top