Abhi Pande wrote:Its very frustrating. Please see my code and tell me I'm fit for programing...
Well, you've certainly put some effort into it, and that's a good sign. You also clearly have a grasp of
Java language basics, which is another.
I'm afraid frustration comes with the territory - even for us so-called "experts" - so we can't help you there.
The main problem I see is that you're trying to
code a solution, and that's
not likely to work. When you write a class like '
HelloWorld' you can dive straight into code, but as problems get harder - and yours actually says "(Hard)" - you have to
StopCoding (←click) and
think.
Coding is a
linear process, and I suspect you're getting yourself tied in knots trying to think it through step-by-step (what Campbell refers to as "discrete logic"), when what you need to do is step back and look at the problem as a whole.
Here's a couple of questions for you:
1. Forget about the rules and Java for a moment.
What is the object of the game?
Your answer shouldn't take more than about five words.
(Hint: what if I told you that the game was called 'Escape'?)
2. The instructions refer to a "move". Describe to me,
in English, exactly what a
single move is.
HIH
Winston