![]() |
Assignment 5The Assignmenthttp://www2.hawaii.edu/~tp_250/ICS211/Fall03/hw05.htm
CommentsI recommend your recursive method returns an array or String of moves. How you want to implement this is up to you. (You can still get an A (9.5/10) if you only want to determine whether it's possible, and not report the actual trail.) Also, you have to decide what format you want to record moves in:
Whatever you decide, make sure you explain your system, both in your program documenation and whenever you print results to the screen. Do you give row or column first? Does numbering start at the top or the bottom corner? Does numbering start at 0 or 1? Etc. If you want your program to work faster that just a brute-force, try-every-possibility technique, do a Web search for "knight's tour algorithm". For example, Warnsdorff's algorithm--rating each potential move in terms of the number of possible second moves from the new location, with a lower rating being better--might help you. Also, keep in mind that arrays are like objects when it comes to using them as arguments to a method call. They are pass by reference, not pass by value. That means if you pass an array (or array of arrays, such as your chess board) to a method, that method will change the original array. (The array does not get copied; there is only one copy of the array.) This can lead to problems in recursive calls, since if you backtrack, you need to undo any changes to the board as you do. (Or, to avoid having to do this, you need to create a new copy of the array for each method call.) Ask me in lab if you have any questions about this. GradingThis assignment will be out of 10 points. You will get points for the following:
|
~ztomasze Index :
TA Details: ICS211:
Assignment 5 http://www2.hawaii.edu/~ztomasze |
Last Edited: 17 Oct 2003 ©2002 by Z. Tomaszewski. |