The Java (TM) 2 Platform The AI Corral: In Search of Dirt Copyright (C) 2001 Brian W. Curry Description =============================================================================== A graphical means by which my implementation of the Depth-First, Iterative Deepening, Greedy, and A* searches may be aggregately verified. Instructions =============================================================================== Execution of the assignment is quite sequential. Four files should be supplied you in this compressed archive: This, the concise documentation. Corral.bat, a DOS batch file. Corral.area, a text test file. Corral.jar, a Java JAR file. Simply execute the batch file as is from a command prompt and, having sufficiently hesitated on the Java VM, choose the "File->Open..." menu item. Select the test file listed above and, having confirmed this, select the desired agent from the "Tools->Select Agent..." menu item. Now, as expected, click the "Play" toolbar button--just sit back and watch the cognitive sparks fly! ...oh, and the default location for the logfile may be altered from its current directory via the "Tools->Options..." menu item. Intentions =============================================================================== One is genuinely horrified when first realizing the sheer breadth of files here (...I know I was). This genericity of design is intentional; although it would be altogether excessive for this individual assignment, my busy group for the collective assignment fully intends to use it as the foundation for the initial prototype. This also helps explains the distended package names, as well as profusion of inheritence. Admissions =============================================================================== Repainting is anguishably slow. With the initial intent of displaying icons, this was unavoidable--and in retrospect, perhaps not the best tradeoff. The continual update of the graphical status and textual logfile likewise do contribute to the search's painstaking lethargy. Nonetheless, when not running, it looks pretty. ;-) Regretfully, I allotted little time to documentation of the code itself. Properly done, I expect that to have needed another night's delay, which with two midterms I simply didn't have to give. I thus leave it as an exercise to the reader to extrapolate all the fine details... Constrictions =============================================================================== Synchronicity was, perhaps, the prime consideration in the agent design. You see, the agent is allowed one (and only that) "action" per unit of time, where this action is either a turn or move. Further, the agent is supplied one (and that alone) "percept" per turn, where this is simply the tile immediately facing the agent. Hints are not considered actions, and may be requested at any time. This is in stark contrast to the common approach, in which agents may, each unit of time, be awarded either omniscient knowledge of all surrounding tiles or the divine capability of performing multiple actions. To emphasize the algorithm by which the agent operates, rather than the advantages provided it by the environment, such was not allowed. Algorithm =============================================================================== The core mass of the logic resides in the "expand" method of the "Agent" class, available in the "edu.calpoly.csc480.Corral.Agent" package. This method, modeled near verbatim from the GENERAL-SEARCH algorithm on page 73 of the textbook, maintains a queue (prioritized as needed) of frontier nodes in a depth-first manner. An internal map helps reduce the size of the queue by retaining previously perceived tiles in a two-dimensional matrix. Heuristics =============================================================================== It is with some belated pride that I offer here the circumvention of repeatedly requesting distance and directions hints by the agent (for the Greedy and A*). Though time did not afford my using it, an agent may triangulate the position of the goal having requested a mere two distance hints. This is the following pair of equations, where C is the distance between the agent's starting point (x1, y1) and a second accessible point (x2, y2), B is the distance between the starting point and the goal (xG, yG), and a is the angle between B and C: xG = x1 + B*cos[90 - a - tan^-1 (x2 - x1)/(y2-y1)] yG = y1 + B*sin[90 - a - tan^-1 (x2 - x1)/(y2-y1)] Larry Granillo is kindly thanked for his contribution to this derivation. Criticisms =============================================================================== I would, in conclusion, like to sharply criticize the tedious nature of this assignment. Though doubtless the requirement that we generate the application framework is beneficial to those with little or no experience in that respect, it is of dubious benefit to the veteran software engineer. Having already endured the rigors of CSC 435 and 436 (GUI Development I and II, Dr. Staley taught courses in which many the same sorts of simulations were constructed), I was rather loathe to again construct such an application from the ground up. I mean no disrespect--truly--but I rather expected a course in artificial intelligence.