DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    6

    Post 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.

  2. #2
    Join Date
    Feb 2004
    Posts
    541
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links