December 15th, 2012, 12:20 PM
I need to check algorithm in java for the following:
I have already got the file which is in .jar. the only code to be written in main class. use separate main classes for each of the following questions given below.
1) Create an 6 by 6 instance of the puzzle and generate a random solution to it before displaying the result on the screen.
2) Write some code which checks to see if the solution is valid (i.e. will check that all edges are matched)
3) Write a program which will start with an empty grid and add pieces to it, one by one, until the grid is completely filled. The program should start at the top left hand corner and proceed downwards, row by row. The pieces may be selected randomly, or just added in the order they’re contained in the EdgeMatch object.
4) Write a second program which acts in the same way as the first, but at each stage, add the unused tile which matches the largest number of sides. What sort of algorithm is this?
5) Write a program which will build a random solution to an edge matching instance and then swaps two pieces. The pieces should be selected by the user. Once the pieces are swapped the program should redisplay the grid (you should use the repaint() method from JFrame for this).
6) Write a second program which will operate in the same way as the first, but this time tell you if the second solution (with the swapped pieces) is closer to a complete match than the first.
7) Write some code which will attempt to swap all possible pairs of tiles on a grid and keep a record of which swaps resulted in an improvement to the number of sides matched. You should use your code from week 8 as a basis for this.
8) Turn this into a local search algorithm by keeping the swapped solutions whenever an improvement is found. The algorithm should stop when it runs out of improvements.
December 15th, 2012, 02:34 PM
So another way to say this is - "I don't want to do my homework - here - you do it for free for me so I can go party".
Originally Posted by usman2
If you actually try then we might actually help. If you think that "try" is posting your homework verbatim then you're very wrong.
Comments on this post