-
How to Draw a Trail/ Resize Applet
I have a chess board and a counter, the counter can be placed on any white square on a the chessboard and must visit every other
white square with the least number of turnings, and without ever entering a black square. You
can visit a white square twice provided that the second time you enter you leave through the corners
that were not passed the first time.
I'd like to be able to draw a line that shows the route the counter has taken, and also block any attempts to move onto a black square.
I don't know where to start, but think i'd be able to do this if I new what i was looking for.
Would also like to set the size of the applet when it loads, just now only part of the board is shown, and i have to drag the window to the required size.
-
I think each of the board squares will have to be an object, with a variable (possibly boolean) that represents each of the corners and one that represents the colour. When the counter is placed on a square it will know (or be told) which corner the counter passed through, and the variable representing that colour will be changed to indicate that the corner has been passed through. If the counter goes back to that square, and tries to leave through that corner, it isn't allowed to.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks