943,909 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 3038
  • Java RSS
Oct 12th, 2008
0

Knight's Tour Using a Stack

Expand Post »
I'm trying to write a program in java...it's actually the famous game of "Knight's Tour" - I guess you're all familiar with it- just for a brief explanation
what I have to do is to get from the user the row and the coloumn of the square on the board where the knight wants to start moving, and from that position USING A STACK to store the square details, move around the board until the knight goes through ALL the squares of the board only once. When the knight moves into one square it cannot go to that square again, so using a stack the knight comes across a time when it reaches a dead end and that's when it comes back to the previous house

I really need some help on how to begin with this!
The whole 'stack' thing really bugs me now......i'm confused
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
scream2ice is offline Offline
33 posts
since Mar 2008
Oct 12th, 2008
0

Re: Knight's Tour Using a Stack

So a Stack is just a data structure that follows the Last In First Out rule (LIFO). This means that the last item placed on the stack (with an add or push method of some description) will be the next to be removed (by a call to a remove or pop method).

The Java API provides a basic Stack class that you can use (in the java.util package).
Reputation Points: 395
Solved Threads: 192
Veteran Poster
darkagn is offline Offline
1,136 posts
since Aug 2007
Oct 13th, 2008
0

Re: Knight's Tour Using a Stack

Also if you had searched the forum, you would have come up with this post about Stack. Others had the same question as you, so you could have searched to see your question answered

http://www.daniweb.com/forums/thread146631.html
Sponsor
Featured Poster
Reputation Points: 1014
Solved Threads: 446
Nearly a Senior Poster
javaAddict is offline Offline
3,259 posts
since Dec 2007
Oct 13th, 2008
0

Re: Knight's Tour Using a Stack

thanks alot
i'm coming up with some ideas
Reputation Points: 10
Solved Threads: 0
Light Poster
scream2ice is offline Offline
33 posts
since Mar 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Final Year Project Proposal
Next Thread in Java Forum Timeline: java interest program help?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC