/*---------------------------- data and basic functions for NCAA pool -----------------------------*/ var mask = false // don't show any picks if this is true (unless overridden) var tournament_over = true var toast_time = false var untoasted = [ 'Nathan','Christopher'] var debug = false var TrumpName = '' var fake = ['NY Times','Dickie V'] var winner_icon = "blinking_goleo.gif" // or crown.gif var update_info = "Gators!!" //-- col 0 of results contains teams //-- col 1 contains number of games won, //-- col 2 contains round eliminated (99 means still alive)var results = [ var results = [ [ "Auburn" , 4, 5], [ "Alab St/St Francis" , 0, 1], [ "Louisville" , 0, 1], [ "Creighton" , 1, 2], [ "Michigan" , 2, 3], [ "UC San Diego" , 0, 1], [ "Texas AM" , 1, 2], [ "Yale" , 0, 1], [ "Ole Miss" , 2, 3], [ "San Diego St/UNC" , 0, 1], [ "Iowa St" , 1, 2], [ "Lipscomb" , 0, 1], [ "Marquette" , 0, 1], [ "New Mexico" , 1, 2], [ "Mich St" , 3, 4], [ "Bryant" , 0, 1], [ "Florida" , 6, 99], [ "Norfolk St" , 0, 1], [ "U Conn" , 1, 2], [ "Oklahoma" , 0, 1], [ "Memphis" , 0, 1], [ "Colorado St" , 1, 2], [ "Maryland" , 2, 3], [ "Grand Canyon" , 0, 1], [ "Missouri" , 0, 1], [ "Drake" , 1, 2], [ "Texas Tech" , 3, 4], [ "UNC Wilm" , 0, 1], [ "Kansas" , 0, 1], [ "Arkansas" , 2, 3], [ "St. Johns" , 1, 2], [ "Omaha" , 0, 1], [ "Duke" , 4, 5], [ "American/Mt St. Marys" , 0, 1], [ "Miss St" , 0, 1], [ "Baylor" , 1, 2], [ "Oregon" , 1, 2], [ "Liberty" , 0, 1], [ "Arizona" , 2, 3], [ "Akron" , 0, 1], [ "BYU" , 2, 3], [ "VCU" , 0, 1], [ "Wisconsin" , 1, 2], [ "Montana" , 0, 1], [ "St. Marys" , 1, 2], [ "Vanderbilt" , 0, 1], [ "Alabama" , 3, 4], [ "Robert Morris" , 0, 1], [ "Houston" , 5, 6], [ "SIU Edw" , 0, 1], [ "Gonzaga" , 1, 2], [ "Georgia" , 0, 1], [ "Clemson" , 0, 1], [ "McNeese" , 1, 2], [ "Purdue" , 2, 3], [ "High Point" , 0, 1], [ "Illinois" , 1, 2], [ "Texas/Xavier" , 0, 1], [ "Kentucky" , 2, 3], [ "Troy" , 0, 1], [ "UCLA" , 1, 2], [ "Utah St" , 0, 1], [ "Tennessee" , 3, 4], [ "Wofford" , 0, 1] ] // end results; var nn = 0; var jj for (jj=0; jj < results.length; jj++) nn += results[jj][1] update_info = nn + "/63 games... " + update_info function entry(name,image,quip,picks) { this.name = name this.image = image this.quip = quip this.picks = picks } // team names IN ORDER (using the same order everywhere is CRITICAL) // just pick the names out of the results data var j, teamname = [] for (j=0; j < results.length; j++) teamname[j] = results[j][0] //-- picks contains number of predicted wins by teams 0...63 var players = [ new entry('Rosemary','little-dragon.png','Baby Dragon\'s first bracket! (4 months old)', [4,0,1,0,2,0,0,1,1,0,2,0,1,0,3,0,6,0,1,0,0,1,2,0,0,1,2,0,0,1,3,0, 5,0,0,1,2,0,0,1,1,0,3,0,0,1,2,0,1,0,2,0,1,0,4,0,2,0,1,0,1,0,3,0] ) ,new entry('Neal','johnny-utah.png','Utah! Get me two!', [1,0,0,2,0,1,4,0,2,0,1,0,0,1,3,0,2,0,1,0,0,1,3,0,0,1,2,0,0,1,6,0, 5,0,0,1,1,0,2,0,1,0,2,0,3,0,1,0,3,0,1,0,1,0,2,0,0,1,4,0,2,0,1,0] ) ,new entry('Theo','tiger-pilot.png',' Are you smarter than a three year old (who picked this bracket)?', [0,1,3,0,0,1,0,2,2,0,0,1,0,1,4,0,2,0,1,0,1,0,5,0,0,2,1,0,3,0,1,0, 2,0,1,0,3,0,1,0,1,0,2,0,0,1,4,0,2,0,1,0,3,0,1,0,2,0,0,1,0,1,6,0] ) ,new entry('Sophie','rosie.png','The newest star of our team is great at dribbling and has yet to turnover', [3,0,0,1,2,0,1,0,0,1,2,0,4,0,1,0,3,0,1,0,0,2,1,0,0,1,2,0,0,1,5,0, 4,0,1,0,2,0,0,1,2,0,1,0,0,1,3,0,6,0,1,0,2,0,1,0,1,0,2,0,1,0,3,0] ) ,new entry('Nathan','basketball-xray.png','March isn\'t mad - just disappointed.', [3,0,1,0,1,0,2,0,2,0,1,0,1,0,4,0,6,0,1,0,0,1,2,0,1,0,3,0,1,0,2,0, 3,0,0,1,1,0,2,0,0,1,2,0,1,0,4,0,5,0,1,0,2,0,1,0,0,1,2,0,1,0,3,0] ) ,new entry('Christine G','eagle-ray.png','', [6,0,0,1,2,0,0,1,2,0,1,0,1,0,3,0,4,0,0,1,0,1,2,0,1,0,2,0,1,0,3,0, 5,0,0,1,2,0,1,0,1,0,3,0,0,1,2,0,4,0,0,1,1,0,2,0,1,0,3,0,0,1,2,0] ) ,new entry('Howard G','white-bread.png','Bread--thinking ahead', [6,0,0,1,0,2,0,1,2,0,0,1,1,0,3,0,1,0,4,0,0,2,0,1,1,0,3,0,2,0,1,0, 1,0,0,3,0,2,0,1,1,0,4,0,2,0,1,0,5,0,1,0,0,1,0,2,2,0,1,0,3,0,1,0] ) ,new entry('Alexa','bullwinkle.jpg','', [4,0,1,0,0,1,2,0,1,0,2,0,1,0,3,0,6,0,1,0,2,0,1,0,3,0,1,0,1,0,2,0, 3,0,1,0,1,0,2,0,0,1,2,0,1,0,4,0,3,0,1,0,1,0,2,0,1,0,2,0,0,1,5,0] ) ,new entry('Bob','psj.png','Benny and the Jammas', [1,0,3,0,2,0,0,1,0,2,1,0,1,0,5,0,4,0,0,1,2,0,0,1,0,1,2,0,0,1,3,0, 2,0,0,1,3,0,1,0,0,2,1,0,0,1,4,0,6,0,1,0,0,1,2,0,3,0,1,0,0,1,2,0] ) ,new entry('Laura','radish-seeds.png','Nothing seedy here.', [4,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0,5,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0, 6,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0,4,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0] ) ,new entry('Evan','blue-footed-booby.png','', [2,0,1,0,4,0,1,0,0,2,0,1,1,0,3,0,6,0,1,0,0,2,1,0,0,1,3,0,1,0,2,0, 5,0,1,0,1,0,2,0,1,0,2,0,0,1,3,0,4,0,1,0,1,0,2,0,2,0,1,0,1,0,3,0] ) ,new entry('Monica','CAN2.png','Elbows up!!!', [3,0,0,1,1,0,2,0,0,1,2,0,1,0,5,0,4,0,1,0,0,1,2,0,0,1,2,0,1,0,3,0, 2,0,1,0,1,0,6,0,1,0,3,0,0,2,1,0,2,0,0,1,4,0,1,0,2,0,1,0,0,1,3,0] ) ,new entry('Lizzy','bw-smiley.png','open for bootlegging (tarriff free!)', [3,0,0,1,2,0,1,0,1,0,4,0,0,1,2,0,3,0,0,1,1,0,2,0,1,0,2,0,0,1,6,0, 4,0,0,1,0,1,2,0,1,0,3,0,1,0,2,0,5,0,1,0,2,0,0,1,0,1,3,0,1,0,2,0] ) ,new entry('Christopher','nemo12.jpg','Champion w/ the Lowest Score', [2,0,1,0,0,3,1,0,0,1,2,0,1,0,4,0,5,0,1,0,0,2,1,0,0,2,1,0,1,0,3,0, 4,0,0,1,1,0,2,0,2,0,1,0,1,0,3,0,6,0,0,1,2,0,1,0,1,0,2,0,1,0,3,0] ) ,new entry('Carl','gpa-shark.png','🎵 doo DOO DOO doo DOO doo DOO doo DOO', [3,0,1,0,1,0,2,0,1,0,4,0,0,1,2,0,6,0,0,1,0,1,2,0,1,0,3,0,0,1,2,0, 5,0,0,1,2,0,1,0,1,0,2,0,0,1,3,0,1,0,2,0,0,1,4,0,0,1,2,0,0,1,3,0] ) ,new entry('Moritz','martian.gif','', [2,0,0,1,1,0,4,0,1,0,3,0,1,0,2,0,5,0,1,0,0,1,0,2,1,0,3,0,1,0,2,0, 2,0,1,0,4,0,1,0,1,0,2,0,0,1,3,0,2,0,0,1,3,0,0,1,1,0,6,0,1,0,2,0] ) ,new entry('Sandra ','HSV_logo.png','', [3,0,0,1,1,0,2,0,1,0,2,0,1,0,5,0,4,0,1,0,2,0,1,0,2,0,1,0,3,0,1,0, 6,0,0,1,2,0,1,0,1,0,2,0,1,0,3,0,2,0,1,0,4,0,1,0,1,0,3,0,2,0,1,0] ) ,new entry('Linda','fragile-bracket.png','', [2,0,0,1,6,0,1,0,0,1,2,0,1,0,3,0,2,0,0,1,0,1,3,0,2,0,1,0,0,1,4,0, 2,0,0,1,5,0,1,0,0,1,3,0,0,1,2,0,4,0,0,1,1,0,2,0,2,0,1,0,3,0,1,0] ) ,new entry('Dave','underdog.jpg','Please no tariffs on Gator big man ', [3,0,0,1,0,2,1,0,0,1,2,0,1,0,4,0,6,0,1,0,1,0,2,0,0,2,1,0,1,0,3,0, 3,0,0,1,0,1,2,0,0,1,2,0,0,1,5,0,4,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0] ) ,new entry('Rick','otter-bb.png','Traveling! Who? Me?', [2,0,0,1,4,0,0,1,0,3,1,0,0,1,2,0,6,0,0,1,2,0,0,1,0,1,2,0,0,1,3,0, 4,0,0,1,2,0,1,0,0,1,2,0,1,0,3,0,3,0,0,1,1,0,2,0,0,1,2,0,1,0,5,0] ) ,new entry('Kristen','upside-down-flag-bb.png','', [3,0,0,1,0,1,2,0,1,0,4,0,0,1,2,0,5,0,0,1,2,0,1,0,1,0,2,0,0,1,3,0, 2,0,1,0,3,0,1,0,0,1,6,0,1,0,2,0,3,0,1,0,2,0,1,0,0,1,4,0,2,0,1,0] ) ,new entry('Frank','casper.gif','poutine good...putin, not so much', [2,0,0,1,6,0,1,0,1,0,2,0,1,0,3,0,4,0,0,1,0,1,2,0,2,0,1,0,1,0,3,0, 4,0,1,0,2,0,1,0,1,0,3,0,1,0,2,0,5,0,1,0,2,0,1,0,1,0,2,0,1,0,3,0] ) ,new entry('Kei','Perry_the_platypus.png','', [6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,0,3,1,0,2,0,1,0,4,0,1,0,2,0,1,0, 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0] ) ,new entry('Steve','moose-7.png','moose wear bigger boots', [6,0,0,1,2,0,0,1,0,1,3,0,1,0,2,0,1,0,2,0,1,0,3,0,1,0,4,0,2,0,1,0, 5,0,0,1,1,0,2,0,0,1,3,0,1,0,2,0,4,0,1,0,2,0,0,1,1,0,3,0,1,0,2,0] ) ,new entry('Barb','peppermint-patty.png','', [6,0,0,1,2,0,1,0,1,0,2,0,3,0,1,0,4,0,0,1,0,1,2,0,0,1,3,0,2,0,1,0, 1,0,0,2,5,0,1,0,0,1,2,0,0,1,3,0,4,0,1,0,1,0,2,0,0,1,3,0,0,1,2,0] ) ,new entry('Casey','wendy-southpark.png','', [3,0,0,1,0,2,1,0,2,0,0,1,1,0,6,0,4,0,1,0,0,1,2,0,3,0,0,1,0,1,2,0, 2,0,0,1,3,0,1,0,0,1,5,0,0,1,0,2,3,0,1,0,1,0,2,0,1,0,4,0,1,0,2,0] ) ,new entry('Andrea','blue-morpho.jpg','', [6,0,0,1,1,0,0,2,3,0,1,0,0,1,2,0,3,0,1,0,0,1,2,0,0,1,4,0,1,0,2,0, 4,0,1,0,1,0,2,0,0,1,3,0,1,0,2,0,2,0,0,1,3,0,1,0,0,2,1,0,1,0,5,0] ) ,new entry('Roland','fcn-historisch.png','... and here comes Duke!', [1,0,3,0,2,0,0,1,0,2,1,0,1,0,4,0,5,0,1,0,2,0,1,0,2,0,1,0,0,1,3,0, 6,0,1,0,1,0,2,0,1,0,3,0,0,1,2,0,2,0,1,0,3,0,1,0,0,1,2,0,1,0,4,0] ) ,new entry('Dan','jarret-allen.png','Walt Wesley?', [2,0,0,1,3,0,0,1,0,2,1,0,1,0,6,0,0,1,2,0,3,0,0,1,0,1,2,0,1,0,4,0, 2,0,0,1,3,0,0,1,0,1,4,0,0,1,2,0,5,0,1,0,2,0,0,1,2,0,0,1,1,0,3,0] ) ,new entry('Davi','vfc.jpg','Ô o gelo!', [3,0,1,0,2,0,1,0,0,1,4,0,1,0,2,0,6,0,0,1,2,0,1,0,1,0,3,0,0,1,2,0, 3,0,1,0,2,0,1,0,1,0,4,0,0,1,2,0,5,0,1,0,2,0,1,0,1,0,3,0,2,0,1,0] ) ,new entry('Jocelyn','clark.png','', [2,0,0,1,3,0,1,0,0,2,0,1,1,0,4,0,1,0,2,0,0,1,5,0,0,1,0,2,3,0,1,0, 2,0,1,0,3,0,1,0,1,0,4,0,1,0,2,0,6,0,1,0,1,0,2,0,1,0,2,0,0,1,3,0] ) ,new entry('Sawako','storky.png','', [2,0,0,1,3,0,1,0,0,1,4,0,1,0,2,0,1,0,5,0,0,1,2,0,0,1,2,0,3,0,1,0, 6,0,0,1,2,0,1,0,1,0,2,0,1,0,3,0,1,0,4,0,1,0,0,2,0,1,3,0,2,0,1,0] ) ,new entry('Howard F','ernie.jpg','', [5,0,0,1,2,0,0,1,2,0,1,0,1,0,3,0,3,0,1,0,2,0,1,0,0,1,2,0,0,1,4,0, 4,0,0,1,1,0,0,2,0,1,3,0,1,0,2,0,6,0,1,0,0,1,2,0,0,2,1,0,0,1,3,0] ) ,new entry('Peter','wright_flyer.jpg','Yes and it counts', [6,0,0,1,2,0,0,1,0,3,1,0,2,0,1,0,3,0,1,0,1,0,2,0,2,0,1,0,0,1,4,0, 3,0,1,0,2,0,1,0,1,0,4,0,0,2,1,0,5,0,1,0,2,0,1,0,3,0,1,0,1,0,2,0] ) ,new entry('Jason','13.gif','', [3,0,0,1,0,1,2,0,0,1,2,0,1,0,4,0,6,0,0,1,0,1,2,0,0,2,1,0,1,0,3,0, 5,0,1,0,2,0,0,1,1,0,3,0,0,1,2,0,3,0,0,1,2,0,1,0,2,0,1,0,0,1,4,0] ) ,new entry('Shannon','BasketballSnoopy-blank_molly.gif','', [6,0,0,1,0,2,1,0,2,0,0,1,1,0,3,0,3,0,1,0,0,1,2,0,1,0,2,0,1,0,4,0, 2,0,0,1,1,0,3,0,2,0,1,0,0,1,4,0,3,0,0,1,2,0,1,0,2,0,1,0,0,1,5,0] ) ,new entry('Dot','lisa.gif','', [3,0,0,1,2,0,0,1,0,2,0,1,0,1,5,0,4,0,1,0,0,2,1,0,3,0,1,0,0,1,2,0, 6,0,0,1,1,0,2,0,0,1,2,0,0,1,3,0,4,0,1,0,2,0,1,0,1,0,2,0,0,1,3,0] ) ,new entry('Greg','xgreg.jpg','', [4,0,1,0,2,0,1,0,1,0,2,0,1,0,3,0,6,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0, 3,0,0,1,1,0,2,0,1,0,2,0,1,0,5,0,3,0,1,0,2,0,1,0,1,0,2,0,1,0,4,0] ) ,new entry('Owen','owen.png','', [2,0,1,0,1,0,3,0,0,1,0,2,0,5,1,0,1,0,2,0,3,0,1,0,0,2,1,0,0,1,0,4, 1,0,0,2,3,0,1,0,6,0,0,1,0,2,0,1,3,0,0,1,1,0,0,2,0,1,2,0,0,4,1,0] ) ,new entry('Christine C','jelly-guy.png','', [4,0,1,0,2,0,1,0,3,0,1,0,1,0,2,0,5,0,1,0,2,0,1,0,3,0,1,0,1,0,2,0, 6,0,1,0,1,0,2,0,1,0,3,0,1,0,2,0,4,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0] ) ,new entry('Marty','marmot.png','WTF', [2,0,0,1,5,0,0,1,3,0,1,0,0,2,1,0,2,0,1,0,1,0,3,0,0,1,4,0,2,0,1,0, 6,0,1,0,2,0,1,0,0,1,3,0,2,0,1,0,3,0,1,0,2,0,1,0,0,1,4,0,1,0,2,0] ) ,new entry('Lara','hobbes.jpg','', [1,0,2,0,1,0,3,0,0,2,1,0,1,0,4,0,6,0,0,1,2,0,1,0,0,1,3,0,2,0,0,1, 2,0,1,0,0,1,3,0,0,1,4,0,1,0,2,0,2,0,1,0,0,1,3,0,0,2,1,0,1,0,5,0] ) ,new entry('Josef','baby-shark.png','🎵 Let\'s play ball do do do do do do', [6,0,0,1,0,2,1,0,0,2,1,0,0,3,0,1,1,0,2,0,4,0,1,0,3,0,0,1,0,1,2,0, 2,0,0,1,5,0,1,0,1,0,0,2,1,0,3,0,0,1,0,4,2,0,0,1,0,1,3,0,1,0,0,2] ) ,new entry('Yvonne "Seeds"','pumpkin-seeds.png','', [5,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0,4,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0, 6,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0,4,0,1,0,1,0,2,0,1,0,2,0,1,0,3,0] ) ,new entry('Abby','bugs.gif','Fashionably late to the picks party', [2,0,1,0,3,0,1,0,0,1,6,0,1,0,2,0,3,0,1,0,2,0,1,0,0,1,4,0,0,1,2,0, 2,0,0,1,3,0,1,0,0,1,5,0,0,1,2,0,2,0,1,0,1,0,4,0,1,0,2,0,1,0,3,0] ) ] // mischief Array.prototype.contains = function (element) { for (var i = 0; i < this.length; i++) { if (this[i] == element) { return true } } return false } var score = new Array() var total = new Array() var points = [ 0, 1, 2, 4, 6, 8, 10 ] var order = new Array() // puts a break before an ampersand in a string (useful for joint entries) function tidy(name) { var result = name var k = name.indexOf("&") if (k != -1) result = result.replace("&" ,"
&") return result } function player_table(k,htab,wtab,showScore) { var crown = " " pname = tidy(players[k].name) pimg = players[k].image rank = players[k].rank quip = players[k].quip isFake = fake.contains(pname) // if this is high scorer and mask is off, change background color if ((mask) || (players[k].rank != 1)) { cor = '"\#FFFFFF\"' } else { cor = 'gold' if (tournament_over) { crown = '' } } if ((toast_time) && (untoasted.contains(players[k].name))) { btx = 'navy 2px' } else { btx = '0' } var H = "75px" var W = "60px" if (toast_time) { toast = true for (var jj=0; jj < untoasted.length; jj++) { if ((!toast) || (pname == untoasted[jj])) { toast = false } } if (toast) { H = "36px" ; W = "30px" } } // if toast time // tx = '' + '' + '' + '' + '' : '') + '' + '' + '' + '
' + '' + ''  + pname + '' + '' + '' if (toast_time) { toast = true for (var jj=0; jj < untoasted.length; jj++) { if ((!toast) || (pname == untoasted[jj])) { toast = false } } if (toast) tx += '
' } // if toast time rankTag = "#" + rank if (isFake) rankTag = "" tx += "" + rankTag + " " + pname + '
' + (showScore ? '
  ' + total[k] + '
