Current Forum: Homework 6 - Part II |
Date: Thu Dec 13 2001 3:02 pm |
Author: Chen, Richard <richardc@andrew.cmu.edu> |
Subject: Re: Illegal Move after 2 moves |
|
|
Q: Why does MyPlayer.getMove() want to make an illegal move? A: MyPlayer.getMove() is analyizing and returning a move which is outside the bounds of the board. Keep the looping and position accesses/checks in your MyPlayer.getMove() within the bounds of the board. Sorry I can't be clearer or more helpful w/ such advice :)
Q: Do I throw an IllegalMoveException in MyPlayer.getMove()? A: No. Don't throw a java.lang.MyBoard.IllegalMoveException in MyPlayer.getMove() since the given files dictate that your IllegalMoveException is generated after TextDemo.main() which calls TextGame.main() which calls MyPlayer.getMove() and then calls MyBoard.makeMove() which is where the java.lang.MyBoard.IllegalMoveException is thrown (into TextGame.main()). Replace TextGame.main() with GraphicsGame.main() as appropriate. |
|