The CMAC class provides an extremely simple implementation of tile coding for the programming assignment. This tiling code will only work for rectangular grid tilings over a discrete state space (e.g. a gridworld) and allows only for evenly spaced offsets between tilings. The constructor has 5 int parameters: tilings, tileWidth, tileHeight, worldWidth, and worldHeight. The first parameter is the number of tilings to be used. The second two parameters are the horizontal and vertical size of an individual tile, respectively. The horizontal (vertical) size of an individual tile is the number of gridworld states the tile will span in the horizontal (vertical) dimension. The last two parameters are the horizontal and vertical sizes of the gridworld over which the tilings will be placed. So, an example tiling for the homework problem would be: CMAC cmac = new CMAC(10, 50, 50, 1000, 1000); This would create a CMAC with ten tilings, each one offset from the next by 5 gridworld states in each dimension (50 states/10 tilings), and whose individual tiles each span 50 gridworld states in either direction. To obtain the currently active tiles for a given position in the gridworld, call the function getTiles(int x, int y), where x and y are the current horizontal and vertical position of the agent in the gridworld. The function returns an array of longs of size equal to the number of tilings. Each element of the array is a unique number (over all tiles in all tilings) assigned to the active tile in that tiling. So, you would obtain the current vector (phi) of non-zero features for the function approximator for gridworld state s=(x,y) as follows: long[] phi = cmac.getTiles(x, y); The CMACGUI is a very simple visualization of the tiling scheme implemented. Change the constructor call in the main method to reflect your desired tiling scheme and/or gridworld size. Once loaded, the display shows the gridworld (the blue square), the agent (the tiny red square, which starts in the bottom left corner), and the currently active tiles, with each individual active tile shaded a slightly different shade of green. You can move the agent around by using the directional keys. As the agent moves you can see the currently active tiles switch to reflect the new position. The display is scaled down by one half (a 1000x1000 gridworld is displayed as a 500x500 pixel square) so that moving the agent two states in one direction moves its graphical representation in that direction by one pixel. This has not been extensively tested in the slightest so I offer no technical support, and if you put in crazy values for anything you will most likely get crazy output. :-p Additionally, this class requires JDK 1.5 to compile, so I'm including the precompiled class files (CMACGUI.class and CMACGUI$DisplayPanel.class) for those who don't have 1.5. You still need to compile CMAC.java normally. Of course, if you use the class files you won't be able to play with the values in the constructor. I tested the CMAC code itself as best I could and as far as I can tell it's working correctly. However, I haven't plugged it into an algorithm or anything like that so there certainly may be bugs in it. If you find one let me and Andy know, obviously.