Advertisement
Guest User

Untitled

a guest
Oct 10th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.78 KB | None | 0 0
  1. class XX {
  2.     // @:isVar public var factorMap(default, null):Map<String, Range>;
  3.     @:isVar public var factorValueMap(default, null):Map<String, Int>;
  4.     @:isVar public var reducers(default, null):Map<String, Float>;
  5.  
  6.     public function addFactor(indent:String, range:Range, getReducer:Range->Int->Float) {
  7.         // this.factorMap[indent] = range;
  8.         this.factorValueMap[indent] = Random.getIn(range.from, range.to);
  9.         this.reducers[indent] = getReducer(range, this.factorValueMap[indent]);
  10.     }
  11.  
  12.     public function pipe(outIndent:String, factorIdent:String, range:Range, weight:Int, ?getReducer:Range->Int->Float) {
  13.         this.factorValueMap[outIndent] = Math.round((this.reducers[factorIdent] * weight) * range.to);
  14.         this.reducers[outIndent] = getReducer(range, this.factorValueMap[outIndent]);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement