This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double[] runGenerations(int generations, int tournamentSize) { | |
int generation = 1; | |
while(generation <= generations) { | |
computeFitness(); | |
double[][] parents = selectParentsByTournament(tournamentSize); | |
double[][] children = breedChildrenFromParents(parents); | |
for(double[] child : children) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.eccasts.watchmakerexample; | |
import java.util.*; | |
import org.uncommons.maths.random.*; | |
import org.uncommons.watchmaker.framework.*; | |
import org.uncommons.watchmaker.framework.factories.AbstractCandidateFactory; | |
import org.uncommons.watchmaker.framework.operators.DoubleArrayCrossover; | |
import org.uncommons.watchmaker.framework.operators.EvolutionPipeline; | |
import org.uncommons.watchmaker.framework.selection.RouletteWheelSelection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.eccasts.watchmakerexample; | |
import java.util.*; | |
import org.uncommons.maths.random.*; | |
import org.uncommons.watchmaker.framework.*; | |
import org.uncommons.watchmaker.framework.factories.AbstractCandidateFactory; | |
import org.uncommons.watchmaker.framework.operators.DoubleArrayCrossover; | |
import org.uncommons.watchmaker.framework.operators.EvolutionPipeline; | |
import org.uncommons.watchmaker.framework.selection.RouletteWheelSelection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
rightTriangles = [(a,b,c) | c <- [1 .. ], b <- [1..c], a <- [1..b], a^2 + b^2 == c^2] | |
{-- | |
*Main> take 10 rightTriangles | |
[(3,4,5),(6,8,10),(5,12,13),(9,12,15),(8,15,17),(12,16,20),(15,20,25),(7,24,25),(10,24,26),(20,21,29)] | |
--} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Day = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | |
deriving (Show, Enum) | |
{-- | |
*Main> let day = Friday -- It's Friday, Friday / Gotta get down on Friday | |
*Main> pred day -- Yesterday was Thursday | |
Thursday | |
*Main> succ day -- Tomorrow is Saturday | |
Saturday |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define NSDICT(...) [NSDictionary dictionaryWithObjectsAndKeys: __VA_ARGS__, nil] | |
#define NSARRAY(...) [NSArray arrayWithObjects: __VA_ARGS__, nil] | |
#define NSBOOL(_X_) ((_X_) ? (id)kCFBooleanTrue : (id)kCFBooleanFalse) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("Simple test of jasmine and jasmine-jquery", function() { | |
it("should be able to run tests on HTML to demonstrate jasmine-jquery", function() { | |
expect($('<div>some text</div>')).toHaveText('some text') | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ign | |
import scala.collection.mutable.ArrayBuffer | |
object Main extends App { | |
var wordList = ArrayBuffer[String]() | |
val size = 10000 | |
for(i <- 1 to size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ign | |
import scala.collection.mutable.ArrayBuffer | |
object Main extends App { | |
var wordList = ArrayBuffer[String]() | |
val size = 10000 | |
for(i <- 1 to size) | |
wordList += ("foo" + i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dircache | |
import os | |
import os.path | |
import fnmatch | |
# change these as needed | |
js_dirs = ["js/", "js/lib/"] | |
output_file = "output.js" | |
jar_path = "lib/java/" |
OlderNewer