ÿþ<HTML> <HEAD><TITLE> Hand/Bidding Diagram </TITLE> <script type="text/javascript"><!-- //Consider using a textbox as a form entry method for the auction, either in a separate form or in the one presently showing, with a default auction //Consider using the directional transformation function to have SHDC strings as input in the 52digit entry possibility otherwise //Consider using to that again a letter that indicates which direction should be in the south place, setting the basis for a rotation for the diagram AND a translation of 52 digits to a standard Aj62.kqj.aq4.ak7,t4.95432.kt873.2,q75.a6.j92.qt543,k983.t87.65.j986 notation line just above the "link to the story" link /////////////////////////////////////////////////////////////////////////////////////////////// var hand = "AJ62.kqj.aq4.ak7,t4.95432.kt873.2,q75.a6.j92.qt543,k983.t87.65.j986" // S,W,N,E in order, a period between each suit, a comma between each hand for the alphanumeric format // Aj62.kqj.aq4.ak7,t4.95432.kt873.2,q75.a6.j92.qt543,k983.t87.65.j986 // SAQJHK5DAQ9CQJ654,SK654H876DKT87C87,S2HAQ432DJ432CA32,ST9873HJT9D65CKT9 // 0012132123121003200303232100123332202101020321311133 has NWES as standard 0123 order //var hand = "Aj62.kqj.aq4.ak7,t4.95432.kt873.2,q75.a6.j92.qt543,k983.t87.65.j986" //var hand = "aj2.432.AQ92.akq,...,kq6543.AJ.3.J543,..." //var hand = "aj2.432.AQ92.akq,...,...,..." //var auction = "Dealer:N,Vul:0,ScoreMethod:M,Auction:1CfP1DfPP1Hfp1SfpfpXrppp"; /////////////////////////////////////////////////////////////////////////////////////////////// var auction = "Dealer:N,Vul:0,ScoreMethod:M,Auction:1CP1DfPP1Hfp1SfpfpXrppp"; var title = "Change this Title"; /////////////////////////////////////////////////////////////////////////////////////////////// auctionReset = auction; //var nameAnchorStart = location.href.substring(0,location.href.lastIndexOf('#')+1); var vulDealer = location.href.substring(0,location.href.lastIndexOf('#')+1); var url = location.href.substring(location.href.length-52,location.href.length); /* if(location.href.lastIndexOf('#')==-1){ document.write("<a href=" + location.href+ "#17z" + "Aj62.kqj.aq4.ak7,t4.95432.kt873.2,q75.a6.j92.qt543,k983.t87.65.j986" + ">" + "Click Here</a>") } */ var vulDealer = location.href.substring(location.href.lastIndexOf('#')+1,location.href.lastIndexOf('z')); possibleName = location.href.substring(location.href.lastIndexOf('#')+1,location.href.length+1) vulDealer = vulDealer-1 var vulX = (vulDealer +(vulDealer-vulDealer%4)/4)%4 var dealerX = (vulDealer)%4 vulArray = new Array("0","N","E","B") dealerArray = new Array("N","E","S","W") //document.write("Board number is " + "<br>") //document.write("Vulnerability is " + vulArray[vulX] + "<br>") //document.write("Dealer is " + dealerArray[dealerX] + "<br>") var bidString = location.href.substring(location.href.lastIndexOf('z')+1,location.href.length-52); realPartOfAuctionString = auction.substring(auction.lastIndexOf(':')+1,auction.length) var preDeal = location.href.substring(0,location.href.lastIndexOf('z')+1); //document.write(preDeal) var postPreDeal = location.href.substring(location.href.lastIndexOf('z')+1,location.href.length); //document.write(postPreDeal) //var auctionL = postPreDeal.substring(0,postPreDeal.lastIndexOf('ppp')) + 'ppp'; //document.write(auctionL) sampleAuction2 = '1s2h3d4c5nxrppp' var sampleUrl = preDeal + sampleAuction2 + postPreDeal; var postPound = location.href.substring(location.href.lastIndexOf('.htm')+5,location.href.length); //document.write(postPound) notNovice="true"; if (bidString.length<1){bidString = realPartOfAuctionString} else{notNovice="false"} //document.write('notNovice=' +notNovice) auction = "Dealer:"+dealerArray[dealerX]+",Vul:"+vulArray[vulX]+",ScoreMethod:M,Auction:"+bidString+"" if(location.href.lastIndexOf('#')!=-1){ document.write("<b>Insert YOUR auction into Explorer's address bar starting after the 'z' and hit 'ENTER'." + " (<a href=" + sampleUrl + " target=_blank"+">"+"Example "+"</a>" + " of inserting '" +sampleAuction2+ "')" + "<br>") document.write("Then click the 'Show Code' button to have processed standard html formatted code in the textbox." + "<br>") document.write("Copy that text (Ctrl-C)" + "<br>") document.write("Click on the link <a href=temp.htm target='_blank'>'to temp.htm'</a> and a new empty window should be launched." + "<br>") document.write("In that new window, click top toolbar's <u>V</u>iew then Sour<u>c</u>e and a Notepad window should be launched." + "<br>") document.write("Paste the text (Ctrl-V) into that Notepad, click '<u>F</u>ile Save <u>A</u>s...', name that .html file and then open it in your favourite html editor to write your story." + "</b><br>") } if(location.href.lastIndexOf('#')==-1){ document.write("<b>Edit the source of this file including hand, auction, etc., resave and relaunch.</b>") } if(location.href.substring(location.href.lastIndexOf('.htm'),location.href.length)==".htm"){auction=auctionReset} //document.write("<center>" + url + "</center>" + "url length = " + url.length); if(url.length=52 && url.substring(0,1)=="0"||url.substring(0,1)=="1"||url.substring(0,1)=="2"||url.substring(0,1)=="3"){ hand = url } //document.write("<br>" +hand + "<br>" + url.substring(0,1) + "<br>") //fix for 52base4 string as input rather than other input options above function directionChange(old1,new1,stringOf52){ stringA = old1 //"snwe" // stringA.toUpperCase() stringB = new1 //"swne" // stringB.toUpperCase() // if(stringA.sort()!=stringB.sort()){document.write("Strings not equivalents. Recheck your strings.")} oldOrder = new Array() newOrder = new Array() associativeOldOrder = new Array() associativeNewOrder = new Array() //start with the old and revalue the new using the relationship between oldOrder elements and newOrder elements oldString52digits = stringOf52 newString52digits = "4444444444444444444444444444444444444444444444444444" for(a=0;a<stringA.length;a++){ oldOrder[a] = stringA.charAt(a) newOrder[a] = stringB.charAt(a) associativeOldOrder[stringA.charAt(a)] = a associativeNewOrder[stringA.charAt(a)] = a } new52 = "" for(b=0;b<oldString52digits.length;b++){ //document.write(associativeOldOrder[newOrder[oldString52digits.charAt(b)]]) new52 += associativeOldOrder[newOrder[oldString52digits.charAt(b)]] } document.write(new52) hand=new52 } /////////////////////////////////////////////////////////////////////////////////////////////// var auctionNote = new Array(10); /////////////////////////////////////////////////////////////////////////////////////////////// var nameArray = new Array("South","West","North","East"); var suitArray = new Array("Spades","Hearts","Diamonds","Clubs"); var suitGifArray = new Array("s","h","d","c"); var note = ""; var lead = "" var code = ""; function dealCheck(x){ //code += ( x[1][0].length); //code += ( "<br>" + x[1][0]); /* for (a=0;a<4;a++){ var suitLength = 13; for (b=0;b<4;b++){ suitLength = suitLength - x[b][a].length; code += x[b][a].length; } if (suitLength!=0) { code += "<big><big><big>Error</big></big></big>"; } } */ } // FUNCTION THAT SORTS STRINGS// function sorter(a) { var aArray = new Array(a.length); for (b=0;b<a.length;b++) { aArray[b]= a.charAt(b); } aArray.sort(); c = ""; for (b=0;b<aArray.length;b++) { c+= aArray[b]; } return (c); } // END STRING SORT FUNCTION// stringIfToDigits = "" function stringToDigits(dottedCommadString){ precedenceArray = new Array("A","K","Q","J","T","9","8","7","6","5","4","3","2") associativePrecedenceArray = new Array() for(a=0;a<precedenceArray.length;a++){ associativePrecedenceArray[precedenceArray[a]] = a } stringOf52bArray = new Array() for (b=0;b<stringOf52bArray;b++){ stringOf52bArray[b] = 4; } dottedCommadString = dottedCommadString.toUpperCase() a=0 //location to be checked in "Aj62.kqj.aq4.ak7,t4.95432.kt873.2,q75.a6.j92.qt543,k983.t87.65.j986" string suit = 0 //spades by convention the first suit, hearts second, diamonds third, clubs fourth direction = 0 //0 by convention the S direction, 1 the West direction,2 the N direction, 3 the E direction b=0 //for ignorance necessary for proper operation of while below while(a<dottedCommadString.length){ if(dottedCommadString.charAt(a)=="."){ suit++; a++ } else if(dottedCommadString.charAt(a)==","){ direction++; suit=0; a++ } else { stringOf52bArray[associativePrecedenceArray[dottedCommadString.charAt(a)]+suit*13] = direction a++ b++ } } crap = stringOf52bArray.join() newCrap = "" for (b=0;b<crap.length;b++){ if(crap.charAt(b)!=","){ newCrap+=crap.charAt(b) } } return (newCrap); } stringIfToDigits = //document.write(stringToDigits(hand)+"<p>") // FUNCTION THAT DEVELOPS THE HAND STRING function Hand(HandString){ if(HandString=="0"||HandString=="1"||HandString=="2"||HandString=="3"){ directionChange("SWNE","SENW",hand) //calls the function } HandString = HandString.replace("..",". .") HandString = HandString.replace("..",". .") HandString = HandString.replace("..",". .") HandString = HandString.replace("..",". .") HandString = HandString.replace("..",". .") HandString = HandString.replace("..",". .") HandString = HandString.replace(".,",". ,") HandString = HandString + " "; var handsArray = HandString.split(","); for (var i=0;i<handsArray.length;i++) { re1= /\./; handsArray[i] = handsArray[i].split(re1); } for (var a=0;a<4;a++) { for (var b=0;b<4;b++) { if (handsArray[a][b]=="undefined") { handsArray[a][b]=""; } } dealCheck (handsArray); } var spades=""; var hearts=""; var diamonds=""; var clubs=""; for (a=0;a<4;a++) { spades+=handsArray[a][0] hearts+=handsArray[a][1] diamonds+=handsArray[a][2] clubs+=handsArray[a][3] } for (a=0;a<4;a++) { spades=sorter(spades); hearts=sorter(hearts); diamonds=sorter(diamonds); clubs=sorter(clubs); } //document.write(possibleName.length) if(possibleName.length!=54){ // Error testing and reporting // if (spades!="23456789AJKQT" && spades!=" 23456789AJKQT") { document.write ("spade error : <br>" + spades + " are not <br>23456789AJKQT<br>"); } if (hearts!="23456789AJKQT" && hearts!=" 23456789AJKQT") { document.write ("heart error : <br>" + hearts + " are not <br>23456789AJKQT<br>"); } if (diamonds!="23456789AJKQT" && diamonds!=" 23456789AJKQT") { document.write ("diamond error : <br>" + diamonds + " are not <br>23456789AJKQT<br>"); } if (clubs!="23456789AJKQT" && clubs!=" 23456789AJKQT") { document.write ("club error : <br>" + clubs + " are not <br>23456789AJKQT<br>"); } } testX = location.href.substring(location.href.length-1,location.href.length) if(testX=='m'||testX=='l'){ document.write("23456789AJKQT" + "&nbsp;&nbsp;&nbsp;&nbsp;" + "23456789AJKQT" + "&nbsp;&nbsp;&nbsp;&nbsp;" + "23456789AJKQT" + "&nbsp;&nbsp;" + "23456789AJKQT" + "<br>"); document.write(spades + "&nbsp;&nbsp;&nbsp;&nbsp;" + hearts + "&nbsp;&nbsp;&nbsp;&nbsp;" + diamonds + "&nbsp;&nbsp;" + clubs + "<br>"); } code += "<table border=0>"; // NORTH hand row if(handsArray.length>1) { code += "<tr><td width=60></td><td colspan=2><font size=3><strong><u><b>NORTH</b></u></strong>"; for(suit=0;suit<4;suit++) { code += "<br><img src=./images/" +suitGifArray[suit]+ ".gif>&nbsp;" + handsArray[2][suit]; } code += "</font></td><td width=60></td></tr>"; } // EW Hand Row // WEST Data if(handsArray.length>2) { code += "<tr><td colspan=2><font size=3>"; for(suit=0;suit<4;suit++) { code += ("<img src=./images/" +suitGifArray[suit]+ ".gif>&nbsp;" + handsArray[1][suit] + "<br>"); } code += ("</font></td>"); // EAST Data code += ("<td>&nbsp;</td><td colspan=2><font size=3>"); for(suit=0;suit<4;suit++) { code += ("<img src=./images/" +suitGifArray[suit]+ ".gif>&nbsp;" + handsArray[3][suit] + "<br>"); } code += ("</font></td></tr>"); } // SOUTH Hand Row code += ("<tr><td>&nbsp;</td><td colspan=2><font size=3>"); for(suit=0;suit<4;suit++) { code += ("<img src=./images/" +suitGifArray[suit]+ ".gif>&nbsp;" + handsArray[0][suit] + "<br>"); } code += ("</font></td><td width=60></td></tr></table>"); } // END HAND FUNCTION function digitsToString(digits){ hand = digits; character = ""; hand2 = ""; cardArray = new Array("0","1","2","3"); cardNameArray = new Array("A","K","Q","J","T","9","8","7","6","5","4","3","2"); // setting up an Array for the deck, eventually to be recognized as cardArray[direction][suit] // for format akq.akq.akq.akq2,jt9.jt9.jt9.jt93,876.876.876.8764,5432.5432.5432.5 for (a=0;a<4;a++){ cardArray[a] = new Array("","","",""); } for (suit=0;suit<4;suit++){ for (rank=0;rank<13;rank++){ cardArray[hand.charAt(suit*13 + rank)][suit]+=cardNameArray[rank]; } } for (direction=0;direction<4;direction++){ switch(direction) { case 0: temp=3; break; case 2: temp=0; break; case 3: temp=2; break; case 1: temp=1; break; } for (suit=0;suit<4;suit++){ hand2+=cardArray[temp][suit] if (suit<3){ hand2+="."; } } if (direction<3){ hand2+=","; } } return hand2; } //document.write(digitsToString("0012132123121003200303232100123332202101020321311133")) // AUCTION FUNCTION function Auction(auctionString) { var auctionArray = auctionString.split(","); for (var i=0;i<auctionArray.length;i++) { auctionArray[i] = auctionArray[i].split(":"); } re = /(\d*)(\D)/g; var auction31Array = auctionArray[3][1].match(re); var dealer; // AUCTION HEADER code += ("<table align=center><tr><td><font size=2>"); code += (" <u>Dealer</u>: <b>"); switch(auctionArray[0][1]) { case "S": code += ("South");dealer=1;break; case "N": code += ("North");dealer=3;break; case "E": code += ("East");dealer=2;break; case "W": code += ("West");dealer=4;break; } code += ("</b> &nbsp;&nbsp;&nbsp;<u>Vul</u>: "); switch(auctionArray[1][1]) { case "N": code += ("<font color=red>NS</font color>");break; case "E": code += ("<font color=red>EW</font color>");break; case "0": code += ("<font color=green>None</font color>");break; case "B": code += ("<font color=red>Both</font color>");break; } code += ("&nbsp;&nbsp;&nbsp;<b><i>"); switch(auctionArray[2][1]) { case "M": code += ("<u>MP");break; case "I": code += ("<u>IMP");break; } code += (" Scoring</u></i></b>"); code += ("</font></td></tr></table>"); footNumber=0; foot = 0; // RESETS auction31 ARRAY with formatted bids for (loop=0;auction31Array.length>(loop+foot);loop++) { auction31Array[loop]=auction31Array[loop+foot]; switch(auction31Array[loop]) { case "F": auction31Array[loop-1]+= "<small><small><font color=red>" + (foot+1) + "</font color></small></small>";foot++;auction31Array[loop]=auction31Array[loop+foot]; case "P": auction31Array[loop]= "<font color=green>Pass</font color>"; break; case "X": auction31Array[loop]= "<font color=red>X</font color>"; break; case "R": auction31Array[loop]= "<font color=blue>XX</font color>"; break; case "?": auction31Array[loop]= "???"; break; default: var temp= auction31Array[loop].charAt(1).toLowerCase(); if(temp=="n") { auction31Array[loop]= auction31Array[loop].charAt(0) + "N"; } else { auction31Array[loop]= auction31Array[loop].charAt(0) + "<img src=./images/" + auction31Array[loop].charAt(1).toLowerCase() + ".gif>" };break; } } code += ("<table border=0 width=\"220\" align=center><tr><td valign=top width=\"25%\" height=\"89\"><p><font size=3><b><big>West</big></b>"); // West if (dealer<4){ code += ("<br>"); } for (loop=0;(loop*4+dealer%4)<auction31Array.length-foot;loop++) { code += ("<br><b>" + auction31Array[loop*4+dealer%4] + "</b>"); } code += ("</font></p></td><td valign=top width=\"25%\" height=\"89\"><font size=3><b><big>North</big></b>"); // North if (dealer<3){ code += ("<br>"); } for (loop=0;(loop*4+(dealer+1)%4)<auction31Array.length-foot;loop++) { code += ("<br><b>" + auction31Array[loop*4+(dealer+1)%4] + "</b>"); } code += ("</font></td><td valign=top width=\"25%\" height=\"89\"><p><font size=3><b><big>East</big></b>"); // East if (dealer<2) { code += ("<br>"); } for (loop=0;(loop*4+(dealer+2)%4)<auction31Array.length-foot;loop++) { code += ("<br><b>" + auction31Array[loop*4+(dealer+2)%4] + "</b>"); } code += ("</font></td><td valign=top width=\"25%\" height=\"89\"><p><font size=3><b><big>South</big></b>"); // South for (loop=0;(loop*4+(dealer+3)%4)<auction31Array.length-foot;loop++) { code += ("<br><b>" + auction31Array[loop*4+(dealer+3)%4] + "</b>"); } code += ("</font></p></td></tr></table>"); } // END AUCTION // NOTES Row function Lead(noteString) { code += ("<table align=\"center\" border=.5 bordercolorlight bgcolor=yellow><tr><td align=\"center\"><big><big><big><b><center>&nbsp;"); code += (noteString); code += ("&nbsp;</center></b></big></big></big></td></tr></table>"); } // Lead Row function Lead(leadString) { code += ("<table align=\"center\" border=.5 bordercolorlight bgcolor=yellow><tr><td align=\"center\"><big><big><big><b><center>&nbsp;"); code += (leadString); code += ("&nbsp;</center></b></big></big></big></td></tr></table>"); } // Title Box function Title(titleString) { code += ("<table align=\"center\" border=.5 bordercolorlight bgcolor=yellow><tr><td align=\"center\"><big><big><big><b><center>&nbsp;"); code += (titleString); code += ("&nbsp;</center></b></big></big></big></td></tr></table>"); } function make() { //code += calendar_form.source_code.value window.document.calendar_form.source_code.value = code; } //--></script> </HEAD> <BODY> <script type="text/javascript"><!-- code += ("<table align=left border=1 cellpadding=0 cellspacing=0><tr><td>"); hand = hand.toUpperCase(); character = ""; if (hand.charAt(0)=="S"){ hand2 = ""; for (a=0;a<hand.length;a++) { if (hand.charAt(a)=="S") { character=""; } else if (hand.charAt(a)=="H" || hand.charAt(a)=="D" || hand.charAt(a)=="C") { character="."; } else { character=hand.charAt(a) } hand2+= character; } hand = hand2; } if(hand.charAt(0)=="0"||hand.charAt(0)=="1"||hand.charAt(0)=="2"||hand.charAt(0)=="3"){ Hand(digitsToString(hand)) } else Hand(hand) code += ("</td></tr><tr><td>"); auction = auction.toUpperCase(); Auction(auction); code += ("</td></tr><tr><td>"); //Notes("");code += ("</td></tr><tr><td>"); //Lead("");code += ("</td></tr><tr><td>"); code += ("</td></tr></table>"); Title(title); for (loop=0;loop<foot;loop++){ code += "<b><small><small><font color=red>" + (loop+1) + "</font color></small></small></b>\n\n<br>"; } code += "\n<p>\n<p>\n<p>\n<p>\n"; code += '<CENTER></CENTER>\n'; code += '<!--\n'; //code += '<a href=' + possibleName + '.htm' + '>'; code += possibleName + '.htm'; //code += '</a>'; code += '\n//-->'; document.write(code); //window.open(code); //--></script> <body> <form name="calendar_form"> <center> <textarea rows="18" cols=50" name="source_code"> Print these directions now. Type your auction into the address bar AFTER the 'z' and BEFORE all the numbers under 5. Hit "ENTER". Click the "show code" button below and simple html source code will replace these directions. Copy that text (Control C). Click on the link "to temp.htm" to launch an empty window in this directory. In that "temp.htm" click View Source and Notepad.exe should be launched. Paste the text (Ctrl V) into Notepad.exe and File Save. Use your favourite html editor to write your story in that new file, then name it properly and make "temp.htm" an empty file.</textarea><hr> <input type="button" value="Show Code" onClick="make();window.document.calendar_form.source_code.select();"></form> <!--Story Text--> <p> <script type="text/javascript"><!-- document.write("<a href=temp.htm target='_blank'>to temp.htm</a>") if(postPound.length!=0){ document.write("&nbsp;&nbsp;&nbsp;&nbsp;<a href="+postPound+".htm>to .htm file not yet there</a>") } //--></script> </BODY> </HTML>