' + crown + '
' return tx } function mod(a, b) { return a-Math.floor(a/b)*b } function big_table() { var ncol=7 tx = '' + update_info + '
' tx += '' + '' for (i=0; i < players.length; i++) { tx += '' if (mod(i,ncol)==(ncol-1)) { tx += '' } } if (mod(i,ncol) != (ncol-1)) { tx += '' } // add end of row if # of players wasn't integer multiple of 5 return(tx) } // big_table function big_list() { // list the unique scores of players var scorelist = []; var current = -99; tx = "
" for (i=0; i < players.length; i++) { sc = score[order[i]][0] if ( sc != current) { scorelist.push(sc) current = sc tx += "
" tx += "
" tx += ' ' + sc + '' } tx += player_table(order[i], '100px', '200px',false) } tx += "
" return(tx) } // big_list //-- calc scores function calc_scores() { for (K=0; K < players.length; K++) { score[K] = [0, 0, 0, 0, 0, 0, 0] // total, then by round for (round=1; round <=6; round++) { for (tm=0; tm < 64; tm++) { // modified for DJT: he always gets full points no matter what if (results[tm][1] >= round) { if (players[K].name == TrumpName) { extra = Math.floor( 2*Math.random()) // 0 or 1 score[K][0] += points[round] + extra score[K][round] += points[round] + extra } else if (players[K].picks[tm] >= round) { score[K][0] += points[round] score[K][round] += points[round] } } // if result... } // for tm } // for round total[K] = score[K][0] } // for K tournament_over = 0 for (tm=0; tm < 64; tm++ ) {if (results[tm][1]==6) {tournament_over=1} } } // calc_scores // calc order function calc_order() { var avail = new Array() //-- sort totals for (K=0; K < players.length; K++) { avail[K] = 1 } for (pos=0; pos < players.length; pos++) { HI = -1 kstar = 999 for (K=0; K < players.length; K++) { if (avail[K]==1 && total[K] > HI) { kstar = K HI = total[K] } } order[pos] = kstar avail[kstar] = 0 } // construct an array with the player indices (0,1,...) of the NON-fake players // in order of current scores realOrder = [] for (pos=0; pos < players.length; pos++) { if (!fake.contains(players[order[pos]].name)) realOrder.push(order[pos]) } // alert('temporary debugging info\n' + realOrder) /*--- old ranking calculation (without fakes) rk = 1 players[order[0]].rank = 1 for (pos=1; pos < players.length; pos++) { if (total[order[pos]] < total[order[pos-1]]) { rk = pos+1 } players[order[pos]].rank = rk // alert("pos="+pos+" score="+total[order[pos]]+" rank="+rk) } ---*/ // new ranking calculation (exclude fakes) rk = 1 players[realOrder[0]].rank = 1 for (pos=1; pos < realOrder.length; pos++) { if (total[realOrder[pos]] < total[realOrder[pos-1]]) { rk = pos+1 } players[realOrder[pos]].rank = rk } for (pos=0; pos < players.length; pos++) { if (fake.contains(players[pos].name)) players[pos].rank="X" } } // calc_order //-- calculate and display current scores, by round and total function show_scores() { //-- write scores in descending order tx = 'HOME
' tx += '' + update_info + '

