⚂
⚁
⚃
⚀
⚅
synthesis oracle = oracle synthesis
the rules:
- run this patch and try writing a synth patch with the ugens, operators and numbers.
- you may use other numbers, other ugens and other operators, but they are bad for your score
- beauty is bonus
warning.
if you use the below code you are obliged to publish your solution under the condition of beauty and highscore:commit here: Oracle TOPSCORE
( o = { |nUgens=2, nUn=2, nBin=2, nInt=2, nFloat=2| var ugens, unaries, binaries, oracle; ugens = UGen.allSubclasses.reject({ |cl| // filter unusable UGen classes (cl.superclasses ++ cl).includesAny( [ BufInfoUGenBase, InfoUGenBase ] ); }); unaries = AbstractFunction.methods.select { |l| l.findReferences(\composeUnaryOp).notNil }.collect(_.name); binaries = AbstractFunction.methods.select { |l| l.findReferences(\composeBinaryOp).notNil }.collect(_.name); oracle = ({ ugens.choose } ! nUgens) ++ ({ unaries.choose } ! nUn) ++ ({ binaries.choose } ! nBin) ++ ({ 512.rand2 } ! nInt) ++ ({ [1.0, pi, 20000.0].choose.rand2.round(0.001) } ! nFloat); // oracle.asString.drop(1).drop(-1).reject(_ == $,).postcs }; o.value; )
code tester:
evaluate this code, then evaluate your patch.
the first line in your patch should be the oracle list.
( codeDump = Routine { var str, passed=true, rawScore, score, firstLine, linebr, n=0; var oracle; str = 1.yield; linebr = str.find("\n"); while { linebr < 10 } { str = str[linebr+1..]; linebr = str.find("\n"); }; firstLine = str[0..linebr]; str = str[linebr+1..]; rawScore = []; oracle = firstLine.reject("\n\t /".includes(_)).split($,).postcs.do { arg xstr, i; var n; n = str.findAll(xstr); passed = passed and: { n.notNil }; if(n.isNil) { (xstr + "is missing!!").postln }; rawScore = rawScore ++ n; }; str.do { arg char; if(char.isAlphaNum) { n = n + 1 } }; score = log(exp(rawScore.size) / n.log); if(passed.not) { score = 0 }; ("your code has" ++ if(passed) { " " } { " not " } ++ "passed the test").postln; ("SCORE:" + (score * 10000).trunc).postln; codeDump = nil; } )
dice