-
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.
-
Java is probably the wrong language to do this in.
-
unfortunately, it has to be java
-
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.
-
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.
-
What is your design for painting shapes on a board? You'll have to define what a "shapes number" is.
-
What is the name of the course you're taking? How much programming have you done? Why did you choose Java?
Similar Threads
-
By Marcos in forum VB Classic
Replies: 3
Last Post: 01-25-2006, 11:18 AM
-
By Michael Shutt in forum VB Classic
Replies: 6
Last Post: 04-05-2001, 02:25 AM
-
By Patrick Comeau in forum VB Classic
Replies: 6
Last Post: 03-22-2001, 10:50 PM
-
By Julian Milano in forum VB Classic
Replies: 2
Last Post: 08-11-2000, 12:11 PM
-
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
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