' tx += '
' + player_table(order[i],'100%','100%',true) + '
' tx += '' for (round=1; round <=6; round++) { tx += '' } tx += '' for (i=0; i < order.length; i++) { K = order[i] tx += '' writeRank = ((i==0) || (total[K] < total[order[i-1]]) || fake.contains(players[K].name)) if (writeRank) { tx += '' } else { tx += '' } tx += '' for (round=0; round <= 6; round++) { tx += '' } tx += '' } tx += '
RankNameTotalR' + round +' (x' + points[round] +' pts)
' + players[K].rank + ' ' + players[K].name +'' if (round==0) { tx += '' } tx += score[K][round] if (round==0) { tx += '' } tx += '
' document.getElementById("contents").innerHTML = tx } // show_scores function plot_scores() { //-- write scores in descending order tx = 'HOME
' tx += '' + update_info + '

' tx += "" var maxPts = score[order[0]][0] for (i=0; i < order.length; i++) { K = order[i] nam = players[K].name pts = score[K][0] tx += "" } tx += "
" + '' + nam + " (" + pts +")" if (pts > 0) { tx += Array(pts).join("_") tx += "" + nam.charAt(0) + "" tx += Array(maxPts-pts+1).join(".") } tx += "
" document.getElementById("contents").innerHTML = tx } // plot_scores function cell(T,R,bottom) { var sss = ["color:black" , "color:green; font-weight:bold; text-transform:uppercase", "color:red; font-size:small; font-weight:bold; text-decoration:line-through"] wins = results[T][1] // number of wins so far relim = results[T][2] // round that this team was eliminated (99 = still alive) if (wins >= R) {cat = 1} else if (relim <= R) { cat=2 } else {cat = 0} if (relim > R) { J=0 } else { J = 1} if (!bottom) st = '' else st = '' st += teamname[T] + '\ \; ' return st } // cell //-- show the picks for player # K in a 4 x ? table function show_picks(K) { function ordinal(r) { var tx if ((r % 10 == 1) && (r!=11)) tx= r+'st' else if ((r % 10 == 2) && (r!=12)) tx= r+'nd' else if ((r % 10 == 3) && (r!=13)) tx= r+'rd' else tx= r+'th' return tx } tx = 'HOME    ' tx += '' + update_info + '' if (mask) { tx += '

