Enclosed is the source code for a game called Clue. However, there is a function needed called ComputerSquare. The function is partially complete but needs to be finished up. What this function needs to return is either the spacenumber or roomnumber so the computer will know the best route to get to the destination room. Also enclosed is a test application so you can test many different cases. The info being returned is MoveInfo which is the SpaceNumber and RoomNumber. One of them needs to be filled in but not both. In every case, needs to return the best move for the best route to the destination. To run the test, run the following steps
1. Choose Player and click New Turn
2. click one of the squares to put them on a square
3. when ready, click room and click on test computer square
the piece will move based on the results of the function.
The parts completed so far are these cases:
1. if there is only one move available, it will move there
2. if it reaches the destination, then will move to the room
3. there is a collection of possiblemoves (must choose one from the list)
4. there is a collection of spaces that are blocked because a piece is on there
currently, randomly picks one of the possible moves. Needs to be replaced with the best move
If it needs to goto another room to get to the destination, that's fine. For example, if the current position is 58 and its trying to get to the ballroom, then the best move is to goto the lounge. Then goto the conservatory then goto 158, etc. to the ballroom. The function cannot take more than 5 seconds to run to figure out the best route. This was in VB.net and must remain in VB.net
Let me know if you have any questions.
The computersquare function completed for the enclosed game. All work completed must be done to the ComputerMove Class File.
The full source code for the game again with the new updated computermove class for the computersquare function.
Windows XP Home Edition.