User:Monsoonjr99/2019 Atl Script Timelines

The sad script: // 2019 Atl Season Generator Script -- Monsoonjr99 2019-04-16

class SadStorm{ constructor(sm,sd,num,b){ this.age = 0; this.strength = 35; this.cat = -1; this.subtropical = b;       this.luck = Math.random*14-7; this.num = num; this.name = undefined; this.smonth = sm; this.sday = sd; this.emonth = undefined; this.eday = undefined; }   advance(m,d){ let seas = [1,-2,-2,1,3,5,6,13,16,12,7,4]; this.strength += seas[m] + this.luck + Math.random*50 - 25 - Math.pow(1.45,this.age); this.luck -= Math.random*3; this.strength = Math.round(this.strength); if(this.strength>38 && this.cat<0) this.cat = 0; if(this.strength>73 && this.cat<1) this.cat = 1; if(this.strength>95 && this.cat<2) this.cat = 2; if(this.strength>110 && this.cat<3) this.cat = 3; if(this.strength>129 && this.cat<4) this.cat = 4; if(this.strength>156 && this.cat<5) this.cat = 5; this.age++; if(this.strength<30){ this.emonth = m;           this.eday = d;            return; }       if(this.subtropical && (Math.random<0.3 || this.cat>0)) this.subtropical = false; } }

function makeSadTimeline{ let storms = []; let active = []; let spawn = [0.0008,0.0005,0.0005,0.001,0.005,0.02,0.035,0.07,0.09,0.06,0.02,0.005]; let sub = [0.95,0.99,0.99,0.95,0.8,0.5,0.3,0.2,0.15,0.3,0.6,0.9]; let names = ['Andrea','Barry','Chantal','Dorian','Erin','Fernand','Gabrielle','Humberto','Imelda','Jerry','Karen','Lorenzo','Melissa','Nestor','Olga','Pablo','Rebekah','Sebastien','Tanya','Van','Wendy','Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta','Theta','Iota','Kappa','Lambda','Mu','Nu','Xi','Omicron','Pi','Rho','Sigma','Tau','Upsilon','Phi','Chi','Psi','Omega']; let nums = ['Zero','One','Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten','Eleven','Twelve','Thirteen','Fourteen','Fifteen','Sixteen','Seventeen','Eighteen','Nineteen','Twenty','Twenty-One','Twenty-Two','Twenty-Three','Twenty-Four','Twenty-Five','Twenty-Six','Twenty-Seven','Twenty-Eight','Twenty-Nine','Thirty','Thirty-One','Thirty-Two','Thirty-Three','Thirty-Four','Thirty-Five','Thirty-Six','Thirty-Seven','Thirty-Eight','Thirty-Nine','Forty','Forty-One','Forty-Two','Forty-Three','Forty-Four','Forty-Five','Forty-Six','Forty-Seven','Forty-Eight','Forty-Nine','Fifty']; let dcount = 0; let ncount = 0; let rollover = false; let month = 0; let day = 1; let monthdays = [31,28,31,30,31,30,31,31,30,31,30,31]; let loopcounter = 0; while(loopcounter<1000){ for(let s of active){ s.advance(month,day); if(s.strength>38 && !s.name) s.name = names[ncount++]; }       for(let i=active.length-1;i>=0;i--){ if(active[i].eday) active.splice(i,1); }       if(Math.randommonthdays[month]){ day = 1; month++; if(month>11){ if(active.length>0){ month = 0; rollover = true; }else break; }       }        if(rollover && active.length<1) break; loopcounter++; }   if(loopcounter>=1000){ console.log("error: looped too much"); return {a: active, s: storms, m: month, d: day}; }   let str = ""; for(let s of storms){ let n = s.name ? s.name : nums[s.num]; let subtr = s.subtropical ? "S" : "T"; let strng = s.cat<0 ? subtr + "D" : s.cat<1 ? subtr + "S" : "C" + s.cat; s.smonth++; s.emonth++; let sdate = "2019-" + (s.smonth<10 ? "0" + s.smonth : s.smonth) + "-" + (s.sday<10 ? "0" + s.sday : s.sday); let edate = (s.emonth<s.smonth ? "2020" : "2019") + "-" + (s.emonth<10 ? "0" + s.emonth : s.emonth) + "-" + (s.eday<10 ? "0" + s.eday : s.eday); str += n + " " + sdate + " " + edate + " " + strng + "\n"; }   if(str.charAt(str.length-1)==="\n") str = str.slice(0,str.length-1); return str; }

To use:
 * Paste above code in Chrome JS console (probably also works with Firefox) and hit enter
 * Use  to run the script
 * The output is compatible with the  template on this wiki, so you may paste the output (w/o quotes) in the template argument to create a timeline