Picks are masked until tournament begins' } else { tx += '' tx += '' tx += '' tx += '' // experiment ///////////////////////// // figure out who's next in scoring order (slightly klutzy, but it will work) z = 0 while (order[z] != K) { z++ } next = order[(z+1) % order.length] ///////////////////////////////////// // start big cell with image, score, place tx += '' // end image cell tx += '' tx += '
' tx += '' /// first 4 rounds for (round=1; round <=4 ; round++) { nrow = Math.pow(2,4-round) rowoff = Math.pow(2,round) for (row=0; row < nrow; row++) { tx += '' bottom = (row == nrow-1) for (col=0; col < 4; col++) { lo = row * rowoff + col * 16 hi = lo + rowoff -1 //alert("round " + round + " nrow " + nrow + " row " + row + " col " + col + " lo=" + lo + " hi= " + hi) for (tm= lo; tm <= hi; tm++) { if (players[K].picks[tm] >= round) { tx += cell(tm,round,bottom) } } // for tm } // for col tx += '' } // for row // tx += '' } // for round // last 2 rounds (Final 4) as special case round = 5 tx += '' for (tm= 0; tm < 32; tm++) { if (players[K].picks[tm] >= round) { tx += cell(tm,round) } } tx += '' for (tm= 32; tm < 64; tm++) { if (players[K].picks[tm] >= round) { tx += cell(tm,round) } } tx += '' tx += '' round = 6 tx += '' for (tm= 0; tm < 64; tm++) { if (players[K].picks[tm] >= round) { tx += cell(tm,6) } } tx += '' tx += '' tx += '
 
  
 
' tx += '
  ' // tx += '' tx += '' tx += '' tx += '' tx += '
' + players[K].name + '
' + total[K] + ' points
' +ordinal(players[K].rank)+' place
' tx += '
' } document.getElementById("contents").innerHTML = tx } // show picks // experimental function to toggle hiding toasted players from // Final 4 list function showhide() { tb = document.getElementById("f4table") rw = tb.rows hide = document.getElementById("hider").checked for (i=0; i < players.length; i++) { k = order[i] showme = ((!hide) | (!toast_time) | (untoasted.contains(players[k].name))) rw[i+2].style.visibility = showme ? "visible" : "collapse" } } //-- show the Final 4 picks for all players, in descending order of // current score function show_final4() { tx = 'HOME
' tx += '' + update_info + '
' if (mask) {tx += '

Picks are masked until tournament starts' } else { tx += '' tx += '' tx += '' tx += '' tx += '' tx += '' tx += '' for (k=0; k < players.length; k++) { i = order[k] f4 = '' f2 = '' f1 = '' for (tm=0; tm < 64; tm++) { if (players[i].picks[tm] > 3) f4 += cell(tm,4) if (players[i].picks[tm] > 4) f2 += cell(tm,5) if (players[i].picks[tm] > 5) f1 += cell(tm,6) } // for tm tx += '' tx += '' tx += f4 tx += f2 tx += f1 tx += '' } // for i tx += '
' tx += '' tx += 'Hide toast
PlayerFinal 4Final 2Winner
' + players[i].name + ' (' + score[i][0] + ')
' } // return tx // alert(tx) document.write(tx) //-- change row backgrounds tb = document.getElementById('f4table') rw = tb.rows for (r=1; r < rw.length; r+=2) { rw[r].bgColor = "#EFEFEF" } } // show final 4 function teamcell(i) { var cell = document.getElementById("teaminfo") var tx, gplayed, alive, wins, opt_s var pickers = [] var K, round, rtext,rnd,rtx alive = (results[i][2] == 99) wins = results[i][1] if (alive) gplayed = wins else gplayed = results[i][2] if (gplayed == 1) opt_s = '' else opt_s = 's' tx = '' + teamname[i].toUpperCase()+ ' has played ' + gplayed + ' game' + opt_s + '... ' if (alive) tx += 'still alive' else tx += 'eliminated in Round ' + results[i][2] tx += '
' rtext = ['Picked in Round 1','Sweet 16','Elite 8', 'Final 4','Finalist','Champion'] var R,status for (R=0; R < 6; R++) { round=R+1 status = 0 if (results[i][1] >= round) status=1 if (results[i][2] <= round) status=2 pickers = [] for (K=0; K < players.length; K++) { if (players[K].picks[i] >= round) pickers.push(K) } tx += '' tx += ''+rtext[R] + ' ('+pickers.length+ ')
' tx += '' if (pickers.length==0) tx += "--
" else { for (K=0; K < pickers.length; K++) { tx += players[pickers[K]].name if (K<(pickers.length-1)) { tx += ',' if (K % 11 == 10) tx += '
' } } tx += '
' } } // for R if (mask) cell.innerHTML = "picks are masked until tournament starts" else cell.innerHTML = tx } // teamcell function team_report() { var j,k var tx tx = 'HOME ' tx += '' + update_info + '' tx += '' tx += ' ' tx += ' ' tx += ' ' tx += ' ' tx += '
' tx += '' for (j=0; j<16; j++) { tx += '' for (k=0; k<4; k++) { tx += '' } tx += '' } tx += '
' tx += teamname[j + 16*k] + ' ' tx += '
' tx += '
' tx += '
' document.write(tx) } // team_report calc_scores() calc_order()