/* ITI 1121/1521 - Assignment 1 * Marcel Turcotte (turcotte@site.uottawa.ca) */ /** * The class Folding implements the top level of the * algorithm. It has a main method that reads a chain from the command * line. Here is a sample run. *
 * > java Folding hphpphhp
 *
 * Best solution:
 *  Chromosome [fitness=-2, genes=[Right, Up, Up, Left, Down, Left, Up], chain=hphpphhp]
 * 
* Because of the ``probabilistic'' nature of the algorithm, each run is likely * to produce a new solution. */ public class Folding { /** * The chain that will be used if no argument was supplied on the command line. */ public static final String DEFAULT_CHAIN = "hphpphhphpphphhpphph"; /** * Implements the top loop of the genetic algorithm. You must * complete the implementation of the method. * * @param chain The chain for which a fold is sought * @return the best solution for this run */ public static Chromosome solve(String chain) { // REPLACE THE BODY OF THIS METHOD WITH YOUR OWN IMPLEMENTATION. return null; } /** * The main method of this program. Examples of the execution of the program from the command line: *
     * > java Folding ppphhpphhppppphhhhhhhpphhpppphhpphpp
     * > java Folding hphpphhphpphphhpphph
     * > java Folding hphpphhp
     * 
* * @param args the array of arguments that were passed to the main method, generally on the command line */ public static void main(String[] args) { String chain = DEFAULT_CHAIN; Chromosome sol; if (args.length == 1) { chain = args[0]; } StudentInfo.display(); sol = solve(chain); System.out.println(sol); } }