-
Michael, I cannot tell you how much I appreciate the help you have given me! It truly means a lot for you to take the time out of your day to help a beginning programmer out! Again, thank you! I looked at your code and understand it and have modified it just a little to display the amount of times the mole won and the percentage of it's chances of his escape.
Now send me a PM with your address so I can send you a gift card to a restaurant of your choice!
-
Thank you nick. But you don’t owe me anything, its been a pleasure to share the little bit of c++ knowledge I’ve learnt. And lots of very nice people on this forum have helped me too, so we all move forward a little bit.
Make sure you understand that you used a fixed length array of 100 elements and this restricted the mole to a maximum of 100 moves. Comment this at the top of your program.
When you come to do vectors you will see how it can be done more efficiently by dynamically allocating memory.
Here’s a typical sample of my output for comparison.
Good luck with your studies.
***Statistics ***
Number of attempts : 500
Successful attempts : 6
Success rate : 1.2%
Failed attempts : 494
Failed left : 265
Failed right : 31
Failed top : 146
Failed bottom : 51
Failed > 100 moves : 1
Total moves made : 7469
Ave moves per attempt : 14.94
Last edited by Michael432000; 10-13-2010 at 01:37 AM.
Popular pages
Recent additions