# requirez(array.awk) # requirez(blab.awk) # requirez(str.awk) # requirez(size.awk) function demo(n) { if (n==11) return demo11(); if (n==10) return demo10(); if (n==9) return demo9(); if (n==7) return demo7(); if (n==6) return demo6(); if (n==5) return demo5(); if (n==4) return demo4(); if (n==3) return demo3(); if (n==2) return demo2(); if (n==1) return demo1(); demo999(); } function demo999() { simulate() } function demo11() { print 1 } function demo10() { simulateFromFile("cdf.10"); } function demo9( names,cdf) { cdf2File("cdf.b4",Names,Cdf) file2Cdf("cdf.b4",names,cdf); cdf2File("cdf.after",names,cdf); } function demo7() { simulate() } function demo6( want,i) { sample1(Names[0],Cdf,Cache); for(i in Cache) print sprintf("%15s",Names[i]) " = " Cache[i] print "CONSEQUENCE = " round(CO1()); print "ERROR POTENTIAL = " round(EP1()); select(Wbs,WbsRows,Names[0],Cdf,Cache,want) for(i in want) print Wbs["wbs",i,"factor"] } function demo5() { sample1(Names[0],Cdf,Cache); dump(); } function demo4( count,i,all,start,n,sym) { com="sort -t: +0 +1 | malign -b :" sym= Verbose ? Verbose : "X"; start=all=N; while(--all > 0) { one(Names[0],Cdf,Cache); count[round(CO1()) " : " round(EP1())]++ } print "#consequence : error potental : percent : bars" | com for(i in count) { n=int(100*count[i]/start); print i " : " n "% : " str(n/2,sym) str((101-n)/2,".")|com } close(com); } function demo3() { one(Names[0],Cdf,Cache); print CO1(), EP1() } function one(all,cdf,cache) { array(cache); sample1(all,cdf,cache); } function demo2( ) { while(--N > 0) print sample2(1,Cdf) } function demo1( cache) { sample1(Names[0],Cdf,cache); saya("cache", cache) }