Advertisement
Baecoin

Untitled

May 20th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1.  
  2.  
  3. Array.prototype.median = function (arr) {
  4. arr.sort((a, b) => a - b);
  5. var pivot = Math.floor(arr.length / 2);
  6. return arr.length % 2 ? arr[ pivot ] : (arr[ pivot - 1 ] + arr[ pivot ]) / 2;
  7. }
  8. class Median{
  9. constructor() {
  10. this.history = []
  11. }
  12. show(multiplier){
  13. this.history.push(multiplier)
  14.  
  15. this.log(this.history.median(this.history))
  16. console.log(this.history.median(this.history))
  17. }
  18. }
  19.  
  20.  
  21.  
  22. var median = new Median()
  23.  
  24. while(true){
  25. const {multiplier} = await this.bet(100, 1.01)
  26. median.show(multiplier)
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement