Creating a Fitness Function, need help ASAP!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Creating a Fitness Function, need help ASAP!

  1. #1
    Join Date
    Oct 2005
    Posts
    10

    Unhappy Creating a Fitness Function, need help ASAP!

    Suppose you have an altered chess board:

    0 0 0 0 1 1 1 1
    0 0 0 0 0 1 1 1
    0 0 0 0 0 0 1 1
    0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0

    where the 1's are spaces where nothing can be placed.

    Now suppose you have four tetris shapes, where each shape contains only four 'units'

    I need to create a fitness function where all four of the shapes are continuously and randomly added onto the board until no additional shapes can fit. The fitness function should return the # of spaces filled divided by the total number of spaces.

    (Without using a GUI).

    I was told to do this in such a way where each shape has the function:

    f (shape, x coord., y coord., orientation) x 10 (So each shape has 4 ints)

    Then, I was told to, using a 1-Dimensional Array of size 40 ints, add the shapes into the array for ten different iterations. For each iteration, the x and y coordinates as well as the orientation of each shape should be random.

    After each iteration, the number of spaces filled should be printed.

    I have the idea down, but have NO idea how to code this. Remember, it should return the # of spaces filled over the total number of spaces. Please help me! I have no idea how to represent the shapes, their coordinates, and their orientations. Thanks!
    Last edited by behrk2; 10-25-2005 at 10:05 PM.

  2. #2
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    Java is probably the wrong language to do this in.

  3. #3
    Join Date
    Oct 2005
    Posts
    10
    unfortunately, it has to be java

  4. #4
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    Looks too hard for me. Isn't there some professor that has written a paper on how to do it that you could use to get the algorithm from?
    Given the algorithm, you could start writing the program and come back here with specific programming questions when you have problems.

  5. #5
    Join Date
    Oct 2005
    Posts
    10
    I'm afraid not, this is my own original idea (well, it's original as far as I know)...My professor approved it, however. My biggest problem is representing the shapes numbers and adding them to lets say a board represented by a 2D Array.

  6. #6
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    What is your design for painting shapes on a board? You'll have to define what a "shapes number" is.

  7. #7
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    What is the name of the course you're taking? How much programming have you done? Why did you choose Java?

Similar Threads

  1. Packed Data(Comp-3, etc)
    By Marcos in forum VB Classic
    Replies: 3
    Last Post: 01-25-2006, 11:18 AM
  2. calling ping thru vb
    By Michael Shutt in forum VB Classic
    Replies: 6
    Last Post: 04-05-2001, 02:25 AM
  3. verify local admin
    By Patrick Comeau in forum VB Classic
    Replies: 6
    Last Post: 03-22-2001, 10:50 PM
  4. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 2
    Last Post: 08-11-2000, 12:11 PM
  5. Trying to print a PDF File from VB
    By Kunal Sharma in forum VB Classic
    Replies: 2
    Last Post: 04-25-2000, 03:45 PM

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center