View Single Post
Old Sep 19th, 2004, 4:49 AM   #10
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Its 3:44am. I wrote a human-interactive version of this program.... approx. 317 lines of code, I did it the hard way, without using any fancy data structures... just nested if statements and while loops, etc.

If you need it to have "AI"... then I can put that in... it shouldn't be that difficult to do.

For example: Here is part of my MoveMouse function that takes the mouse left:

if (direction == "LEFT" || direction == "l" || direction == "L")
  {
    if (myMaze.mLocX == 0)
      cout << "LEFT: Mouse hit boundary wall. Going back." << endl;
    if (myMaze.grid[myMaze.mLocX][myMaze.mLocY-1] == "#")
      cout << "LEFT: Mouse hit internal wall. Going back." << endl;
    if (myMaze.grid[myMaze.mLocX][myMaze.mLocY-1] == ".")
    {
      myMaze.grid[myMaze.mLocX][myMaze.mLocY] = ".";
      myMaze.grid[myMaze.mLocX][myMaze.mLocY-1] = "M";
      myMaze.mLocY = myMaze.mLocY - 1;
      cout << "LEFT: Mouse moves left." << endl;
    }
    if (myMaze.grid[myMaze.mLocX][myMaze.mLocY-1] == "C")
    {
      myMaze.grid[myMaze.mLocX][myMaze.mLocY-1] = "M";
      cout << "LEFT: Mouse found cheese!" << endl;
    }
  }
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote