In this assignment you will create a memory for each of the critters that will
store the reinforcement that gets received when a particular type of action is
executed in the context of a particular perceived texture.
You will work only with the Brain class.
You should submit only your Brain.java file.
Go to the Vincent page for the class to upload the file.
Start by downloading the version of the program that you will use for this assignment.
You will only need to edit the file Brain.java, but you will need to call methods
in the Effector, Sensor, and Utils classes as well.
step() so that it randomly selects one of these actions and executes
it, no matter what situation the critter is in.
You will want to use the method getRandomInt in the Utils class for
this.
The action methods are all in the Effector class.
Note that each now returns the reinforcement received by the critter in attempting to execute the action.
memory that is a two-dimensional array of ints.
Each of the ints should start at 0 when the Brain is created, but
each position in the array will eventually hold the accumulated reinforcement received when
a particular action is attempted after a particular texture has been perceived by the critter.
That is, the "rows" and "columns" of the array represent perceived textures and types of actions.
You only need to consider four textures since we won't be dealing with predators in this
assignment, and note that the constants representing these textures are just the integers 0 to 3 (in Sensor).
Also write a method that prints out the contents of the memory.
Note that there is now a method sayWord in Effector which prints
out its String argument without adding a newline character.
int representing a texture,
an int representing one of the three actions, and an int representing the
reinforcement received after the action was attempted.
step() further so that it checks the texture of the cell in front of the critter;
selects and executes an action, saving the reinforcement received; updates the memory on the basis of the texture, action, and reinforcement; and prints out the memory.
For example, if there are two critters, something like the following might appear in the
message window after a step.
brain0 -3 -4 0 0 0 0 -5 -1 0 0 0 0 brain1 -2 -4 0 0 0 0 -10 0 10 0 0 0You can test your methods using any of the worlds in Data.