Results 1 to 10 of 10
Thread: I need a back and forward code
- 10-12-2008, 09:25 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
I need a back and forward code
I have a functional TicTacToe 5x5 game with added back and forward buttons on the game board. I only need to implement the two functions for these two buttons, using Linked Lists, but I have no idea how to do it. How/what to store in Linked Lists, and then how to access the stored moves? Can anyone of you please share an idea (maybe a Java code snippet)?
- 10-12-2008, 09:30 PM #2
What do you mean by "back" and "forward"? What data would be needed to implement that? Can that data be put in a new class?
Can you construct a board position from the data in the class?
Then save an object of that class in a LinkedList.
Start with a simple test program to exercise the LinkedList. When you see how to use its methods, then you can use that knowledge to write what you need in your progrm.
- 10-12-2008, 10:37 PM #3
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
Norm, the two buttons should go back to a previous stored move, and respectively forward to a "future" move, in case I went back. I understand how to use linked lists because i studied it, but i have no idea what to store in the linked list's nodes.
should it be (player, player's move, opponent's move) or what? and how to store that? how to call the previous move then? also after i went back a move or more moves, and if a click on the board for a new move, that should destroy all "future" moves and store new ones.
- 10-12-2008, 11:37 PM #4what to store in the linked list's nodes
- 10-12-2008, 11:43 PM #5
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
this sounds like a general OOP advice. my problem is that i don't understand what exactly needs to be stored for a move. should be something like a node of (player, player's move, opponent's move)?
- 10-12-2008, 11:51 PM #6
I suggest that you store the board info after a move.
What does it take to display the board? Store all that.
Write a method that will take that info and display a position.
If you only want to store moves, then what is a move in your game? The placing of a marker by one of the players. So a move would be the player and the postion he placed his marker.
-
Please do not cross-post questions in multiple forums. This will frustrate anyone who tries to help you only to find out later that the same answer was given hours ago in a cross-posted thread.
Sun Java Forum Thread
- 10-13-2008, 12:26 AM #8
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
i don't think so, but good for your observation point ;)
by the way, is there a problem in cross posting back to your reply?Last edited by Jaymz; 10-13-2008 at 12:29 AM.
- 10-13-2008, 12:47 AM #9
Member
- Join Date
- Oct 2008
- Posts
- 1
- Rep Power
- 0
hahahahaha are you serious?
Jaymz see you in cs201 tmrw ;)
- 10-13-2008, 12:50 AM #10
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
Back button
By Tokajac in forum Web FrameworksReplies: 1Last Post: 11-27-2008, 06:27 AM -
Back-Forward Simulation using stacks(java)
By MarKus in forum New To JavaReplies: 3Last Post: 09-10-2008, 02:47 PM -
<jsp:include> Vs <%@include> Vs <jsp:forward> Vs RequestDispatcher .forward/includeVs
By freddieMaize in forum Java ServletReplies: 5Last Post: 07-29-2008, 03:13 PM -
Tim's back!
By tim in forum IntroductionsReplies: 3Last Post: 06-29-2008, 06:50 AM -
jsp:forward action
By Java Tip in forum Java TipReplies: 0Last Post: 12-24-2007, 11:04 AM
Bookmarks