tag:blogger.com,1999:blog-28008353653128214092017-04-24T03:41:12.828-07:00Grey Matters: Mental GymTrain and strain your brain to entertain!Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.comBlogger60125tag:blogger.com,1999:blog-2800835365312821409.post-14452614594455198572014-08-24T09:00:00.001-07:002014-08-24T09:00:19.675-07:00Easter Date For A Given Year Quiz<span id="fullpost"><a href="http://gmmentalgym.blogspot.com/2014/08/easter-date-for-given-year.html">Learn to perform the <i>Easter Date For A Given Year</i> feat here</a>.<br /><br />Quiz will appear below:</span><br /><div id="quizarea"></div><span id="fullpost"><br /><b>Roman Catholic Easter, 1900-2099</b><br /><a class="gmButton" onclick="fullmoon1quiz()">Full Moon Date</a><br /><br /><a class="gmButton" onclick="easter1quiz()">Full Moon and Easter Dates</a><br /><br /><br /><b>Orthodox Easter, 1900-2099</b><br /><i>(Asks about Roman Catholic full moon and Easter dates first)</i><br /><a class="gmButton" onclick="fullmoon2quiz()">Full Moon Dates</a><br /><br /><a class="gmButton" onclick="easter2quiz()">Full Moon and Easter Dates</a><br /></span><br /><script type='text/javascript'> //<![CDATA[ var moondates = ["March 22", "March 23", "March 24", "March 25", "March 26", "March 27", "March 28", "March 29", "March 30", "March 31", "April 1", "April 2", "April 3", "April 4", "April 5", "April 6", "April 7", "April 8", "April 9", "April 10", "April 11", "April 12", "April 13", "April 14", "April 15", "April 16", "April 17", "April 18"]; var easterdates = ["March 23", "March 24", "March 25", "March 26", "March 27", "March 28", "March 29", "March 30", "March 31", "April 1", "April 2", "April 3", "April 4", "April 5", "April 6", "April 7", "April 8", "April 9", "April 10", "April 11", "April 12", "April 13", "April 14", "April 15", "April 16", "April 17", "April 18", "April 19", "April 20", "April 21", "April 22", "April 23", "April 24", "April 25"]; var moondates1 = ["March 21", "March 22", "March 23", "March 24", "March 25", "March 26", "March 27", "March 28", "March 29", "March 30", "March 31", "April 1", "April 2", "April 3", "April 4", "April 5", "April 6", "April 7", "April 8", "April 9", "April 10", "April 11", "April 12", "April 13", "April 14", "April 15", "April 16", "April 17", "April 18"]; var moondates2 = ["April 3", "April 4", "April 5", "April 6", "April 7", "April 8", "April 9", "April 10", "April 11", "April 12", "April 13", "April 14", "April 15", "April 16", "April 17", "April 18", "April 19", "April 20", "April 21", "April 22", "April 23", "April 24", "April 25", "April 26", "April 27", "April 28", "April 29", "April 30", "May 1"]; var easterdates2 = ["April 4", "April 5", "April 6", "April 7", "April 8", "April 9", "April 10", "April 11", "April 12", "April 13", "April 14", "April 15", "April 16", "April 17", "April 18", "April 19", "April 20", "April 21", "April 22", "April 23", "April 24", "April 25", "April 26", "April 27", "April 28", "April 29", "April 30", "May 1", "May 2", "May 3", "May 4", "May 5", "May 6", "May 7", "May 8"]; function random(maxValue) { day = new Date(); hour = day.getHours(); min = day.getMinutes(); sec = day.getSeconds(); mili = day.getTime() return (((hour * 3600) + (min * 60) + (sec) + mili) % maxValue); } function ranom(maxValue) { return (Math.floor(Math.random() * maxValue)); } function fullmoon1quiz() { var quiz = []; var maxValue = 200; var numA = ranom(maxValue); var rccalc = ((((numA) % 19) * 11) + 5) % 30; if ((((numA) % 19) == 5) || (((numA) % 19) == 16)) { rccalc = rccalc + 1; } if (rccalc < 19) { crctAns = "April " + (19 - rccalc).toString(); } else { crctAns = "March " + (50 - rccalc).toString(); } numA = numA + 1900; var qstn = "On what date does the paschal full moon occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (moondates[j] != crctAns) { fakeans[j] = moondates[j]; } else { fakeans[j] = null; }; j++; } while (j < moondates.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); var options = { title: "Full Moon: 1900 to 2099", numOfQuizQues: 1, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function easter1quiz() { var quiz = []; var maxValue = 200; var numA = ranom(maxValue); var rccalc = ((((numA) % 19) * 11) + 5) % 30; if ((((numA) % 19) == 5) || (((numA) % 19) == 16)) { rccalc = rccalc + 1; } if (rccalc < 19) { var mnth = 3; var eadate = 19 - rccalc; crctAns = "April " + (19 - rccalc).toString(); } else { var mnth = 2; var eadate = 50 - rccalc; crctAns = "March " + (50 - rccalc).toString(); } numA = numA + 1900; var qstn = "On what date does the paschal full moon occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (moondates[j] != crctAns) { fakeans[j] = moondates[j]; } else { fakeans[j] = null; }; j++; } while (j < moondates.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); var date = new Date(numA, mnth, eadate); var day = date.getDay(); eadate = eadate + (7 - day); var crctAns = ""; if (eadate > 31) { eadate = eadate - 31; mnth = 3; } if (mnth == 2) { crctAns = "March "; } else { crctAns = "April "; } crctAns = crctAns + eadate.toString(); var qstn = "On what date does Easter occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (easterdates[j] != crctAns) { fakeans[j] = easterdates[j]; } else { fakeans[j] = null; }; j++; } while (j < easterdates.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); var options = { title: "Full Moon and Easter: 1900 to 2099", numOfQuizQues: 2, quizType: "multi", allRandom: false, random: false }; $("#quizarea").jQuizMe(quiz, options); }; function fullmoon2quiz() { var quiz = []; var maxValue = 200; var numA = ranom(maxValue); var rccalc = ((((numA) % 19) * 11) + 5) % 30; if ((((numA) % 19) == 5) || (((numA) % 19) == 16)) { rccalc = rccalc + 1; } if (rccalc < 19) { var mnth = 3; var eadate = 19 - rccalc; crctAns = "April " + (19 - rccalc).toString(); } else { var mnth = 2; var eadate = 50 - rccalc; crctAns = "March " + (50 - rccalc).toString(); } numA = numA + 1900; var qstn = "On what date does the Roman paschal full moon occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (moondates[j] != crctAns) { fakeans[j] = moondates[j]; } else { fakeans[j] = null; }; j++; } while (j < moondates.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); var date = new Date(numA, mnth, eadate); var day = date.getDay(); eadate = eadate + (7 - day); var crctAns = ""; if (eadate > 31) { eadate = eadate - 31; mnth = 3; } if (mnth == 2) { crctAns = "March "; } else { crctAns = "April "; } crctAns = crctAns + eadate.toString(); var qstn = "On what date does Roman Catholic Easter occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (easterdates[j] != crctAns) { fakeans[j] = easterdates[j]; } else { fakeans[j] = null; }; j++; } while (j < easterdates.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); rccalc = ((((numA) % 19) * 11) + 14) % 30; if (rccalc < 19) { crctAns = "April " + (19 - rccalc).toString(); } else { crctAns = "March " + (50 - rccalc).toString(); } var qstn = "On what Julian date does the Orthodox paschal full moon occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (moondates1[j] != crctAns) { fakeans[j] = moondates1[j]; } else { fakeans[j] = null; }; j++; } while (j < moondates1.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); if (rccalc > 1) { crctAns = "April " + (32 - rccalc).toString(); } else { crctAns = "May 1"; } var qstn = "On what Gregorian date does the Orthodox paschal full moon occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (moondates2[j] != crctAns) { fakeans[j] = moondates2[j]; } else { fakeans[j] = null; }; j++; } while (j < moondates2.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); var options = { title: "Full Moon (Orthodox): 1900 to 2099", numOfQuizQues: 4, quizType: "multi", allRandom: false, random: false }; $("#quizarea").jQuizMe(quiz, options); }; function easter2quiz() { var quiz = []; var maxValue = 200; var numA = ranom(maxValue); var rccalc = ((((numA) % 19) * 11) + 5) % 30; if ((((numA) % 19) == 5) || (((numA) % 19) == 16)) { rccalc = rccalc + 1; } if (rccalc < 19) { var mnth = 3; var eadate = 19 - rccalc; crctAns = "April " + (19 - rccalc).toString(); } else { var mnth = 2; var eadate = 50 - rccalc; crctAns = "March " + (50 - rccalc).toString(); } numA = numA + 1900; var qstn = "On what date does the Roman Catholic paschal full moon occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (moondates[j] != crctAns) { fakeans[j] = moondates[j]; } else { fakeans[j] = null; }; j++; } while (j < moondates.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); var date = new Date(numA, mnth, eadate); var day = date.getDay(); eadate = eadate + (7 - day); var crctAns = ""; if (eadate > 31) { eadate = eadate - 31; mnth = 3; } if (mnth == 2) { crctAns = "March "; } else { crctAns = "April "; } crctAns = crctAns + eadate.toString(); var qstn = "On what date does Roman Catholic Easter occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (easterdates[j] != crctAns) { fakeans[j] = easterdates[j]; } else { fakeans[j] = null; }; j++; } while (j < easterdates.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); rccalc = ((((numA) % 19) * 11) + 14) % 30; if (rccalc < 19) { crctAns = "April " + (19 - rccalc).toString(); } else { crctAns = "March " + (50 - rccalc).toString(); } var qstn = "On what Julian date does the Orthodox paschal full moon occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (moondates1[j] != crctAns) { fakeans[j] = moondates1[j]; } else { fakeans[j] = null; }; j++; } while (j < moondates1.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); if (rccalc > 1) { crctAns = "April " + (32 - rccalc).toString(); } else { crctAns = "May 1"; } var qstn = "On what Gregorian date does the Orthodox paschal full moon occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (moondates2[j] != crctAns) { fakeans[j] = moondates2[j]; } else { fakeans[j] = null; }; j++; } while (j < moondates2.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); rccalc = ((((numA) % 19) * 11) + 14) % 30; if (rccalc > 1) { var mnth = 3; var eadate = 32 - rccalc; moon = "Apr " + (32 - rccalc).toString(); } else { var mnth = 4; var eadate = 1; moon = "May 1"; } var date = new Date(numA, mnth, eadate); var day = date.getDay(); eadate = eadate + (7 - day); var crctAns = ""; if (eadate > 30) { eadate = eadate - 30; mnth = 4; } if (mnth == 3) { crctAns = "April "; } else { crctAns = "May "; } crctAns = crctAns + eadate.toString(); var qstn = "On what date does the Orthodox Easter occur in the year " + numA.toString() + "?"; var optns = ""; var fakeans = []; var j = 0; do { if (easterdates2[j] != crctAns) { fakeans[j] = easterdates2[j]; } else { fakeans[j] = null; }; j++; } while (j < easterdates.length); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); var options = { title: "Orthodox Easter: 1900 to 2099", numOfQuizQues: 5, quizType: "multi", allRandom: false, random: false }; $("#quizarea").jQuizMe(quiz, options); }; //]]></script>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com3tag:blogger.com,1999:blog-2800835365312821409.post-82496375535025877192014-08-24T09:00:00.000-07:002014-08-24T09:02:47.407-07:00Easter Date For A Given Year<ul id="tabs"><span id="fullpost"><li><a id=“cm1" href="#eaintro" class="s">Intro</a></li><li><a id=“cm2" href="#easter" class="s">Easter</a></li><li><a id=“cm3" href="#eapresent" class="s">Presenting</a></li><li><a id=“cm3" href="#eaortho" class="s">Orthodox</a></li><li><a id=“cm3" href="#eaother" class="l">Other Centuries</a></li></span></ul><div class="panes"><div><h3>Introduction</h3>Regardless of your particular religious faith, working out the date of Easter in your head for a given year can be an impressive feat.<br /><br />It's well known that the date for Easter moves around quite a bit, and many people aren't even sure exactly how the Easter date is determined. Despite the rules, it is still possible to mentally calculate the date for a given year.<br /><h3><span id="fullpost"><br />The Rules</span></h3><span id="fullpost">Easter is defined as the first Sunday after the first full moon after the first day of spring in a given year.<br /><br />It's important to note that, while the official rules for calculating the date for Easter in a given year involve the full moon date and the first day of spring, these are not necessarily tied to the astronomical definitions.<br /><br />For example, depending on the year, the first day of spring can happen on March 20th or March 21st. For the purposes of Easter calculation, however, the first day of spring is <i>always</i> considered to be March 21st. The first full moon after the first day of spring, then, must always happen <i>after</i> March 21st.<br /><br />This may seem like a small detail, but it is important to understand the difference between this and the astronomical definition. For example, <a href="http://www.wolframalpha.com/input/?i=2038+first+day+of+spring">in 2038, the first day of spring will happen on March 20th</a>, and the <a href="http://www.wolframalpha.com/input/?i=March+21+2038+moon+phase">next full moon will happen the next day, on March 21st</a>. This full moon doesn't count for Easter calculation, though, because March 21st is always considered to be the first day of spring, so it's the first full moon <i>after</i> that date that is considered.<br /><br />Finally, if the full moon occurs on a Sunday, then that Sunday is not considered to be Easter, but rather the following Sunday.<br /><br />So, to sum up the rules for Easter, it falls on the first Sunday <i>after</i> the first full moon <i>after</i> March 21st, the first day of spring. Yes, this is why the Easter date varies so widely from year to year.<br /><br /><h3>Getting Started</h3>Despite the complexity of these rules, the calculation is still feasible to perform mentally, thank largely to the work of <a href="http://www.math.princeton.edu/directory/john-conway">John Conway</a>, whose <a href="http://headinside.blogspot.com/p/search-results.html?q=John+Conway">contributions to mathematics I've noted many times on this blog</a>. This tutorial is adapted from his instructions in <a href="http://www.amazon.com/gp/product/1568811446/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=1568811446&linkCode=as2&tag=greymatt-20&linkId=JOEFJDBCSSWWGL2C">“Winning Ways for Your Mathematical Plays, Volume 4”</a>.<br /><br />First, you do need to be able to perform some version of a calendar calculation. Here on Grey Matters, you can find my <a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation.html#cmintro"><i>Quick Calendar Month Creation</i></a> and the <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-revised.html#ndatebasics"><i>Day of the Week For Any Date (Revised)</i></a> tutorials. Elsewhere, <a href="http://rudy.ca/doomsday.html">this Doomsday algorithm tutorial</a>, <a href="http://firstsundaydoomsday.blogspot.com/2009/12/quick-start-guide.html">this first Sunday Doomsday variation</a>, and <a href="http://www.lybrary.com/day-one-p-137029.html">my commercial <i>Day One</i> notes</a> will also work.<br /><br />You'll need to be able to calculate given dates to determine the day of the week on which a given date falls, so that you'll know when the next Sunday occurs.<br /><br />You should also be familiar with the <a href="http://gmmentalgym.blogspot.com/2013/01/moon-phase-for-any-date.html#mpbasics">basics of moon phases</a> and the <a href="http://gmmentalgym.blogspot.com/2013/01/moon-phase-for-any-date.html#mpwhy">importance of the various numbers in moon calculations</a>. You don't need to be able to calculate the moon phase for a given date; it's more important that you reasons for the numbers.<br /><br />If you're up to speed on that, then you're ready to <a href="#easter" class="jumpup">begin learning how to calculate the Easter date for a given year</a>!</span><br /></div><div><h3>Easter Calculations</h3>Since the first day of spring is always considered to be March 21st, the first full moon must happen by April 19th. The first step in Easter calculations, then, is working out how many days before April 19th the full moon occurs.<br /><br />The only information you need to start is the year in question. For this part of the tutorial, we'll assume that you're working with a year from 1900 to 2099. Since <a href="http://gmmentalgym.blogspot.com/2013/01/moon-phase-for-any-date.html#mpwhy">the moon has a 19-year cycle</a>, you begin by finding out where it is in that 19-year cycle. First, you simply subtract 1900 from the year. Next, <a href="http://www.wolframalpha.com/input/?i=table%5B19x%2C+%7Bx%2C+0%2C+11%7D%5D">assuming you known your multiples of 19</a>, you will subtract the largest multiple of 19 equal to or less than this number.<br /><br />For example, let's say you're given the year 1988. The first step is easy: 1988 - 1900 = 88. Next, you subtract the largest multiple of 19 which is equal to or less than 88. In this case, that happens to be 76, so 88 - 76 = 12. In other words, 1988 is 12 years into the <a href="http://en.wikipedia.org/wiki/Metonic_cycle">moon's 19-year Metonic cycle</a>.<br /><br />The next step is to take this result, and multiply it by 11. If you're worried about multiplying by 11 in your head, you can pick this skill up quickly:<br /><br /><iframe width="530" height="298" src="//www.youtube.com/embed/v4aeupzqvTw?rel=0" frameborder="0" allowfullscreen></iframe><br /><br />The best part is that the only 2-digit numbers you'll have to deal with in this feat are 10 through 18, so you'll never have to worry about carrying that 1!<br /><br />After multiplying the number by 11, there are just 2 more steps: Add 5, and then subtract the largest multiple of 30 (due to the <a href="http://gmmentalgym.blogspot.com/2013/01/moon-phase-for-any-date.html#mpwhy">moon's roughly 30-day cycle</a>) that is equal to or less than this current total.<br /><br />Returning to our 1988 example, you'll remember we reduced that to 12. 12 × 11 = 132, and 132 + 5 = 137. The largest multiple of 30 that is equal to or less than 137 is 120, so we subtract 137 - 120 = 17.<br /><br />The result you get at the end of this process is the number of days before April 19th. In our 1988 example, our result of 17 means that the first full moon after the first day of spring falls on April 2nd (because April 19th - 17 days = April 2nd).<br /><br />What happens if you get a number of 19 or more? In that case, you think of April 19th as being the same as the imaginary date of “March 50th” So, if you came up with a total of 24, for example, you'd think of March 50th - 24 days = March 26th.<br /><br />As you'll only need to work with the numbers 0 through 18, <a href="http://www.wolframalpha.com/input/?i=table%5B%28%2811n+%2B+5%29+mod+30%29%2C+%7Bn%2C+0%2C+18%7D%5D">here's all the possible answers you can get by working through the above calculations</a>.<br /><br /><b>EXCEPTIONS</b><br /><br />There are 2 small exceptions. If you begin with a total of 5, you'll get a result of 0, which suggests that the first full moon after the first day of spring is April 19th (0 days before April 19th). You need to make a correcting by moving 1 day back to April 18th, in this case.<br /><br />The other special case is when you have a total of 16, which gives a result of 1, which suggests that the date is April 18th (1 day before April 19th). This one is also incorrect, and has the same solution; you move 1 more day back to April 17th.<br /><br />To become comfortable with the full moon calculations before proceeding, <a href="http://gmmentalgym.blogspot.com/2014/08/easter-date-for-given-year-quiz.html">go over to the <i>Easter Date For A Given Year Quiz</i></a>, and click on the <i>Full Moon Date</i> button in the <i>Roman Catholic Easter, 1900-2099</i> section.<br /><h3>Full Moon to Easter</h3>This is the point at which you'll need to be comfortable with some version of the Day of the Week For Any Date feat, <a href="#eaintro" class="jumpup">as I mentioned in the previous tab</a>.<br /><br />Obviously, you'll need to work out the day of the week of date you determined in the previous step. In our 1988 example, we worked out that the first full moon after the first day of spring occurred on April 2nd, 1988. If you know your calendar calculations, you'll be able to work out that this was a Saturday. Obviously, the first Sunday after this date, and therefore Easter, is the very next day, April 3rd, 1988.<br /><br />One important note at this point: If the full moon date occurs on a Sunday itself, then Easter is the <i>following</i> Sunday.<br /><br />As another example that will help highlight a few key points, let's work out the date of Easter in 1994. 1994 - 1900 = 94. Subtracting the largest multiple of 19 equal to or less than than gives us 94 - 76 = 18.<br /><br />Continuing the calculation, we have 18 × 11 = 198, and 198 + 5 = 203. Casting out the largest multiple of 30 from 203 gives us 203 - 180 = 23. 23 days before April 19th, or rather March 50th in this case, is March 27th (March 50th - 23 days = March 27th).<br /><br />You then work out that March 27th, 1994 is a Sunday. That means that the following Sunday is Easter. March 27th plus 7 days is April 3rd (March 27th + 7 days = March 34th, minus 31 days in March, gives you April 3rd).<br /><br />We can check the answer with Wolfram|Alpha, which <a href="http://www.wolframalpha.com/input/?i=Easter+1994">confirms that Easter in 1994 did occur on April 3rd</a>!<br /><br />At this point, you should practice what you've learned over <a href="http://gmmentalgym.blogspot.com/2014/08/easter-date-for-given-year-quiz.html">in the quiz section</a>. Click on the <i>Full Moon and Easter Dates</i> button in the <i>Roman Catholic Easter, 1900-2099</i> section to become comfortable calculating the full moon and Easter dates together.<br /><br />Once you get comfortable with the calculations, it's time to <a href="#eapresent" class="jumpup">learn a few tips on presenting this feat</a> before others.<br /><br /></div><div><h3>Presentation</h3>The simplest way to start is by asking for the year. Since you have to know some version of the day of the week for any date feat, you can likely use this information to say something about the year. For example, in my <a href="http://www.lybrary.com/day-one-p-137029.html"><i>Day One</i> routine</a>, you can instantly give the days of the week for Christmas and Halloween that year, as well as which months in that year will have a Friday the 13th.<br /><br />Such lead-in information given instantly makes a good introduction to calendar feats, but isn't absolutely necessary. In versions of the date feat such as the Doomsday algorithm, which give you a key day for the year, this information can be helpful to work out in advance of the Easter calculations.<br /><br />You can go directly into the Easter feat, as well. The trick to presenting the Easter calculation before an audience, however, is talking through the major steps while you do the mental calculations.<br /><br />For example, let's say someone gives you the year 1982. Doing a quick mental subtraction of 82 - 76 (do you remember why?), you get an answer of 6, and can immediately say, “In 1982, the moon was 6 years into its 19-year <a href="http://en.wikipedia.org/wiki/Metonic_cycle">Metonic cycle</a>...” As you say that sentence, you can then quickly multiply 6 by 11, getting 66, add 5 to get 71, and subtract 71 - 60 to get 11. Since you know you need to subtract this number from April 19th/March 50th, you can quickly finish by saying, “...which means that April 8th was the date of the first full moon after the first day of spring.”<br /><br />Already, this feat should seem impressive to the audience. At this point, as you already know, you'll have to work out the day of the week for April 8th, 1982 in your head. In this particular case, you should be able to say, “Now, April 8th, 1982, was a Thursday, so the following Sunday was only 3 days later, on April 11th, which makes that the date of Easter in 1982!”<br /><br />Have your audience <a href="http://www.wolframalpha.com/input/?i=Easter+1982">verify the date of Easter in 1982 with Wolfram|Alpha</a>, or a similar source, and they should be suitably impressed!. At that point, you've done the whole Easter feat in front of the audience.<br /><h3>Tips</h3>• Working through the equations while talking is a bit of a challenge, but with practice, it's not that difficult.<br /><br />• If you can master a day of the week for any date feat, this Easter feat, and <a href="http://gmmentalgym.blogspot.com/2013/01/moon-phase-for-any-date.html#mpbasics">giving the phase of the moon for any date</a>, you'll have enough material for a human calendar routine!<br /><br />• The method you've learned is actually the way to calculate the date for the Roman Catholic Easter. There's an alternative calculation for what's known as Orthodox Easter, celebrated primarily by Greek Orthodox and Russian Orthodox churches, and can sometimes fall on a different date. Once you've mastered the basic calculation, you can <a href="#eaortho" class="jumpup">learn how to calculate the date for Orthodox Easter here</a>.<br /></div><div><h3>Orthodox Easter</h3>Easter has been around longer than the <a href="http://www.timeanddate.com/calendar/gregorian-calendar.html">Gregorian calendar</a>, of course, so the original calculations were done using the <a href="http://www.timeanddate.com/calendar/julian-calendar.html">Julian calendar</a>. Some churches, such as the Russian and Greek Orthodox churches, still use the Julian calendar in their Easter date calculations. This means that the date for Orthodox Easter can sometimes be a different date entirely than the Roman Catholic Easter, sometimes as much as a month apart!<br /><br />Fortunately, if you can work through the original Easter calculations, calculating the Orthodox Easter date isn't that much different.<br /><br />To calculate Orthodox Easter, you don't have to start over again. For example, returning to <a href="#eapresent" class="jumpup">our 1982 example from the Presentation tab</a>, you start by recalling that you calculated the full moon date as 11 days before April 19th/March 50th.<br /><br />To this number, you need to add 9. Sometimes, this will give you a number larger than 30, in which case you need to subtract 30 from that number. You can then give this new date as the date of the first full moon after the first day of spring in the Julian calendar.<br /><br />Continuing with our 1982 example, then, you'd add 11 + 9 to get 20, and work out that April 19th/March 50th minus 20 days is March 30th, which is the date of the first full moon after the first day of spring in 1982 is March 30th <i>in the Julian calendar</i>.<br /><br />To adjust this date to the currently-used Gregorian calendar, you need to add 13 days. The best way to think of this when starting with a date in March is to just add 13, giving the ridiculous date of March 43rd, and then subtract 31 (since March has 31 days), giving April 12th as the Gregorian date of the first full moon after the first day of spring by the standards of the Orthodox Church.<br /><br />You can <a href="http://gmmentalgym.blogspot.com/2014/08/easter-date-for-given-year-quiz.html">quiz yourself on the Orthodox Julian and Gregorian full moon dates</a> by clicking on the <i>Full Moon Dates</i> button in the <i>Orthodox Easter, 1900-2099</i> section. Because you need to work out the Roman Catholic full moon and Easter dates first, the quiz will ask you about those before asking about the Orthodox Julian and Gregorian full moon dates.<br /><br />To find the next Sunday after that is also simple. In our 1982 example, you worked out that the Roman Catholic Easter fell on April 11th. Obviously, April 12th is after that, so the Orthodox Easter that year must fall on the next Sunday, which is April 18th. Clicking on the <a href="http://www.wolframalpha.com/input/?i=Easter+1982&a=*C.Easter-_*Holiday.dflt-&a=*DPClash.HolidayE.Easter-_**OrthodoxEaster.Christianity--"><i>Orthodox Easter Sunday (Christianity)</i> button</a>, your audience can verify that April 18th, 1992 is indeed the date of the Orthodox Easter.<br /><br />Notice how the use of earlier calculations helps simplify the calculations for the Orthodox Easter, while calculating an entirely different Easter date with a different calendar seems much harder and more impressive to your audience!<br /><br />You can <a href="http://gmmentalgym.blogspot.com/2014/08/easter-date-for-given-year-quiz.html">practice the full feat in the quiz section</a> using the <i>Full Moon and Easter Dates</i> button in the <i>Orthodox Easter, 1900-2099</i> section. As with the above quiz, you'll be asked about the Roman Catholic full moon and Easter dates first, as you'll need those to make the Orthodox calculations.<br /><h3>Presentation</h3>After giving the Roman Catholic Easter date for a given year, you can point out that there's also an Orthodox Easter date, and that it always isn't the same. If they've <a href="http://www.wolframalpha.com/input/?i=Easter+1982">verified your given Easter date with Wolfram|Alpha</a>, you can draw your audience's attention to the fact that Wolfram|Alpha has a little blurb that reads, “Assuming Easter Sunday (Christianity) | Use Orthodox Easter Sunday (Christianity) instead”. Explain to your audience that the Orthodox churches use an older calendar, as opposed to the currently-used one.<br /><br />Recalling your original calculations for the number of days before April 19th/March 50th, you mentally add 9, subtract 30 if needed, and give this new date (March 30th, in our above 1982 example) as the old-style calendar date for the date of the first full moon after the first day of spring.<br /><br />Next, mentally add 13 days, subtracting 31 if needed, and give this date (April 12th in our above 1982 example) as the new-style calendar date as the date of the first full moon after the first day of spring.<br /><br />Finally, work out the date of the following Sunday (April 18th in our above 1982 example) and give that as the Orthodox Easter date. As always, have your audience verify this date for themselves.<br /><h3>Tips</h3>• Similar rules apply to both the Roman Catholic and Orthodox Easter dates. Especially important is the rule that, if a full moon date falls on a Sunday, then it's the <i>following</i> Sunday on which Easter falls.<br /><br />• Recall from the <a href="#easter" class="jumpup"><i>Easter</i> tab</a> that some dates require adjustments in which you move 1 day back. When returning to the full moon date calculation, you want to add 9 to the <i>unadjusted</i> number of days. For example, 1981 is 5 (81 - 76) years into the Metonic cycle, which results in a total of 0 days before April 19th/March 50th, but you have to adjust 1 day back. When you do the Orthodox calculation, you still want to start with 0 (the unadjusted amount), instead of 1 (the adjusted amount), and add 9 (0 + 9 = 9).<br /><br />• Being able to calculate both the Roman Catholic and Orthodox Easter dates from 1900 to 2099 is quite an impressive feat. If you're curious about other years, you can <a href="#eaother" class="jumpup">learn how to handle other centuries</a> in the next tab!<br /></div><div><h3>Other Centuries</h3>Due to all the calculations involved, the easiest thing to do is to stay within the 1900 to 2099 range, as you've already learned. However, if you do wish to calculate Easter for other centuries, this section will give you the tools you'll need.<br /><h3>The 2100s</h3>The easiest extension of the Easter feat is to calculate Easter in the 2100s. As long as you can adjust your favorite day of the week for any date feat for dates in the 2100s, you can calculate Easter dates without any other changes!<br /><h3>Roman Catholic Easter Dates: 1500s through 3000s</h3>The <a href="http://www.timeanddate.com/calendar/gregorian-calendar.html">Gregorian calendar</a> was first used in late 1582, so the Roman Catholic Easter date can only be calculated for years going back to 1583.<br /><br />In the standard version you've learned, you start by subtracting 1900, and then subtracting multiples of 19 in order to learn how far the moon is into its <a href="http://en.wikipedia.org/wiki/Metonic_cycle">19-year Metonic cycle</a>. For the following years, you can start by use the corresponding amounts below:<br /><ul><li>1583 to 1709: subtract 1520</li><li>1710 to 1899: subtract 1710</li><li>2100 to 2279: subtract 2090</li><li>2280 to 2469: subtract 2280</li><li>2470 to 2659: subtract 2470</li><li>2660 to 2849: subtract 2660</li><li>2850 to 3039: subtract 2850</li><li>3040 to 3099: subtract 3040</li></ul>Subtracting these amounts can be made easier by subtracting the hundreds amount, followed by the tens. For example, subtracting 2280 can be done by subtracting 2200 and then subtracting 80. From this point, you reduce the year by multiples of 19 as you learned previously.<br /><br />The next steps involve multiplying that amount by 11, and then adding 5. Adding 5, however, only works if you're dealing with the 1900s, 2000s, or 2100s. You'll need a different offset for other centuries. The following widget will calculate the required offset for centuries from the 1500s to the 3000s:<br /><script type="text/javascript" id="WolframAlphaScript21deee0ad7e36601550f3e29f2b942c4" src="http://www.wolframalpha.com/widget/widget.jsp?id=21deee0ad7e36601550f3e29f2b942c4"></script><br />The answer you get will be in the form of x = some number and y = some number. x is the first two digits of the century, such as 20 for the 2000s, and y is the offset you'll need to add for years in the given century. For example, if you select the 2300s, you'll get the answer x=23, y=3. This simply means that for years beginning with 23 (x), you'll need to add 3 (y).<br /><br />Naturally, you shouldn't forget to adjust your day of the week for any date feat calculations for the same centuries.<br /><h3>Orthodox Easter Dates: 1500s through 3000s</h3>Determining how far the moon is into its Metonic cycle is done just as in the previous section. When working in the 1900s and 2000s (and 2100s!), you normally need to add 9 to adjust for the Orthodox date (and subtract 30, if needed).<br /><br />For other centuries, you may need different numbers. The widget below can calculate the required offsets for any given century:<br /><script type="text/javascript" id="WolframAlphaScript8161fa04a231a2c068eb5a9b911a0326" src="http://www.wolframalpha.com/widget/widget.jsp?id=8161fa04a231a2c068eb5a9b911a0326"></script><br />Similar to the above widget, x represents the first 2 digits of the request century, y is the adjustment for the Julian date, and z is the number of days you need to move ahead to get the Gregorian date.<br /><br />If you select the 2000s, you'll get 3 very familiar numbers: x=20, y=9, z=13. If you've practiced the Orthodox feat, you'll recall that, for years beginning with 20 (x), you need to add 9 (y) more days (subtracting 30, if needed) back from the Roman Catholic full moon to get the Julian date for the Orthodox full moon. You then need to go 13 (z) days forward to get the equivalent Gregorian calendar date.<br /><br />If you want to work with the 2300s instead, just select 2300s in the pop-up menu, click the <i>Submit</i> button, and you'll get a result of x=23, y=11, z=16. This means that for any year beginning with 23 (x), you'll need to move back 11 (y) more days from April 19th/March 50th to adjust for the Julian calendar date (remembering to subtract 30, if needed). 16 (z) is the number of days you'll need to move forward from the Julian date to get the corresponding Gregorian date.<br /><br />You can even calculate the Gregorian offset (z) in your head, if need be. To learn how to do that, read <a href="http://headinside.blogspot.com/2013/05/changing-calendars-mentally.html">my <i>Changing Calendars Mentally</i> post</a>.<br /><br />Practice this feat, and you'll have an unusual mental feat ready to astound almost any audience! If you have any questions or comments, please include them in the comments section below.<br /></div></div><script>//<![CDATA[ //]]></script>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com5tag:blogger.com,1999:blog-2800835365312821409.post-55172024897934522542014-05-25T07:45:00.001-07:002014-05-25T07:47:48.304-07:00Quick Calendar Month Creation Quiz<span id="fullpost"><a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation.html">Learn to perform the Quick Calendar Month Creation feat here</a>.<br /><br />Quiz will appear below:</span><br /><div id="quizarea"></div><span id="fullpost"><br /><br /><a class="gmButton" onclick="cm2dykquiz()">2-Digit Year Key</a><br /><br /><a class="gmButton" onclick="cmfullkey()">Full Key 1700-2099</a><br /><br /><a class="gmButton" onclick="cmmnthdy()">Month and Day Association</a><br /><br /><a class="gmButton" href="https://dl.dropboxusercontent.com/u/23420016/QuickCalendarMonthQuiz.html" target="_blank">Calendar Quiz</a><br /><i><b>Note:</b> The Calendar Quiz opens full screen in a new window. Instructions on how to use it can be found in the <a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation.html#cmcalend">Calendar Tab of the Quick Calendar Month Creation tutorial</a>, in the Practice Creating Calendars section.</i><br /></span><br /><script type='text/javascript'>//<![CDATA[ function random(maxValue) { day = new Date(); hour = day.getHours(); min = day.getMinutes(); sec = day.getSeconds(); mili = day.getTime() return (((hour * 3600) + (min * 60) + (sec) + mili) % maxValue); } function ranom(maxValue) { return (Math.floor(Math.random() * maxValue)); } function cm2dykquiz() { var quiz = [{ ques: "What's the year key for 00?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 01?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 02?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 03?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 04?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 05?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 06?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 07?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 08?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 09?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 10?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 11?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 12?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 13?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 14?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 15?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 16?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 17?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 18?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 19?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 20?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 21?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 22?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 23?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 24?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 25?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 26?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 27?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 28?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 29?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 30?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 31?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 32?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 33?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 34?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 35?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 36?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 37?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 38?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 39?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 40?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 41?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 42?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 43?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 44?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 45?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 46?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 47?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 48?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 49?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 50?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 51?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 52?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 53?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 54?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 55?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 56?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 57?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 58?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 59?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 60?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 61?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 62?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 63?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 64?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 65?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 66?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 67?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 68?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 69?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 70?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 71?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 72?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 73?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 74?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 75?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 76?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 77?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 78?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 79?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 80?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 81?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 82?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 83?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 84?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 85?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 86?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 87?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 88?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 89?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 90?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 91?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 92?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 93?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year key for 94?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year key for 95?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year key for 96?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year key for 97?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year key for 98?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year key for 99?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }]; var options = { title: "2-Digit Year Key", numOfQuizQues: 10, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function cmfullkey() { var quiz = []; for (var i = 0; i < 10; i++) { var maxValue = 400; var numA = ranom(maxValue); numA = numA + 1700; var yr = numA % 100; var cntry = Math.floor(numA / 100); var key = (2*(Math.floor(yr/4))) - (yr % 4); switch (cntry) { case 18: key = (key + 2) % 7; break; case 19: key = (key + 4) % 7; break; case 20: key = (key + 5) % 7; break; default: key = key % 7; break; }; var qstn = "What's the key for the year " + numA.toString() + "?"; var crctAns = key.toString(); var optns = ""; var fakeans = []; var j = 0; do { if (j != key) { fakeans[j] = j.toString(); } else { fakeans[j] = null; }; j++; } while (j < 7); quiz.push({ "ques": qstn, "ans": crctAns, "ansSel": fakeans }); }; var options = { title: "Full Key: 1700 to 2099", numOfQuizQues: 10, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function cmmnthdy() { var quiz = [{ ques: "What day is associated with January? (non-leap year)", ans: "Thursday", ansSel: ["Sunday","Monday","Tuesday","Wednesday",null,"Friday","Saturday"], ansInfo: "Remember: Jan’s and October’s 31..." }, { ques: "What day is associated with February? (non-leap year)", ans: "Sunday", ansSel: [null,"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"], ansInfo: "Remember: February, March, and November..." }, { ques: "What day is associated with January? (leap year)", ans: "Wednesday", ansSel: ["Sunday","Monday","Tuesday",null,"Thursday","Friday","Saturday"], ansInfo: "Remember: In leap years, January moves back 1 day." }, { ques: "What day is associated with February? (leap year)", ans: "Saturday", ansSel: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday",null], ansInfo: "Remember: In leap years, February moves back 1 day." }, { ques: "What day is associated with March?", ans: "Sunday", ansSel: [null,"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"], ansInfo: "Remember: February, March, and November..." }, { ques: "What day is associated with April?", ans: "Wednesday", ansSel: ["Sunday","Monday","Tuesday",null,"Thursday","Friday","Saturday"], ansInfo: "Remember: Winds in April, Winds in July..." }, { ques: "What day is associated with May?", ans: "Friday", ansSel: ["Sunday","Monday","Tuesday","Wednesday","Thursday",null,"Saturday"], ansInfo: "Remember: Month 5 is May..." }, { ques: "What day is associated with June?", ans: "Monday", ansSel: ["Sunday",null,"Tuesday","Wednesday","Thursday","Friday","Saturday"], ansInfo: "Remember: June day..." }, { ques: "What day is associated with July?", ans: "Wednesday", ansSel: ["Sunday","Monday","Tuesday",null,"Thursday","Friday","Saturday"], ansInfo: "Remember: Winds in April, Winds in July..." }, { ques: "What day is associated with August?", ans: "Saturday", ansSel: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday",null], ansInfo: "Remember: August’s few holidays make you yearn..." }, { ques: "What day is associated with September?", ans: "Tuesday", ansSel: ["Sunday","Monday",null,"Wednesday","Thursday","Friday","Saturday"], ansInfo: "Remember: A skeptic needs clues..." }, { ques: "What day is associated with October?", ans: "Thursday", ansSel: ["Sunday","Monday","Tuesday","Wednesday",null,"Friday","Saturday"], ansInfo: "Remember: Jan’s and October’s 31..." }, { ques: "What day is associated with November?", ans: "Sunday", ansSel: [null,"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"], ansInfo: "Remember: February, March, and November..." }, { ques: "What day is associated with December?", ans: "Tuesday", ansSel: ["Sunday","Monday",null,"Wednesday","Thursday","Friday","Saturday"], ansInfo: "Remember: A skeptic needs clues..." }]; var options = { title: "Month and Day Association", numOfQuizQues: 14, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; //]]></script>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com3tag:blogger.com,1999:blog-2800835365312821409.post-86155541669013805062014-05-25T07:45:00.000-07:002014-05-26T19:37:31.141-07:00Quick Calendar Month Creation<ul id="tabs"><span id="fullpost"><li><a id=“cm1" href="#cmintro" class="s">Intro</a></li><li><a id=“cm2" href="#cmyrcnt" class="s">Year/Cent.</a></li><li><a id=“cm3" href="#cmmonth" class="s">Months</a></li><li><a id=“cm4" href="#cmcalend" class="s">Calendar</a></li><li><a id=“cm5" href="#cmjulbc" class="s">Julian & BC</a></li><li><a id=“cm6" href="#cmtips" class="s">Tips</a></li></span></ul><div class="panes"><div><h3>Introduction</h3>I have a fascination with the <a href="http://headinside.blogspot.com/search/label/calendar">day of the week for any date feat</a>. I've posted <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-revised.html#ndatebasics">a detailed tutorial for it here in the Mental Gym</a>, and I've also released a <a href="http://www.lybrary.com/day-one-p-137029.html">commercially available version called <i>Day One</i></a>.<br /><br />My fascination is two-fold: How simple can it be made? How powerful can it be made? After researching several methods, many obscure even to those who enjoy calendar calculating, I've managed to merge two astounding versions that bring together the best combination of power and simplicity I've ever run across.<br /><h3><span id="fullpost"><br />Effect</span></h3><span id="fullpost">You start by bringing out a business card with this calendar design:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/month_calendar_blank_zpsa5e941c7.png" style="margin-left:auto;margin-right:auto;" /><br /><br />You then ask someone for the year, and then the month, of their birthday. With no further questions, you're instantly able to fill in the calendar for that month and year. For example, if the person said they were born in 1979 in September, you could quickly fill in the calendar from memory like this:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/month_calendar_sep_79_zps36ab4043.png" style="margin-left:auto;margin-right:auto;" /><br /><br />They can verify your calendar with any outside source, <a href="http://www.wolframalpha.com/input/?i=September+1979+calendar">such as Wolfram|Alpha</a>, and see that the calendar you created from memory is 100% accurate!<br /><br />In addition, you'll even learn to handle <a href="http://www.timeanddate.com/calendar/julian-calendar.html">Julian calendar dates</a> all the way back to 45 B.C. almost as easily as our modern <a href="http://www.timeanddate.com/calendar/gregorian-calendar.html">Gregorian calendar dates</a>!<br /><br />Even if you've become frustrated trying to master other day of the day of the week for any date formulas, I think you'll like the simplicity and flexibility of this version. You can <a href="#cmyrcnt" class="jumpup">start learning the method in the next tab</a>!</span><br /></div><div><h3>Year Key</h3>With this method, you ask for the year first, and you're going to calculate a date from it, ranging from 0 to 6.<br /><br />In many methods, calculating a number from the year is the biggest hurdle, both because of the number of calculations involved, and the fact that many calculations involve increasing the amount represented by the year. In this method, however, the steps are few, and the method always involves making the year number smaller.<br /><br />When given a year, the first thing you need to do is to break it up into the last 2 digits, which will be referred to as the year from here on out, and the remaining digits, which will be referred to as the century. For exam, if you're given the year 1975, you would think of 75 as the year and 19 as the century.<br /><br />First, I'll explain the calculations to perform on the 2-digit year, and then I'll explain how to handle the century.<br /><br /><b>Step 1 - <a href="http://en.wikipedia.org/wiki/Partition_(number_theory)">Partition</a>:</b> Split the 2-digit year into a sum, consisting of the largest multiple of 4 equal to or less than the given year, plus a remainder of 1, 2, or 3, if needed.<br /><br /><i>Example:</i> 75 is split into 72 + 3. 72 is the largest number equal to or less than 75, and 3 is the remainder needed to make it a sum that totals 75.<br /><br /><b>Step 2 - Modify & solve:</b> Divide the multiple of 4 by 2, and change the plus sign to a minus sign. Once you've modified the problem, the next step is to solve it.<br /><br /><i>Example:</i> 72 (from 72 + 3 above) ÷ 2 = 36, so 72 + 3 becomes 36 - 3. Solving this, we get 36 - 3 = 33.<br /><br /><b>Step 3 - Cast out 7s:</b> From the total in the previous step, subtract the largest multiple of 7 equal to or less than the total. For the reasoning behind this step, see the <a href="http://headinside.blogspot.com/2011/08/day-for-any-date-online-toolbox.html">Modular Arithmetic section of my <i>Day for any Date Online Toolbox</i> post</a>.<br /><br /><i>Example:</i> The largest multiple of 7 equal to or less than 33 is 28, so we subtract 33 - 28 to get 5.<br /><br />This may seem like a lot of work at first, but it can be done surprisingly quickly, once you become familiar with it.<br /><br />Below is a simple widget to show you how this is done with various years. Simply select the first digit of the 2-digit year with the left menu, and the second digit with the right menu. You'll automatically see how the calculations below are affected by each change.<br /><br /><table><tr> <td><select id="decade"><br /><option value="0">0</option><br /><option value="1">1</option><br /><option value="2">2</option><br /><option value="3">3</option><br /><option value="4">4</option><br /><option value="5">5</option><br /><option value="6">6</option><br /><option value="7" selected>7</option><br /><option value="8">8</option><br /><option value="9">9</option><br /></select></td> <td><select id="year"><br /><option value="0">0</option><br /><option value="1">1</option><br /><option value="2">2</option><br /><option value="3">3</option><br /><option value="4">4</option><br /><option value="5" selected>5</option><br /><option value="6">6</option><br /><option value="7">7</option><br /><option value="8">8</option><br /><option value="9">9</option><br /></select></td> </tr></table><div id="yearcalcs"><ul><li id="ycstart">Starting year: 75</li><li id="ycpart">Partition: 72 + 3</li><li id="ycmod">Modify & solve: 36 - 3 = 33</li><li id="yccastout">Cast out 7s: 33 - 28 = 5</li></ul></div>Note that years which are evenly divisible by 4 are easy to calculate. You'll quickly learn that multiples of 4 allow you to skip the partitioning step, and go straight to dividing a single number by 2.<br /><br />Also, pay particular attention to the years 01, 02, 03, and 07. When these are partitioned, divided, and subtracted, they all result in negative numbers. In these few cases, you need to add 7 to make them positive. If you can remember that -1 + 7 = 6, -2 + 7 = 5, and -3 + 7 = 4, you can handle all of these situations.<br /><br />You can practice calculating this key in the <a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation-quiz.html">Quick Calendar Month Creation Quiz by clicking on the <i>2-Digit Year Key</i> button</a>.<br /><h3>Century Key</h3>The number you calculated from the year above will now be modified to take the century into account. Adjusting for the century only requires a little memory and a single addition.<br /><br />If the requested century is in the 1700s, you don't need to add anything. For the 1800s, you'll add 2 to your running total. For the 1900s, you'll add 4, and for the 2000s, you'll add 5. For years after that, the pattern repeats every 400 years:<br /><br /><table class="flexme"><thead><tr><th width="120" align="center">+ 0</th><th width="120" align="center">+ 2</th><th width="120" align="center">+ 4</th><th width="120" align="center">+ 5</th></tr></thead><tbody><tr><td>---</td><td>---</td><td>1500</td><td>1600</td></tr><tr><td>1700</td><td>1800</td><td>1900</td><td>2000</td></tr><tr><td>2100</td><td>2200</td><td>2300</td><td>2400</td></tr></tbody> </table><br />This table only goes back to 1500 because the calendar we currently use, <a href="ttp://www.timeanddate.com/calendar/gregorian-calendar.html">the Gregorian calendar</a>, was first adopted on October 15, 1582. In later lessons, you'll learn how to handle earlier dates.<br /><br />To help you recall the right number, remember the nonsense mnemonic, “No tuna for Friday”. <i>No</i> represents +0, <i>tuna</i> represents +2, <i>for</i> represents +4, and <i>Friday</i> represents +5, since Friday is the 5th and last day of the traditional 5-day Monday through Friday work week.<br /><br />How do you know which numbers go with which years? From right to left, they cover the 1700s, the 1800s, the 1900s, and the 2000s respectively. Bob Goddard (see <i>Credits & Notes</i> below) suggesting remembering that the mnemonics apply to the first 400 years of American history.<br /><br />Once you can recall which modification goes with which year, you simply add the appropriate number for the century. Don't forget to cast out 7s if you get a number that's 7 or larger.<br /><br />Going back to our 1975 example from above, we worked out a key number of 5 for 1975. To modify this number for the century, we add 4 for the 1900s, so 5 + 4 = 9. Casting out 7s, we subtract 9 - 7 = 2. So, 2 is our final key number for 1975.<br /><br />What about, say, 1776? 76 doesn't need to be partitioned, since it's a multiple of 4. 76 ÷ 2 = 38, and casting out 7s we get 38 - 35 = 3. Since the 1700s have a century modification of +0, we simply don't add anything, and leave the total as 3. So, the year key for 1776 is 3.<br /><h3>Next Step</h3>Practice calculating the full key over in the <a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation-quiz.html">Quick Calendar Month Creation Quiz by clicking on the <i>Full Key 1700-2099</i> button</a>. Ideally, you want to be able to run through the calculation process for a given year in about 5-6 seconds.<br /><br />Once you have this year key, what do you do with it? The next step is to take the key number you just calculated, and combine it with a particular month. <a href="#cmmonth" class="jumpup">You'll learn how to do that in the next tab</a>.<br /><h3>Credits & Notes</h3>The mathematical method for handling the 2-digit year comes directly from an article titled, “How to find the day of the week on which any particular date falls” by E. Rogent and <a href="http://www.geniimagazine.com/magicpedia/W._W._Durbin">W.W. Durbin</a> in the August 1927 issue of <a href="http://www.geniimagazine.com/magicpedia/Linking_Ring"><i>The Linking Ring</i></a>.<br /><br />The modification of the century, as well as the “No tuna for Friday” mnemonic, is from step 2 of <a href="http://firstsundaydoomsday.blogspot.com/2009/12/quick-start-guide.html">Bob Goddard's <i>First Sunday Doomsday Algorithm</i></a>.</div><div><h3>Months</h3>Now that you've calculated a key number based on the year and century, which will be treated as a date from here on out. The next step is to ask for a month. Each month is associated with a day of the week, and all you'll do to create the correct calendar for the month is to put the date you calculated from the year and century together with the day associated with the given month!<br /><h3>Months and Days</h3>To help you recall with days are associated with which months, I developed 7 short rhymes to help make the connections memorable:<br /><br /><b><i>February, March, and November,<br />Three on Sunday to remember.</i></b><br /><br />February, March, and November are all associated with Sunday. Sunday also happens to be the only day of the week associated with 3 different months. Each of the other days is associated with only 1 or 2 months each.<br /><br /><b><i>June day?<br />Moon-day!</i></b><br /><br />This short rhyme makes it easy to remember that June is associated with Monday.<br /><br /><b><i>A skeptic needs clues,<br />but Sept./Dec. needs Tues.</i></b><br /><br />Sept. is Septemeber, and Dec. is short for December, and they're both associated with Tues., or Tuesday.<br /><br /><b><i>Winds in April, Winds in July,<br />“Winds”-day’s the day, wet or dry.</i></b><br /><br />This is simple enough. April and July are associated with Wednesday.<br /><br /><b><i>Jan’s and October’s 31,<br />Reminds us that Thursday won.</i></b><br /><br />Jan, of course, refers to January. Not only are January and October both associated with Thursday, but they're the only set of months in a group which all happen to share the same length.<br /><br /><b><i>Month 5 is May,<br />Day 5 is Friday.</i></b><br /><br />May being associate with Friday made for an easy rhyme, of course. Since May actually rhymes with every day of the week, I thought the additional association of the 5th month and the 5th and final day of the work week strengthened the association.<br /><br /><b><i>August’s few holidays make you yearn,<br />For the day off named after Saturn.</i></b><br /><br />In most English-speaking countries, August tends to be the month with the fewest nation-wide holidays. This made for an interesting rhyme to help you memorize that August is associated with “Saturn-day”, or Saturday.<br /><h3>Leap Year Exceptions</h3>Leap years stand out in this method because they don't need partitioning like most other numbers. If you're given a leap year, work out the key as taught previously, and then make a mental note that it's a leap year.<br /><br />January and February both change the days with which they are associated in leap years. January in a leap year moves 1 day back from Thursday to Wednesday. In other words, in a leap year, January, April, and July are all associated with Wednesday, and October is the only month associated with Thursday.<br /><br />Similarly, February also moves 1 day back from Sunday to Saturday in a leap year. In leap years, then, February and August are both associated with Saturday, and only March and November are associated with Sunday.<br /><br />These two leap year exceptions may seem difficult to manage at first, but if you just think of January and February moving their day associations back by 1 day, it quickly becomes natural.<br /><br />Remember that any year which is evenly divisible by 4 is a leap year, except for years ending in 00. Years ending in 00 are only leap years if they're evenly divisible by 400. For example, 2000 was a leap year, but 1900 and 2100 are not.<br /><br />Practice your association of days with months by going to the <a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation-quiz.html">Quick Calendar Month Creation Quiz and clicking on the <i>Month and Day Association</i> button</a>.<br /><br />Once you're comfortable with the month-to-day associations and calculating the key from the year, you're ready to <a href="#cmcalend" class="jumpup">quickly create an entire calendar month, as explained in the next tab</a>.<br /><h3>Credits & Notes</h3>The approach of associating each year and century with a date, and each month with a day of the week is also from “How to find the day of the week on which any particular date falls” by E. Rogent and <a href="http://www.geniimagazine.com/magicpedia/W._W._Durbin">W.W. Durbin</a> in the August 1927 issue of <a href="http://www.geniimagazine.com/magicpedia/Linking_Ring"><i>The Linking Ring</i></a>.<br /><br />In the original article, however, Durbin and Rogent's month and day associations were based on dates in the 1800s. In order to make the math work properly with <a href="http://firstsundaydoomsday.blogspot.com/2009/12/quick-start-guide.html">Bob Goddard's <i>First Sunday Doomsday Algorithm</i></a>, however, the month and date associations have been changed so that they're now based in the 1700s.<br /><br />Since the month and day association have been changed, the rhymes for remembering each association are original with me.</div><div><h3>Creating the Calendar</h3>At this point, many calendar calculation methods would have you do one last calculation to work out the day of the week for the given date.<br /><br />Since my goal here is to minimize the calculation, this step simply involves creating a calendar for the given month and year. <a href=" https://dl.dropboxusercontent.com/u/23420016/month_calendars.pdf">Here's a PDF template for a set of blank calendars</a>, sized for printing on the back of business cards. When you bring out a single one to use, it should appear like this:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/month_calendar_blank_zpsa5e941c7.png" style="margin-left:auto;margin-right:auto;" /><br /><br />This step is where all of your calculation and memory work come together. To show you how, let's say you ask for a year, and you're given 1982. As you write down 1982 in the <i>Date</i> section of the calendar, you run through the calculations in your head: 82 = 80 + 2, which becomes 40 - 2 = 38, cast out 7s so we have 3, add 4 for the 1900s, giving 7, casting out 7s, leaves us with 0. We now know 1982 is a 0 year.<br /><br />For the month, we'll say that you're given April, which you should immediately associate with Wednesday (Remember? “Wind in April...”), as you write down April in the <i>Date</i> section.<br /><br />At this point, you know that 1982 is a 0 year and April is associated with a Wednesday, yet the calendar looks like this:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/month_calendar_apr_82_1_zps71eac61f.png" style="margin-left:auto;margin-right:auto;" /><br /><br />Generally, the rule is to put the day of the week you recalled above the number you were given. If you have 5 and Monday, you'd put Monday directly above the 5 on the calendar. In this case, though, we have 0 and Wednesday, so what do you do?<br /><br />Simple, think of the “0th” of a month as being 1 week before the 7th. In the case of 0, you always put the day of the week above the 7. Since April is associated with Wednesday, we put the abbreviation Wed above the 7th, like this:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/month_calendar_apr_82_2_zpse1fc4651.png" style="margin-left:auto;margin-right:auto;" /><br /><br />From here, it's easy to see the remaining days of the week should be placed:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/month_calendar_apr_82_3_zps5d530894.png" style="margin-left:auto;margin-right:auto;" /><br /><br />Don't forget to give the month the correct number of days. In our example, April is a 30-day month, so we add a 29 and 30 in the bottom row:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/month_calendar_apr_82_4_zps1e1ff4cf.png" style="margin-left:auto;margin-right:auto;" /><br /><br />At this point, you're done creating the calendar! If this was someone's birthday, and they were born on April 17, 1982, a quick look at the calendar is all you need to see that they were born on a Saturday. You can circle that date and the day of the week, and now they have a souvenir of their birthday, and your amazing calendar skills!<br /><h3>Another Leap Year Reminder</h3>In the <a href="#cmmonth" class="jumpup">previous tab</a>, you learned that when working with leap years, and you're given either January or February as the month, you need to move the day associate back by 1 day. Let's see how this works in practice.<br /><br />For this example, we'll choose 1992 as the year. Multiples of 4 aren't partitioned, so we start with 92 ÷ 2 = 46, and cast out 7s (46 - 42) to get 4. Adding 4 for the 1900s to that, we get 8, and we cast out 7s to get 1. You've worked out that 1992 is a 1 year, and also realize you need to keep alert if they ask for January and February.<br /><br />Continuing with this example, we'll imagine that February is chosen as the month. When you hear this, you need to recall 2 concepts. First, February is associated with Saturday in a leap year, and second, that a leap-year February has 29 days. Putting all that together, the resulting calendar should appear like this when finished:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/month_calendar_feb_92_zps0b0ebf97.png" style="margin-left:auto;margin-right:auto;" /><br /><br />Leap-year Januarys and Februarys are probably the worst-case scenario you'll face in this method. Once you're comfortable with those, you're ready to perform this feat.<br /><h3>Verification by the Spectators</h3>For this feat to really be impressive, they need to know that the calendar you created is correct. In the past, this meant carrying around cumbersome almanacs. Today, though, the handiest and most convenient way is carry an internet-connected mobile device around.<br /><br />They can verify it with any kind of search, but I usually have them point their browser to <a href="http://www.wolframalpha.com">Wolfram|Alpha (http://www.wolframalpha.com)</a>. Once you have the calendar created, have them enter the year and month followed by the word calendar, and Wolfram|Alpha will generate the calendar for that month!<br /><br />For our April 1982 example, <a href="http://www.wolframalpha.com/input/?i=April+1982+calendar">entering the phrase <i>April 1982 calendar</i> into Wolfram|Alpha</a> will display that calendar, and you can see that both start on the same day and end on the same month. You can also <a href="http://www.wolframalpha.com/input/?i=February+1992+calendar">verify the February 1992 calendar in the same way</a>.<br /><h3>Practice Creating Calendars</h3>Over in the <a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation-quiz.html">Quick Calendar Month Creation Quiz</a>, you can practice creating calendars by clicking on the <i>Calendar Quiz</i> button. This quiz is different than the previous quizzes, however, as it opens up full-screen in a new window.<br /><br />There are two pull-down menus near the top. By default, the one on the top-right reads <i>Gregorian: 1700-2099</i>, which are the years you'll probably want to start with when you're first learning this feat.<br /><br />Clicking on this menu will bring up other selections, which are: <i>Gregorian: 1582-9999</i>, which tests on years in the current calendar, but in a much wider range (the <a href="#cmtips" class="jumpup">first 2 items on the tips page</a> can help here), <i>Julian: 1 AD - 1582 AD</i>, and <i>Julian: 45 BC - 1 BC</i>. You won't need to worry about these until you've read the next page.<br /><br />To use this quiz, select a range from the top-right menu, and then click on the <i>New Date</i> button on the top-left of the screen. Down by the word “Date:”, at the bottom, a random year from the selected range will appear, followed shortly by a random month.<br /><br />The days of the week towards the top of the screen can be scrolled left or right by using the left and right arrow keys on your keyboard, or by swiping them left or right, if you're using a mobile device. What you want to do is use this ability to scroll the days to align the key you calculated from the given year with the day you associate with the given month.<br /><br />For example, if you're given 2014, and you quickly work out a key of 2, and then you're given the month of May, which is associated with Friday, you want to scroll the days left or right, so that Friday is right above the 2.<br /><br />In order to make sure the number of days are right, you use the pull-down menu at the top-left of the screen, which defaults to <i>28 days</i>. You can also select <i>29 days</i>, <i>30 days</i>, and <i>31 days</i>, and the added days will appear in the bottom row. Continuing with our 2014 May example, you'd want to select 31 days, since that's the length of May, so that 29, 30, and 31 appear in the bottom row.<br /><br />Once you're satisfied that you've created the month, click the <i>Verify</i> button at the top right to see whether you are correct. It can inform you whether the number of days in the month is wrong, whether the days aren't labeled correctly, or whether you got it correct. If nothing is correct, it will simply say, “Oops. Try again, please.”<br /><br />To try again, simply click the <i>New Date</i> button, and you're given a brand new random year and month!<br /><br />Once you're comfortable working with years in the Gregorian calendar, the next tab will show you <a href="#cmjulbc" class="jumpup">how to handle years in the Julian calendar</a>, all the way back to 45 B.C.!<br /><h3>Credits & Notes</h3>Creating a calendar month as an alternative to doing calculations involving an individual date is an approach I developed when I created <a href="http://www.lybrary.com/day-one-p-137029.html"><i>Day One</i></a>. In fact, the calendar PDF linked in the top of this tab was originally developed for <i>Day One</i>.<br /><br />The quiz seen here is also a modified version of the calendar quiz I originally developed and included with <i>Day One</i>.<br /></div><div><h3>Julian Calendar</h3>The calendar we currently use, known as the <a href="http://www.timeanddate.com/calendar/gregorian-calendar.html">Gregorian calendar</a>, was <a href="https://www.youtube.com/watch?v=qPk8g6HbFNA">first used by Spain, Portugal, and most of Italy on the Gregorian date of October 15, 1582</a>. The date immediately prior on the <a href="http://www.timeanddate.com/calendar/julian-calendar.html">Julian calendar</a> was October 4, 1582.<br /><br />Other countries <a href="http://en.wikipedia.org/wiki/Gregorian_calendar#Timeline">didn't adopt the Gregorian calendar until later</a>. Britain and its colonies, including America at the time, adopted it in 1752, jumping from the Julian date of September 2 to the Gregorian date of September 14 on the following day.<br /><br />In the Julian calendar, leap years happened <i>every</i> 4 years, including years ending in 00. With the Gregorian calendar, years ending in 00 are only leap years if they were evenly divisible by 400. For example, 2000 was a leap year, but 1900 was not and 2100 will not be.<br /><br />With this shifting ahead of days, and different leap year rules, you might think it would be difficult to account for this change in a calendar calculation. I have good news for you. If you want to calculate a Julian date with this method, it's astonishingly simple.<br /><br />To adjust for a Julian date, the only modification you need to do concerns the century. Instead of using the 0-2-4-5 “No tuna for Friday” approach, simply add the century number itself, casting out 7s if needed.<br /><br />For example, if someone asked about <a href="http://en.wikipedia.org/wiki/Battle_of_Hastings">1066</a>, you would start with 66 just as before. 66 = 64 + 2, which is modified and solved as 32 - 2 = 30. Casting out 7s from 30 leaves 2. For the Julian calendar, we just add the century number (10): 2 + 10 = 12. Casting out 7s from 12 leaves us with 5.<br /><br />Next, if someone asks for the month of October, we recall that October is associated with Thursday (“Jan’s and October’s 31...“), so we can create a Julian calendar month for October 1066, by starting with a Thursday the 5th. Yes, <a href="http://www.wolframalpha.com/input/?i=October+1066+calendar">Wolfram|Alpha can verify Julian calendar dates</a>, too.<br /><br />As long as you don't accept dates in 1582 from October 5th to October 14th, you can now handle dates as far back as 1 A.D., and as far into the future as you like!<br /><br />To practice creating calendar for Julian years and months from 1 A.D. to 1582 A.D., you can go the the <a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation-quiz.html">Quick Calendar Month Creation Quiz page</a>, and click on the <i>Calendar Quiz</i> button. When the Calendar Quiz opens, select <i>Julian: 1 AD - 1582 AD</i> from the top-right menu to practice these dates.<br /><h3>B.C. Dates</h3>The Julian calendar was first put in place by Julius Caesar in 45 B.C., so wouldn't it be nice to handle those first few dates, as well?<br /><br />The first thing to remember is that the calendar we use today went from 1 B.C. directly to 1 A.D., so there was no year 0.<br /><br />Handling dates such as these only requires one additional adjustment. When given a B.C. date, subtract the year from 57, and then treat it like any other Julian year.<br /><br />If you're asked to create a calendar in, say, <a href="http://en.wikipedia.org/wiki/25_BC">25 B.C.</a>, the first step is to subtract it from 57: 57 - 25 = 32. Now you can handle that as a Julian year. 32 doesn't need to be partitioned, so we just do 32 ÷ 2 = 16, and casting out 7s from 16 leaves 2. Since the century is effectively 0, we just leave the key at 2.<br /><br />Now, if someone asks for June, we recall that June is associated with a Monday (“June day? Moon-day!”), so June in 25 B.C. must've had a Monday the 2nd, which <a href="http://www.wolframalpha.com/input/?i=June%2C+25+B.C.">Wolfram|Alpha verifies for us</a>!<br /><br />When dealing with Julian and/or B.C. dates, don't forget the leap year adjustment, if needed. For example, since 25 B.C. is a leap year, you'd still work out that the key number for it is 2, but if someone asked for January, you need to recall that it's associated with Wednesday in a leap year. That way, you know <a href="http://www.wolframalpha.com/input/?i=January%2C+25+B.C.">January in 25 B.C. had a Wednesday the 2nd</a>.<br /><br />You can also practice BC dates by going to the <a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation-quiz.html">Quick Calendar Month Creation Quiz page</a>, and clicking on the <i>Calendar Quiz</i> button. After the Calendar Quiz opens, select <i>Julian: 45 BC - 1 BC</i> from the top-right menu to practice these dates.<br /><br />Once you're comfortable working with Julian calendars and calendars back to 45 B.C., <a href="#cmtips" class="jumpup">check out these tips</a> to help your performance along.<br /><h3>Credits & Notes</h3>The Julian and B.C. date modifications both come directly from the approach used in <a href="http://firstsundaydoomsday.blogspot.com/2009/12/quick-start-guide.html">Bob Goddard's <i>First Sunday Doomsday Algorithm</i></a>. Basing the Gregorian century modifications on the 1700s is what makes this possible.<br /></div><div><h3>Tips</h3>• Only the last 4 digits of a year matter. Working with the year 15739562 is no different than working with the year 9562.<br /><br />• Another way to think about the centuries, especially when dealing with years far away from the 1700s, 1800s, 1900s, and 2000s:<br /><ul><li>If it's divisible by 400, like the 2000s, add 5.</li><li>If it's even, but not evenly divisible by 400, like the 1800s, add 2.</li><li>If it's just after a multiple of 400, like the 1700s, don't add anything.</li><li>If it's just before a multiple of 400, like the 1900s, add 4.</li></ul><br />• If you're comfortable with using the <a href="http://gmmentalgym.blogspot.com/2010/10/memory-basics.html">Mnemonic Major System</a>, you can speed up this feat even further. Since dates within a century repeat in a pattern every 28 years, all you have to do is memorize the 2-digit year keys for the years 00-27. You not only have quick recall of those years, but of all the other years as well:<br /><ul><li>Years ending in 28 through 55: Subtract 28, then recall the corresponding key.</li><li>Years ending in 56 through 83: Subtract 56, then recall the corresponding key.</li><li>Years ending in 84 through 99: Subtract 84, then recall the corresponding key.</li></ul><br />• You don't have to use <a href="https://dl.dropboxusercontent.com/u/23420016/month_calendars.pdf">the business card calendar PDF</a>. Any calendar that allows you to display an entire month AND adjust which days go with which months will work. Some examples:<br /><ul><li>Calendars you can make:<br /><ul><li><a href="http://cp.c-ij.com/en/contents/c204/09_craft0001/index.html">Casio Craft Calendar 1</a></li><li><a href="http://cp.c-ij.com/en/contents/c204/09_craft0002/index.html">Casio Craft Calendar 2</a></li><li><a href="http://diyplanner.com/node/6442">The Perpetual Strip</a></li></ul></li><li>Commercially available calendars:<br /><ul><li><a href="http://www.calendreco.com">Calendreco</a></li><li><a href="http://www.cafepress.com/greymattersstore/8418906">Magnetic perpetual calendars</a></li><li><a href="http://www.amazon.com/gp/product/B0048CCT14/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=greymatt-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B0048CCT14">MoMA Acrylic perpetual calendar</a></li><li><a href="https://www.amazon.com/Moma-Spindle-Perpetual-Calendar/dp/B0099WXOCQ/ref=as_li_ss_til?tag=greymatt-20&linkCode=w01&linkId=P4NNDGKYN342JW66&creativeASIN=B0099WXOCQ">MoMA Spindle perpetual calendar</a></li><li><a href="https://www.amazon.com/MONTHLY-CALENDAR-POCKET-CHART/dp/B008W076D4/ref=as_li_ss_til?tag=greymatt-20&linkCode=w01&linkId=HGEIBLODSXAF7GZI&creativeASIN=B008W076D4">Monthly Calendar Pocket Chart</a></li><li><a href="http://www.cafepress.com/greymattersstore.701234204">Perpetual Calendar Clipboard</a></li></ul></li></ul><br />• There's a simple formula for working out how many days needed to be added to the Julian calendar to adjust it to the Gregorian calendar. You can learn it from <a href="http://headinside.blogspot.com/2013/05/changing-calendars-mentally.html">my <i>Changing Calendars Mentally</i> post</a>. When working with the Julian calendar, this can make an impressive additional detail.<br /><br />• Which months have a Friday the 13th? Once you've taken the year and century into account and you have your key number, ask yourself which day of the week is that many days after Saturday, and then ask yourself which months are associated with that day of the week. The months will be the only ones with a Friday the 13th!<br /><br />For example, if you're given a year whose key you calculate as 3, ask yourself what day is 3 days after Saturday? The answer, of course, is Tuesday. Which months are associated with Tuesday? September and December are associated with that day, so you can state that September and December are the only months that year with a Friday the 13th!<br /><br />This makes an impressive extra feat to add in to your performance. <b>Note:</b> As always, don't forget that January's and February's associations move 1 day back in leap years!<br /><br />• What do you do if someone asks for a year before 45 B.C.? Explain that the pre-Julian <a href="http://en.wikipedia.org/wiki/Roman_calendar">Roman calendars</a> were just too different. For example, one version had only 304 days each year, and another had 355 days each year, with leap years making some years as long as 378 days. The last <a href="http://en.wikipedia.org/wiki/Julian_calendar#Realignment_of_the_year">pre-Julian year, 46 B.C., was adjusted to 445 days long</a>!<br /><br />• Hans-Christian Solka, author of the <a href="https://translate.google.com/translate?sl=auto&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fdayofweekcalculation.blogspot.com&edit-text=&act=url">Day of Week Calculation Blog</a>, also suggests the following related online resources for further reading:<br /><ul><li><a href="http://easydoomsday.blogspot.com/2008/04/improved-doomsday-algorithm.html">An Improved Doomsday Algorithm</a>, by Michael K. Walters</li><li><a href="http://improvedddabyykyu.blogspot.com/2010/09/perpetual-calendar-in-your-head-by-dr.html">A Perpetual Calendar in Your Head</a>, by Dr. YingKing Yu</li><li>Methods for Accelerating Conway's Doomsday Algorithm (PDF: <a href="http://arxiv.org/pdf/1006.3913.pdf">Part 1</a>, <a href="http://arxiv.org/pdf/1010.0765.pdf">Part 2</a>), by Chamberlain Fong and Michael K. Walters</li></ul><br /></div></div><script>//<![CDATA[ $(document).ready(function() { var dec = 7; var yr = 5; var yrNum = 0; var preMod = 0; var txtstring = ""; $("#decade").change(function() { $("#decade").blur(); dec=$("#decade").val(); breakDown(); }); $("#year").change(function() { $("#year").blur(); yr=$("#year").val(); breakDown(); }); function breakDown() { yrNum = (10 * parseInt(dec, 10)) + (parseInt(yr, 10)); txtstring="Starting year: " + dec + yr; $("#ycstart").text(txtstring); txtstring = "Partition: "; if ((yrNum % 4) != 0) { txtstring = txtstring + ((Math.floor(yrNum / 4))*4).toString() + " + " + (yrNum % 4).toString(); } else { txtstring = txtstring + yrNum.toString(); } $("#ycpart").text(txtstring); preMod = (((Math.floor(yrNum / 4))*2) - (yrNum % 4)); if ((yrNum % 4) != 0) { txtstring = "Modify & solve: " + ((Math.floor(yrNum / 4))*2).toString() + " - " + (yrNum % 4).toString() + " = " + (((Math.floor(yrNum / 4))*2) - (yrNum % 4)).toString(); if ((((Math.floor(yrNum / 4))*2) - (yrNum % 4)) < 0) { preMod = preMod + 7; txtstring = txtstring + " ... " + (((Math.floor(yrNum / 4))*2) - (yrNum % 4)).toString() + " + 7 = " + preMod.toString(); } } else { txtstring = "Modify: " + ((Math.floor(yrNum / 4))*2).toString(); } $("#ycmod").text(txtstring); txtstring = "Cast out 7s: "; if (preMod > 6 ) { txtstring = txtstring + preMod.toString() + " - " + ((Math.floor(preMod / 7)) * 7).toString() + " = " + (preMod % 7).toString(); } else { txtstring = txtstring + preMod.toString(); } $("#yccastout").text(txtstring); }; }); //]]></script>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com5tag:blogger.com,1999:blog-2800835365312821409.post-4865720684334232832013-01-03T09:30:00.000-08:002014-05-14T23:43:18.458-07:00Moon Phase For Any Date<style>/*CSS from jQuery Calendar Widget Plugin*//*http://eisabainyo.net/demo/jquery.calendar-widget.php*/td.other-month, td.current-month, th.weekday { border-left: 1px solid #999999; border-bottom: 1px solid #999999; width: 120px; padding: 10px 0; text-align: center;}td.menu { border-left: 0px; border-bottom: 0px; width: auto; padding: 0; text-align: left;}table { border-right: 1px solid #999999; border-top: 1px solid #999999;}table.choose { border-right: 0; border-top: 0;}th { background: #666666; color: #ffffff;}.current-month { background: #ffffff;}.other-month { background: #f2f2f2;}.day { font-weight: bold;}/*End Calendar CSS*//*My CSS*//*530 is the max width of my blog's posting areas*/#calendar { font: 16px/1.6em Arial, Geneva, Helvetica, sans-serif; width: 530px;}</style><ul id="tabs"><span id="fullpost"><li><a id="mp1" href="#mpbasics" class="s">Basics</a></li><li><a id="mp2" href="#mpmndy" class="s">Month/Day</a></li><li><a id="mp3" href="#mpyrcent" class="s">Year/Cent.</a></li><li><a id="mp4" href="#mpprctc" class="s">Practice</a></li><li><a id="mp5" href="#mptipstools" class="s">Tips/Tools</a></li><li><a id="mp6" href="#mpwhy" class="s">Why?</a></li></span></ul><div class="panes"><div><h3>Basics</h3>Before you learn how to determine the moon's phases in your head, you'll need to learn and remember some important moon-related terms, so you can describe each phase.<br /><h3>Moon's Age</h3>No, this doesn't refer to the moon being roughly 4.5 billion years old. It refers to the number of days since the most recent new moon, and ranges from 0 to about 30 days.<br /><br /><span id="fullpost">Over at <a href="http://cycletourist.com/">cycletourist.com</a>, there's a <a href="http://cycletourist.com/moon/">Moon age calculator</a> that uses the date and your time zone to give the exact moon age. Try a few different dates on that calculator, so you can get an idea of the different ages.</span><br /><h3><span id="fullpost">Northern vs. Southern Hemisphere</span></h3><span id="fullpost">The way the moon proceeds through its phases appears differently, depending on whether you're in the Northern or Southern hemisphere. Here's how the moon's cycle appears in the Northern Hemisphere:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/moonphasenorth.png" /><br /><br />To make this progression more memorable, we'll just focus on stages 3, 5, and 8 from the above diagram:<br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/moondoc.png" /><br />These phases look like the word “DOC”. The D is shaped like the half-moon, the O is shaped like the full moon, and the C is shaped like the crescent.<br /><br />In the Southern hemisphere, however, the moon starts its phases from the left side, and proceeds until it disappears on the right, like this:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/moonphasesouth.png" /><br /><br />Looking at only stages 2, 5, and 7 from this picture, we get:<br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/mooncod.png" /><br />You've probably already guessed that this progression can be remembered using the word COD.<br /><br />To remember that DOC applies to the Northern hemisphere, use the fact that north is <i>up</i> on most maps, and just think of Bugs Bunny's classic saying, "What's <i>up</i>, Doc?" For COD, recall that a codpiece is designed to be worn in a man's “Southern hemisphere.”<br /><h3>Events vs. Phases</h3>In the 8 stages shown the above pictures, 4 are really only short one-day <i>events</i>, while the rest are part of <i>phases</i>, each of which are about a week long. I'll start with the events, since most people learn about those first.<br /><h3>Events: New Moon vs. Full Moon</h3>The full moon is simple enough to remember. It's when the moon is as full, or as brightly lit as its going to get in its current cycle, as shown in stage 5 of either of the above graphics.<br /><br />Some people confuse the concept of a new moon with a full moon. If you think of <i>NEW MOON</i> as being the same as <i>NO MOON</i>, that shouldn't be a problem. Image 1 in either of the above graphics shows a new moon.<br /><h3>Events: First Quarter vs. Third Quarter Moon</h3>The term quarter moon often seems confusing, especially since they refer to what most people think of as a half-moon. <i>Quarter</i>, in this context, refers to the point in the cycle, not the shape itself.<br /><br />Think of quarters in a moon cycle like quarters of a year. After a new year, just like a new moon, comes the first quarter of the year. The third quarter of a year is the last to happen before you head into the next new year, so a third quarter moon is the last you see before the next new moon.<br /><br />In the above graphics, stage 3 is the first quarter moon, and stage 7 is the third quarter moon. Since the side that's lit in either quarter varies with the hemisphere from which it's being viewed, the DOC and COD mnemonics are very important.<br /><h3>Phases: Waxing vs. Waning</h3><i>Waxing</i> is the phase in which the moon is getting brighter from night to night. Stages 2, 3, and 4 all show a moon in a waxing phase. If you think of either ear-wax buildup, or waxy yellow buildup on a linoleum floor, this will help you remember that waxing refers to the moon building up, or getting brighter.<br /><br /><i>Waning</i>, on the other hand, refers to the moon getting darker and darker, as in stages 6, 7, and 8 above. To help you remember this, you can think of <a href="http://en.wikipedia.org/wiki/Lil_Wayne">Lil Wayne</a>, and use Lil to help you recall that waning means that the light on the moon is getting “littler.” Alternatively, you might think of <a href="http://en.wikipedia.org/wiki/Wayne_Newton">Wayne Newton</a> as “Wayne <i>Newmoon</i>,” to remind you that waning moons are getting closer and closer to the new moon.<br /><h3>Phases: Crescent vs. Gibbous</h3>The <i>crescent</i> phase is easy to recall, especially if you're familiar with crescent rolls or crescent wrenches. When use to refer to the moon, crescent simply means that less than half the moon is illuminated, as in stages 8, 1, and 2 above.<br /><br /><i>Gibbous</i>, on the other hand, is an unfamiliar word to many. It refers to the phase when half or more of the moon is illuminated, as in stages 3, 4, 5, 6, and 7 above. Imagine you're trying to negotiate a deal with someone, and they keep saying, “<i>Gibbous</i> more than half or no deal!”<br /><h3>Quick Notes Before Moving On</h3>Waxing or waning, when combined with crescent or gibbous, identifies the exact phase of the moon at any given time. The waxing crescent phase runs from the new moon to the first quarter moon. Next comes the waxing gibbous moon, which runs from the first quarter moon to the full moon.<br /><br />After that, there's the waning gibbous, from the full moon to the third quarter moon, and the waning crescent, from the third quarter moon back to the new moon.<br /><br />The line dividing the dark part of the moon from the light part is known as the <i>terminator</i>, which can make from some amusing sci-fi movie references.<br /><br />Once you're comfortable with all the terms, you're ready to start learning the formula for determining the moon phase in your head, <a href="#mpmndy" class="jumpup">which begins in the next tab</a>.</span><br /></div><div><h3>About The Formula</h3>The moon phase calculation formula has much in common with the <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-revised.html"><i>Day of the Week For Any Date</i> method taught here in the Mental Gym</a>, including the developer of the formula, John Conway.<br /><br />Just like the day of the week feat, you're going to translate the year, date (1-31), century, and year into key numbers, and add them up.<br /><br />In the day of the week feat, you then performed a modulo 7 operation on this number, but for the roughly 30-day moon cycle, you're going to perform modulo 30. For a clear explanation of this concept, <a href="http://betterexplained.com/articles/fun-with-modular-arithmetic/">read BetterExplained's post, <i>Fun With Modular Arithmetic</i></a>.<br /><br />Unlike the calendar formula, the moon phase formula is not exact. The real moon's orbit is quite complex, and exact calculations include corrections for every detail.<br /><br />The formula you'll learn is simple enough to do in your head, and will be accurate to within about a day or so. You'll learn how to deal with this in the <a href="#mpprctc" class="jumpup"><i>Presentation</i> section of the Practice tab</a>.<br /><h3>Month Key</h3>The month key is very easy to remember. For March to December, you simply use the standard month number. For example, March's key number is 3, April's key number is 4, and so on up to December's key number, which is 12.<br /><br />January and February aren't hard to recall. January's key number is 3, and February's key number is 4. If you can remember the month numbers, and these numbers for the first two months, you'll be able to remember the year key without trouble.<br /><h3>Date Key</h3>If you thought the month key was easy, the date key is even easier! All you use is the number of the date, 1 through 31, as the date key.<br /><br />So, your first step is to look at the month and date, and add the two keys together. July 12th? That's 7 + 12 = 19. February 7th? That's 4 + 7 = 11. January 19th? That's 3 + 19 = 22.<br /><br />Once you have a total of the month and day keys, it's usually a good idea to add 30 to the total before working with the century and year keys. With those, you're going to be doing some subtracting, and adding 30 will help ensure that the running total remains a positive number.<br /><br />When you're comfortable getting and adding the month and day keys, <a href="#mpyrcent" class="jumpup">it's time to learn the year and century keys</a>.<br /></div><div><h3>Century Key</h3>When performing this feat, it's best to use a date that's meaningful, such as a birthday or anniversary. So, all you really need to know are keys for the 1900s and 2000s.<br /><br />If you're given a date in the 1900s, you simply subtract 4 from the running total. If you're given a date in the 2000s, you'll subtract 8 instead. That's it!<br /><h3>Year Key</h3>Unlike the previous keys, there are a few steps to working out the year key. Don't worry, they can still be done in your head.<br /><br />First, you'll need to know your multiples of 19: 0, 19, 38, 57, 76, and 95.<br /><br />This is because the first step in working out the year key is finding out how close you are to the nearest multiple of 19, whether that multiple is more or less than the year number.<br /><br />Let's use 2008 as an example, focusing on the year as simply 8. 8 is between 0 and 19, but obviously closer to 0. To get 8 starting from 0, you'd add 0 + 8, so think only of +8 at this stage. <br /><br />It's important to note that this was just the first step to finding 2008's key, so +8 is the number we need for the 2nd step, not the key itself.<br /><br />Before moving on to the 2nd step, though, let's try another example year, such as 2013. Working with 13, we see that it's between 0 and 19, but closer to 19. Starting from 19, you'd get to 13 by working our 19 - 6, so 13's number at this stage should be thought of as -6.<br /><br />This is what I mean about finding the distance to the closest multiple of 19. 8 was 8 <b><i>MORE</i></b> than 0, so we think of it as <b><i>PLUS</i></b> 8. 13 was 6 <b><i>LESS</i></b> than 19, so we think of 13 as <b><i>MINUS</i></b> 6.<br /><br />What about, say, 59? That would be +2, because 57 is the nearest multiple of 19, and 57 + 2 = 59. How about 88? That becomes -7. Do you understand why?<br /><br />This first step seems complicated when you first learn about it, but with practice, it's not hard to determine the number you need quickly and easily. Regardless of the year, notice that you'll always get a number ranging from -9 to +9 as a result.<br /><br />Now it's time to explain the second step. First, I'll explain the long way of working through this step, then I'll give you a shortcut that gives the same result.<br /><br /><b>LONG VERSION:</b> Whether the number you got in the first step was positive or negative, you're going to work through this step as if it's a positive number, and then restore the proper sign at the end.<br /><br />Going back to our 2008 example, we got +8 in the first step, and we remember that plus sign. Next, we multiply that by 11, and get 88. Finally, <a href="http://www.wolframalpha.com/input/?i=88+modulo+30">88 modulo 30 is 28</a>, and we recall that the original number was positive, so we know that the 28 is positive, as well. This is the final number we need, so we would <i>add</i> 28 to our running total.<br /><br />What happens with 2013? Applying the first step to 13 gave us -6 (remember?), so we'll work through this process as just 6, remembering the minus sign for later. 6 × 11 = 66, and <a href="http://www.wolframalpha.com/input/?i=66%20modulo%2030">66 modulo 30 is 6</a>. Restoring the minus sign from earlier, we get -6. This simply means that we'd <i>subtract</i> 6 from our running total.<br /><br /><b>SHORTCUT:</b> Let's <a href="http://www.wolframalpha.com/share/clip?f=d41d8cd98f00b204e9800998ecf8427ea5celnqotg">run all the numbers from -9 to +9 through the above process</a>, and see if we can find some patterns:<br /><br /><img src="http://latex.codecogs.com/gif.latex?%5C%5C-7%20%3D%20-17%20%5C%20%5C%20%5C%20-8%20%3D%20-28%20%5C%20%5C%20%5C%20-9%3D-9%20%5C%5C-4%20%3D%20-14%20%5C%20%5C%20%5C%20-5%20%3D%20-25%20%5C%20%5C%20%5C%20-6%3D-6%20%5C%5C-1%20%3D%20-11%20%5C%20%5C%20%5C%20-2%20%3D%20-22%20%5C%20%5C%20%5C%20-3%3D-3%20%5C%5C.%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%200%20%3D%200%20%5C%5C+1%20%3D%20+11%20%5C%20%5C%20%5C%20+2%20%3D%20+22%20%5C%20%5C%20%5C%20+3%3D%20+3%20%5C%5C+4%20%3D%20+14%20%5C%20%5C%20%5C%20+5%20%3D%20+25%20%5C%20%5C%20%5C%20+6%3D%20+6%20%5C%5C+7%20%3D%20+17%20%5C%20%5C%20%5C%20+8%20%3D%20+28%20%5C%20%5C%20%5C%20+9%3D%20+9" title="Year key chart" style="margin-left:124px" /><br /><br />The first thing to notice here is that neither the sign nor the ones digit (the rightmost digit) change. It's also easy to see that the multiples of 3 don't change at all.<br /><br />If you think of the multiples of 3 as being 2-digit numbers (±03, ±06, and ±09), then you can also see that the <a href="http://www.wolframalpha.com/share/clip?f=d41d8cd98f00b204e9800998ecf8427eqqf3f03h35">tens digit of each number is the ones digit modulo 3</a>. For example, <a href="http://www.wolframalpha.com/input/?i=7+mod+3">7 modulo 3 is 1</a>, so we just put a 1 in front of a 7 to make 17.<br /><br />Just like in the long version, when you do the modulo 3, you need to temporarily drop the sign, then put it back afterwards, for this formula to work out properly.<br /><br />Let's work through the shortcut method with a year ending in 53, as an example. In the first step, 53 becomes -4 (you should still understand why). We temporarily drop the minus sign, and perform 4 mod 3 to get 1, so we put a 1 in there to make -14. This means we need to subtract 14 from our running total.<br /><br />The more you practice and perform this feat, the more quickly these numbers will come to mind. Sooner than you expect, the numbers will come from your memory quicker than from calculation.<br /><br />Now that you understand how to properly figure the year, date, century, and year keys, it's time to <a href="#mpprctc" class="jumpup">put them all together and practice, which we'll do in the next tab</a>!<br /><br /></div><div><h3>Getting Results</h3>Now that you understand how to find each key, it's time to put them all together and get the final result!<br /><br />Simply add each of the key numbers together. If the number is greater than 30, take the answer modulo 30.<br /><br />You'll wind up with a number ranging from 0 to 29, and this number represents the moon's age in days. The chart below shows how the age corresponds to the four major moon events:<br /><br /><img src="http://latex.codecogs.com/gif.latex?%5C%5C%20.%200%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%207%5Cfrac%7B1%7D%7B2%7D%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%2015%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%2022%5Cfrac%7B1%7D%7B2%7D%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%2029%20%5C%5C%20.%20%5Craisebox%7B-0.8ex%7D%7B%5Cvdash%7D%20%5Chrulefill%20%5Craisebox%7B-0.8ex%7D%7B%5Cdashv%7D%20%5Chrulefill%20%5Craisebox%7B-0.8ex%7D%7B%5Cdashv%7D%20%5Chrulefill%20%5Craisebox%7B-0.8ex%7D%7B%5Cdashv%7D%20%5Chrulefill%20%5Craisebox%7B-0.8ex%7D%7B%5Cdashv%7D%20%5C%5C%20New%20%5C%20Moon%20%5C%20%5C%20%5C%20%5C%20%5C%201st%20%5C%20Quarter%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20Full%20%5C%20Moon%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%20%5C%203rd%20%5C%20Quarter" title="Moon Age Chart" /><br /><br />To see how this works, let's work through an example date, April 1, 1994. April gives 4 and the 1st gives 1, so that's a total of 5. As I mentioned earlier, I usually like to add 30 at this point to prevent working with negative numbers, so 5 + 30 = 35.<br /><br />The key for the 1900s is -4, so 35 - 4 = 31. Running 94 through the year key process gives us -11 (Because 95 - 1 = 94, and -1 * 11 = -11, remember?), so 31 - 11 = 20. In this case, 20 is below 30, so we don't have to work out modulo 30.<br /><br />Our estimate, then, is that the moon's age is <i>about</i> 20 days old (±1 day). That suggests we're about 5 days past the full moon, so the moon would be getting darker each night, but a majority of the moon's face would still be illuminated. In technical terms, the moon was in a waning gibbous phase.<br /><br />If you <a href="http://www.wolframalpha.com/input/?i=April+1%2C+1994">enter April 1, 1994 into Wolfram|Alpha</a> and scroll down to the bottom, you can verify that the moon was indeed in a waning gibbous phase on that date!<br /><br />As a matter of fact, Wolfram|Alpha provides a great way to test your ability to work through this formula. <a href="http://www.wolframalpha.com/input/?i=calendar+for+January+1+1900+plus+RandomInteger%5B73049%5D+days">Get a random date in the 20th or 21st century by clicking here</a>, then use that date to work through the moon phase formula in your head. When you've got an answer, click the date in the <i>Result</i> pod, and scroll to the bottom to see the actual phase of the moon on that date.<br /><h3>Presentation</h3>Due to the margin of error of this formula, you can't pin down the specific events (new moon, 1st quarter moon, full moon, and 3rd quarter moon) exactly. Since the various phases are each about a week long, and overlap, you can use this to your advantage.<br /><br />I often use the difference in technical terms used by astronomers (and on Wolfram|Alpha) in contrast with an informal description of the moon, including how average people would refer to the moon. This is usually enough to be considered accurate and verifiable with an outside source.<br /><br />Don't forget the importance of having an outside source to verify your claim on the moon. If you can't have someone look up the date online, at least carry an almanac or other reference in which your audience can verify the moon phase.<br /><br />If you make sure people verify your claim with Wolfram|Alpha, you can also usually state your estimate of the moon's age openly. Wolfram|Alpha, at least at this writing, doesn't include this information.<br /><br />Here's a general idea of what to say for any given estimate:<br /><br /><b>29, 0, or 1 days:</b> <i>“On that date, the moon was in a crescent phase, as the 3rd quarter moon happened about a week ago. In fact, so little of the moon is lit, most people would just refer to it as a new moon.”</i><br /><br /><b>2 through 6 days:</b> <i>“The new moon was just about (2, 3, 4, 5, or 6) days before that date, so it's getting brighter every night, but less than half the moon is lit on the right side. It's known as the waxing crescent phase.”</i><br /><br /><b>7 or 8 days:</b> <i>“It's been about a week since the new moon, so the moon is in a waxing phase - in other words, getting brighter each night. The average person might even call it a half-moon or 1st-quarter moon.”</i><br /><br /><b>9 through 13 days:</b> <i>“The 1st quarter moon was about (1 to 2, 2 to 3, 3 to 4, 4 to 5, or 5 to 6) days before that date, so the moon is getting brighter each night, and more than half is lit. This is called the waxing gibbous phase.”</i><br /><br /><b>14, 15, or 16 days:</b> <i>“It's been just about a week since the 1st quarter moon, and so much of the moon is lit that most people will say things like, 'All the crazies are out, it's a full moon!'”</i><br /><br /><b>17 through 21 days:</b> <i>“Just about (1 to 2, 2 to 3, 3 to 4, or 4 to 5) days before that was the full moon, so most of the moon is still illuminated, but it's getting darker each night. The technical term for this is the waning gibbous phase.”</i><br /><br /><b>22 or 23 days:</b> <i>“On that date, it's been about a week since the full moon, so around half of the left side of the moon is illuminated. Many would refer to this as a half-moon or 3rd quarter moon.”</i><br /><br /><b>24 through 28 days:</b> <i>“Around (1 to 2, 2 to 3, 3 to 4, 4 to 5, or 5 to 6) days before that date was the 3rd quarter moon, so the moon is getting darker each night, and less than half the moon is illuminated. Astronomer call this the waning crescent phase.”</i><br /><br />The above statements were written with the assumption that the speaker was talking about the Northern hemisphere. For the Southern hemisphere, just switch all the references to left and right.<br /><br />Once you've practiced both the formula itself and the presentation of your moon estimate, you're ready to perform this feat for someone else.<br /><br />There are many more ways to use your newfound knowledge of the moon, and you can <a href="#mptipstools" class="jumpup">learn about those in the <i>Tips/Tools</i> tab</a>.<br /><br />Additionally, you can <a href="#mpwhy" class="jumpup">learn more about the formula itself in the <i>Why?</i> tab</a>.<br /><br /></div><div><h3>Tips and Tools</h3>• This routine works well with most versions of the <i>Day of the Week For Any Date</i> feat. <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-revised.html">I teach one version here in the Mental Gym</a>, as well as a quicker and simpler version called <a href="http://www.lybrary.com/day-one-p-137029.html"><i>Day One</i>, for sale at Lybrary.com</a>.<br /><br />• Be alert to key number combinations that total 0, to cut your calculation time:<ul><li>Years ending in a multiple of 19 (00, 19, 38, 57, 76, 95): 0 (year) = 0</li><li>The 4th of any month in the 1900s: +4 (date) -4 (1900s) = 0</li><li>The 8th of any month in the 2000s: +8 (date) -8 (2000s) = 0</li><li>Any February or April in the 1900s: +4 (month) -4 (1900s) = 0</li><li>Any August in the 2000s: +8 (month) -8 (2000s) = 0</li><li>Use the Moon Century/Year Combo Key Generator widget below to find years that require no adjustment, such as 2017.</li></ul><br />• Instead of trying to describe the moon, you might try having images of 10 to 12 different phases of the moon on your mobile device. Since you have less than half of the 30 different images, it's reasonable that the photo you're showing isn't an exact match to the moon. There's even a moon-shaped toy called <a href="http://www.amazon.com/dp/B000EUHKUE/ref=as_li_ss_til?tag=greymatt-20&camp=0&creative=0&linkCode=as4&creativeASIN=B000EUHKUE&adid=11ZPKD8QZCPSFWZAD1ZR"><i>Moon In My Room</i></a> that can display 12 different phases of the moon, which is perfect for this presentation.<br /><br />• If you want to work with other centuries, I've developed a Wolfram|Alpha widget that will work out the century keys for anywhere from the 1800s to the 3000s. Simply select the century from the menu, then click <i>Submit</i>.<br /><br />The widget will return 2 numbers, <i>r</i> and <i>s</i>. You can use either one of these as the key for your chosen century, but one if often simpler to use than the other. For example, selecting the 2900s will return <i>r</i> = 6 and <i>s</i> = -24. This means that you can use either +6 or -24 as your key for the 2900s. In this example, adding 6 is the easier way to go.<br /><br /><script type="text/javascript" id="WolframAlphaScript23c947e1c525293c569026ee89960600" src="http://www.wolframalpha.com/widget/widget.jsp?id=23c947e1c525293c569026ee89960600&output=lightbox"></script><br /><br />• Should you decide to focus on a single year, you can use the widget below to get a single key that compensates for the century and the year at once. If you can memorize several keys, you can use the widget to lookup each year and that range.<br /><br />Use the pull-down menus to select any year from 1800 to 3000, and then click the <i>Submit</i> button. Like the above widget, you're given two choices, <i>r</i> and <i>s</i>, and you can decide which one is easier to use. You can ignore the variable <i>y</i>, as it's simply the last two digits of the year you input.<br /><br /><script type="text/javascript" id="WolframAlphaScript57a85edc34f7852d76b1b51c645e7b51" src="http://www.wolframalpha.com/widget/widget.jsp?id=57a85edc34f7852d76b1b51c645e7b51&output=lightbox"></script><br /><br />• If you have <a href="http://www.lybrary.com/day-one-p-137029.html"><i>Day One</i></a>, and you're familiar with the <a href="http://gmmentalgym.blogspot.com/2010/10/memory-basics.html">Major/Peg System</a> for memorizing numbers, it's not hard to develop a <i>Day One</i>-type approach to the Moon Phase feat.<br /><br />Use the Moon Century/Year Combo Key Generator widget above to determine keys for each of the years 2000 through 2018, and link from the same year images I use in <i>Day One</i> to the Major/Peg images for each adjustment (I add a spear to the peg image to represent the minus sign, so I know when to subtract). The years 2019 - 2099 can be reduced to these images via modulo 19, similar to the use of modulo 28 in <i>Day One</i>. To adjust for a date the 1900s, simply add 4.<br /><br />I jokingly refer to this approach as <i>Night One</i>.<br /><br />• Here are some excellent videos that can provide helpful background knowledge:<ul><li><a href="http://www.youtube.com/watch?v=nXseTWTZlks">The Universe: The Phases of the Moon</a></li><li><a href="http://www.youtube.com/watch?v=ixroBOCm8M8">NASA | Moon Phase & Libration: Moon With Additional Graphics</a> - The moon as it will appear all throughout 2013, with 1 frame representing 1 hour!</li><li><a href="http://www.youtube.com/watch?v=Bz9D6xba9Og">How Far Away is the Moon? (The Scale of the Universe)</a> - If you think <a href="http://www.wolframalpha.com/share/clip?f=d41d8cd98f00b204e9800998ecf8427ekgvj8oevrj">that scale is amazing</a>, ask yourself <a href="http://www.wolframalpha.com/share/clip?f=d41d8cd98f00b204e9800998ecf8427eas5nbti62j">how big Jupiter would be if it were shrunk to the same scale</a>.</li><li><a href="http://www.youtube.com/watch?v=53glKEPzElA">What are years?</a> - Related: <a href="http://www.youtube.com/watch?v=xX96xng7sAE">What is a Leap Year?</a></li></ul><br />• If you'd like to understand more about each part of the estimation formula itself, you can <a href="#mpwhy" class="jumpup">learn more about it in the <i>Why?</i> tab</a>.<br /></div><div><h3>Why?</h3>While some may prefer to use the formula without understanding how it works, I've added this section for people who want to understand it better.<br /><br /><b><i>Why Modulo 30?</i></b> If you were to draw a line from the center of the Earth through the center of the moon to a fixed star, it would take about 27.321661 days (27 days, 7 hours, 43 minutes, 11.5 seconds, known as a <a href="http://en.wikipedia.org/wiki/Month#Sidereal_month">sidereal month</a>) to do so. However, it wouldn't return to the exact same phase, since the Earth has moved roughly 45 million miles in that same amount of time.<br /><br />To return to the same moon phase takes longer, an average of about 29.530588 days (29 days, 12 hours, 44 minutes, 2.9 seconds, known as a <a href="http://en.wikipedia.org/wiki/Month#Synodic_month">synodic month</a>).<br /><br />The phase of the moon in this 29.530588-day cycle is approximated through the use of modulo 30, which is easier to work with mentally.<br /><br /><b><i>Why Focus on Groups of 19 Years?</i></b> When estimating moon phases, it's useful to know how long it will be before the moon will be in the same phase on the same date. As it turns out, the answer is surprisingly accurate 19 years and 2 hours! This is known as the <a href="http://en.wikipedia.org/wiki/Metonic_cycle">Metonic cycle</a>.<br /><br />Over a 100-year period, the difference is only about 10.5 hours, so working in groups of 19 works very well in the estimate. The estimation itself adjusts every 100 years, and takes this into account.<br /><br /><b><i>Why Multiply the Years by 11?</i></b> If the moon revolved exactly 12 times around the Earth every <a href="http://en.wikipedia.org/wiki/Tropical_year">tropical year</a> (the technical name for the year as most people know it), we wouldn't need to make any adjustment for years, as the moon would always be in the same phase on the same day.<br /><br />If it took the moon, say, 2 days short of a tropical year to revolve exactly 12 times, then we'd have to adjust by adding 2 days for every year. This would be done simply by multiplying by 2.<br /><br />It turns out that the <a href="http://www.wolframalpha.com/share/clip?f=d41d8cd98f00b204e9800998ecf8427e88np7d576o">time required for 12 revolutions of the moon is about 10 <sup>7</sup>⁄<sub>8</sub> days short of a tropical year</a>. This is approximated in the estimation formula through multiplying by 11.<br /><br /><b><i>Why Do Years Range From -9 to 9, Instead of 0 to 18?</i></b> Over the 19-year Metonic cycle, that small <sup>1</sup>⁄<sub>8</sub> day difference can start to add up. 18 years × <sup>1</sup>⁄<sub>8</sub> day = <sup>18</sup>⁄<sub>8</sub> day = 2<sup>1</sup>⁄<sub>8</sub> days!<br /><br />When originally developing the moon phase estimation formula, John Conway worked out the rather ingenious -9 to +9 approach you learned. What's so ingenious about it?<br /><br /><a href="https://www.desmos.com/calculator/vibdrcyght">Go to this Desmos Calculator page</a>, and drag the slider back and forth from 0 to 18 years. The red bar shows the <sup>1</sup>⁄<sub>8</sub>-day difference building up over that time. The numbers on the y-axis (the vertical axis) represent the total number of days in error.<br /><br />By comparison the blue bar, representing the -9 to +9 approach, through the first 9 years, and then begins to decrease dramatically as you add more years!<br /><br />Hopefully, this gives you a better idea of how this reduces the margin of error.<br /><h3>What is the Margin of Error?</h3>With all the approximate numbers we're using, the resulting accuracy of this estimation is quite amazing.<br /><br />To give you an idea of just how accurate it can be, I've provided the following calendar. You can use the drop-down menus to select any month from January 1900 to December 2099, and the calendar will instantly change.<br /><br /><i>Est.</i>, in each day, represents the estimated age of the moon you get by working through the method in this tutorial.<br /><br /><i>Real</i> is the actual age of the moon, using calculations from <a href="http://www.amazon.com/dp/0521356296/ref=as_li_ss_til?tag=greymatt-20&camp=0&creative=0&linkCode=as4&creativeASIN=0521356296&adid=1S9RP0V2K8S17EZGG1MX"><i>Practical Astronomy with Your Calculator</i>, 3rd edition</a> (<a href="http://www.amazon.com/dp/0521146542/ref=as_li_ss_til?tag=greymatt-20&camp=0&creative=0&linkCode=as4&creativeASIN=0521146542&adid=0MM379F2R934RESE4A4J">The newest edition includes spreadsheet calculations</a>), modified from <a href="http://biology.clc.uc.edu/steincarter/moon/moon%20code.htm">javascript code by Janet L. Stein Carter</a>.<br /><br />As I've modified them, these calculations reflect the phase of the moon as it appears at noon in <a href="http://en.wikipedia.org/wiki/Greenwich_Mean_Time">Greenwich Mean Time</a> on each given day. The moon's age in degrees, from 0° to 359°, is converted into its age in days in the <a href="http://en.wikipedia.org/wiki/Month#Synodic_month">synodic month</a>, and then rounded to the nearest whole number.<br /><br /><table class="choose" border="0"><tr> <td class="menu"><select id="mnthselect"><option value=0>January</option><option value=1>February</option><option value=2>March</option><option value=3>April</option><option value=4>May</option><option value=5>June</option><option value=6>July</option><option value=7>August</option><option value=8>September</option><option value=9>October</option><option value=10>November</option><option value=11>December</option></select></td> <td class="menu"><select id="cntselect"><option value=19>19</option><option value=20>20</option></select></td> <td class="menu"><select id="yrselect"><option value=0>00</option><option value=1>01</option><option value=2>02</option><option value=3>03</option><option value=4>04</option><option value=5>05</option><option value=6>06</option><option value=7>07</option><option value=8>08</option><option value=9>09</option><option value=10>10</option><option value=11>11</option><option value=12>12</option><option value=13>13</option><option value=14>14</option><option value=15>15</option><option value=16>16</option><option value=17>17</option><option value=18>18</option><option value=19>19</option><option value=20>20</option><option value=21>21</option><option value=22>22</option><option value=23>23</option><option value=24>24</option><option value=25>25</option><option value=26>26</option><option value=27>27</option><option value=28>28</option><option value=29>29</option><option value=30>30</option><option value=31>31</option><option value=32>32</option><option value=33>33</option><option value=34>34</option><option value=35>35</option><option value=36>36</option><option value=37>37</option><option value=38>38</option><option value=39>39</option><option value=40>40</option><option value=41>41</option><option value=42>42</option><option value=43>43</option><option value=44>44</option><option value=45>45</option><option value=46>46</option><option value=47>47</option><option value=48>48</option><option value=49>49</option><option value=50>50</option><option value=51>51</option><option value=52>52</option><option value=53>53</option><option value=54>54</option><option value=55>55</option><option value=56>56</option><option value=57>57</option><option value=58>58</option><option value=59>59</option><option value=60>60</option><option value=61>61</option><option value=62>62</option><option value=63>63</option><option value=64>64</option><option value=65>65</option><option value=66>66</option><option value=67>67</option><option value=68>68</option><option value=69>69</option><option value=70>70</option><option value=71>71</option><option value=72>72</option><option value=73>73</option><option value=74>74</option><option value=75>75</option><option value=76>76</option><option value=77>77</option><option value=78>78</option><option value=79>79</option><option value=80>80</option><option value=81>81</option><option value=82>82</option><option value=83>83</option><option value=84>84</option><option value=85>85</option><option value=86>86</option><option value=87>87</option><option value=88>88</option><option value=89>89</option><option value=90>90</option><option value=91>91</option><option value=92>92</option><option value=93>93</option><option value=94>94</option><option value=95>95</option><option value=96>96</option><option value=97>97</option><option value=98>98</option><option value=99>99</option></select></td> </tr></table><div id="calendar"></div></div></div><script src="https://dl.dropboxusercontent.com/u/23420016/js/jquery.calendar-widget.js"></script><br /><script src="https://dl.dropboxusercontent.com/u/23420016/js/mooncalc.js"></script>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com13tag:blogger.com,1999:blog-2800835365312821409.post-37061189650693989932012-07-29T11:30:00.000-07:002012-07-29T11:31:11.311-07:00Mental Division: Decimal Accuracy<ul id="tabs"><span id="fullpost"><li><a id="dc1" href="#intro" class="s">Intro</a></li><li><a id="dc2" href="#basics" class="s">2-11</a></li><li><a id="dc3" href="#nearhun" class="s">Near 100</a></li><li><a id="dc3" href="#expnd" class="s">Expanding</a></li></span></ul><div class="panes"><div><h3>Introduction</h3>While there are many mental math sites and videos freely available on the internet, very few seem to focus on division.<br /><br />That's likely because division rarely comes out nice and neat, like addition, subtraction, and multiplication do. You have to deal with “leftovers” in the forms of remainders, fractions, or decimals.<br /><br />Fractions are often seen as the most human-friendly way of expressing left-over numbers. Consequently, being able to give exact decimals, especially for unusual fractions such as 5/7 or 13/15, seems like an amazing feat to most people.<br /><br />This tutorial will focus solely on division problems whose results are less than 1. For example, you'll learn how to deal with 5 ÷ 7 (or the equivalent fraction 5/7), but not how to deal with, say, 16 ÷ 7 (or 16/7).<br /><br />Fortunately, there are numerous patterns of which we can take advantage, that will help make the task much easier than many people would suspect. <a href="#basics" class="jumpup">You can start learning about these patterns in the next section</a>.<br /></div><div><h3>Fractions to Memorize</h3>When dealing with smaller divisors, such as those from 2 to 11, it's quite useful to have the decimal equivalents of all such problems less than 1 memorized.<br /><br />You probably already know all the answers for dividing by 2 through 4 already:<br /><br />1/2=.5<br /><br />1/3=.333... (the dots are used to refer to the <a href="http://www.wolframalpha.com/input/?i=1%2F3">endless repetition of digits</a>)<br />2/3=.666...<br /><br />1/4=.25<br />2/4=1/2=.5<br />3/4=.75<br /><br />Dividing by 5 is very easy. You just double the <a href="http://en.wiktionary.org/wiki/numerator">numerator</a>, and put a decimal point in front of it:<br /><br />1/5=.2<br />2/5=.4<br />3/5=.6<br />4/5=.8<br /><br />You also already know how to divide most of the numbers by 6, as well:<br /><br />2/6=1/3=.333...<br />3/6=1/2=.5<br />4/6=2/3=.666...<br /><br />All you have to know is two more 6ths:<br /><br />1/6=.1666...<br />5/6=.8333...<br /><br />I'll come back to the 7th, but for now, I'm going to cover the 8ths, since they're not much more difficult than 4ths. The trick here is to multiply the numerator by 125, and stick the decimal point in front of it: <br /><br />1/8=.125<br />2/8=1/4=.250<br />3/8=.375<br />4/8=1/2=.500<br />5/8=.625<br />6/8=3/4=.750<br />7/8=.875<br /><br />The last one almost everyone is familiar with is how to express 10ths:<br /><br />1/10=.1<br />2/10=.2<br />3/10=.3<br />4/10=.4<br />5/10=.5<br />6/10=.6<br />7/10=.7<br />8/10=.8<br />9/10=.9<br /><h3>New Patterns</h3>To be able to memorize every fraction/division problem up to dividing by 11, then, all most people need to learn is how to handle 7ths, 9ths, and 11ths.<br /><br />9ths are especially easy, as you simply start with the decimal point, and repeat the numerator endlessly:<br /><br />1/9=.111...<br />2/9=.222...<br />3/9=.333...<br />4/9=.444...<br />5/9=.555...<br />6/9=.666...<br />7/9=.777...<br />8/9=.888...<br /><br />If you know your multiples of 9 up to 10, then you can handle 11ths. Simply multiply the numerator by 9, and express that as a 2-digit number (9 × 1 = “09”). Repeat these 2 digits endlessly, and you've got your 11ths:<br /><br />1/11=.090909...<br />2/11=.181818...<br />3/11=.272727...<br />4/11=.363636...<br />5/11=.454545...<br />6/11=.545454...<br />7/11=.636363...<br />8/11=.727272...<br />9/11=.818181...<br />10/11=.909090...<br /><br />Finally, there's the 7ths. The 7ths have a very unusual pattern, starting with 1 ÷ 7:<br /><br />1/7=.<b>142857</b>142857142857...<br /><br />Notice that same sequence of numbers, 142857, repeats over and over again. To make things even easier, every 7th has this same repeating pattern. The only thing that changes is which number comes immediately after the decimal point. Here are the 7ths:<br /><br />1/7=.<b>1</b><i>42857</i>142857142857...<br />2/7=.<b>2</b><i>85714</i>2857142857...<br />3/7=.<b>4</b><i>28571</i>42857142857...<br />4/7=.<b>5</b><i>71428</i>57142857...<br />5/7=.<b>7</b><i>14285</i>7142857...<br />6/7=.<b>8</b><i>57142</i>857142857...<br /><br />To determine which number comes first, simply multiply the numerator by 14, and note the digit in the 10s place. That will be the digit that comes first. For example, with 3/7ths, you'd do 3 × 14 = 42, and since 4 is the digit in the tens place, you'd start the pattern with 4, giving you .42857142857... and so on.<br /><br />Once you're comfortable with these basic memorized patterns, you're ready to move full speed ahead <a href="#nearhun" class="jumpup">to the next section, where you'll learn to divide by numbers near 100</a>.<br /></div><div><h3>Dividing by 100</h3>Dividing a 2-digit number by 100 is easy, of course. Take the numerator, place the decimal point in front of it, and you're done. 46/100? .46! 67/100? .67!<br /><h3>Dividing by 99</h3>Surprisingly, dividing a 2-digit number by 99 is almost as easy as dividing by 100. The only difference is that the numerator repeats without end. <a href="http://www.wolframalpha.com/input/?i=46%2F99">46/99? .464646...</a>! <a href="http://www.wolframalpha.com/input/?i=67%2F99">67/99? It's .676767...</a>!<br /><br />Think of 99 as being like 100, but since the 9s repeat, so does the numerator.<br /><h3>Dividing by 90</h3>The technique for dividing any number from 1 to 89 by 90 takes us back to grade school math. Remember learning long division and getting answers like “3 remainder 7”? That's the type of thinking you'll need here.<br /><br />To divide a 2-digit number by 90, just divide the numerator by 9, but work out the answer in the “<i>x</i> remainder <i>y</i>” format. Once you know that, <i>x</i> will be the first digit after the decimal point, and <i>y</i> repeats after that.<br /><br />For example, let's work out 58 ÷ 90. Ask yourself, what is 58 divided by 9? Assuming your know your multiplication tables, you should think of it as 6 remainder 4. That means <a href="http://www.wolframalpha.com/input/?i=58%2F90">the decimal equivalent of 58 ÷ 90 is .6444...</a>.<br /><br />Remember this trick for 90 by thinking of the way you divided by <b>9</b> when you had <b>0</b> knowledge of fractions.<br /><h3>Dividing by 91</h3>To dividing by 91, you'll first need to know how to multiply any number from 1 through 90 by 11. <a href="http://www.youtube.com/watch?v=4jXG71q8AxY">Below is a video to give you a good quick tutorial</a> if you're not already familiar with the technique (<a href="http://worldsciencefestival.com/videos/quick_multiply_by_11">If your browser supports Flash, here's another excellent tutorial</a>). <a href="http://www.themathworld.com/MathTricks/multiplyby11.html">There's also a page where you can practice</a>.<br /><br /><iframe width="530" height="398" src="http://www.youtube.com/embed/4jXG71q8AxY?rel=0" frameborder="0" allowfullscreen></iframe><br /><br />To divide by 91, you start by multiplying the numerator by 11, and then subtract 1. This number will likely be 3 digits, but if it's only 2 digits, place a 0 in front of it (76, for example, becomes 076). Put a decimal point in front of this 3 digit number, and you've got the first 3 digits of your answer.<br /><br />To get the next 3 digits of the answer, subtract each of the digits from the previous step from 9. At this point, the number will repeat with the same 6 digits forever.<br /><br />As a full example, let's work out 44 ÷ 91. We multiply 44 by 11 to get 484, and subtract 1, so we have 483. The first 3 digits of the answer, then are .483. Next, we work out 9 (always) - 4 (first digit) to get 5. 9 - 8 (second digit) = 1 and 9 - 3 (third digit) = 6, so the next 3 digits are these answers, 5, 1, and 6. Putting that all together, and repeating those same 6 digits, <a href="http://www.wolframalpha.com/input/?i=44%2F91">the decimal comes to .483516483516...</a>.<br /><br />If you think of the 6 digits in the answer as two 3-digit numbers that always add up to 999, (Such as 483 and 516 in our previous example) it makes this easier. Since 91 ends in 1 just like 11, it's easy to remember that the technique for dividing by 91 involves multiplying by 11.<br /><h3>Dividing by 98</h3>98 has a particularly surprising pattern. To start, you begin with the numerator, adding a 0 in front if it's a 1-digit number, and keep doubling the number. For example, with 6 ÷ 98, we start with 06 after the decimal point and keep doubling:<br /><pre>06 12 24 48</pre>Checking with Wolfram|Alpha, we see that <a href="http://www.wolframalpha.com/input/?i=6%2F98">6 ÷ 98 does indeed start with .06122448</a>!<br /><br />There are two more rules you need to know for this technique. First, anytime your doubling sequence gives you a number of 49 or more, you need to add 1 before continuing. Second, when you continue the sequence, double that modified number, but only give the last two digits. Continues the sequence as if these last two digits were just another two digits in the sequence, remembering to follow both of these rules.<br /><br />To make this clearer, let's work out 16 ÷ 98. We start the series as before:<br /><pre>16 32 64</pre>Stop! That 64 is over 49, so we need to add 1, making it a 65:<br /><pre>16 32 65</pre>From there, we double 65 to get 130, but remember the second rule, that we only include the final two digits, the 30:<br /><pre>16 32 65 30</pre>From here, we continue as if 30 were just another 2-digit number in the sequence. The next number would be 60, which is more than 49, so we add 1:<br /><pre>16 32 65 30 61</pre>Sure enough, <a href="http://www.wolframalpha.com/input/?i=16%2F98">16 ÷ 98 works out to be .1632653061 (and beyond)</a>.<br /><br />Once you get the hang of these rules, you can carry out the decimal equivalent as far as you like. Remember the add 1 rule even when you're starting with a number equal to or more than 49. For 78 ÷ 98, you'd start by adding 1 to 78, and continue from there:<br /><pre>79 59 18 36 73</pre>Do you follow the pattern there? If so, then <a href="http://www.wolframalpha.com/input/?i=78%2F98">you can mentally work out that 78 ÷ 98 is .79591836734693877551020408</a> and even go beyond that if you like!<br /><br />Since 98 is 2 away from 100, remembering this slightly unusual doubling sequence shouldn't be a problem.<br /><br />Take some time and master these specific numbers. When you're ready to move on, <a href="#expnd" class="jumpup">I'll show you how to use what you already know to automatically handle even more division problems</a>.<br /></div><div><h3>Reduce</h3>As with many things in life, simplifying before working on the problem is the first thing you should do. If you get a problem such as 25 ÷ 35, or a number like 25/35ths, reduce the problem by dividing both parts by the same number, and keep doing this until you make the two numbers as small as possible. When you realize this boils down to 5/7, you can use the 7ths technique to realize that <a href="http://www.wolframalpha.com/input/?i=25%2F35">this works out to .7142857...</a>.<br /><br /><a href="http://www.youtube.com/watch?v=hSOPHZFmz3s">Here's a quick refresher course in reducing division problems and fractions</a>:<br /><br /><iframe width="530" height="298" src="http://www.youtube.com/embed/hSOPHZFmz3s?rel=0" frameborder="0" allowfullscreen></iframe><br /><br />Being familiar with the <a href="http://www.youtube.com/watch?v=Df9h5t64NlQ">quick divisibility tests for the numbers 2, 3, 4, 5, 6, 9, and 10</a> will help greatly here.<br /><h3>Enlarge</h3>Attempting to reduce the fraction or division problem should always be your first step, but sometimes you just can't reduce the problem to dividing to 2 through 11. This is where knowing how to divide by numbers near 100 comes in handy. See if you can make the problem larger, into one you're already familiar with.<br /><br />Let's say you want to know the decimal equivalent of 11/25ths. You don't have a technique for handling 25ths, but if you scale both parts of the problem up so it reads as 44/100, then it's easily apparent that the answer is .44.<br /><br />What about 13/15ths? Multiply both numbers by 6, and you get 78/90ths, which you should easily <a href="http://www.wolframalpha.com/input/?i=13%2F15">work out to .86666...</a> using the strategies you've learned.<br /><br />Similarly, dividing by 13 can be turned into dividing by 91 by multiplying times 7 (because 91= 13 × 7) and dividing by 33 becomes dividing by 99 just by multiplying by 3. You can also divide by 49 by scaling up by 2, which turns it into a problem of dividing by 98.<br /><br />If you need to divide by 14, and you can't reduce it to 7ths, you can multiply both numbers by 7 to turn it into a problem of dividing by 98. 11/14ths won't reduce to 7ths, but will scale up to <a href="http://www.wolframalpha.com/input/?i=11%2F14">77/98ths, or .7857142857...</a>.<br /><h3>Reduce AND Enlarge</h3>Again, reducing should always be the first step, but sometimes enlarging the problem after reducing can help. For example, here's how to handle 24 ÷ 39. Both numbers are divisible by 3, so the same result can be obtained by reducing it to 8/13. We can then <a href="http://www.wolframalpha.com/input/?i=24%2F39%2C+8%2F13%2C+56%2F91">scale this problem up to 56/91</a>, and <a href="http://www.wolframalpha.com/input/?i=24%2F39">work out that it's .6153846...</a>.<br /><br />Using this approach, you'll be able to handle any problem involving dividing by 13, 14, 15, 18, 20, 25, 30, 45, 49, and 50. Often, you'll be able to handle many other numbers, as well. <a href="http://www.wolframalpha.com/input/?i=26%2F28">26/28ths is the same as 13/14ths, and thus 91/98ths</a>.<br /><h3>Estimate</h3>Sometimes, however, you're stuck with a division problem or fraction such as 32/43rds. That won't reduce to anything, and scaling the 43rds up to 86ths or 129ths doesn't bring up any familiar divisors.<br /><br />If you look closely, however, you can see that it's quite close to 33/44, or 3/4, so you can estimate that it's roughly .75. <a href="http://www.wolframalpha.com/input/?i=32%2F43">32/43 works out to roughly .7441860</a>, so you can see that this is a good guess.<br /><br />Most lessons in estimating fractions, <a href="http://www.youtube.com/watch?v=Q3yiWwyuYiM">such as this video</a>, focus on rounding to 0, ½, or 1, but if you can round to the nearest 3rd, 4ths and 5ths, your estimated answers will improve greatly.<br /><br />I hope you've found this tutorial useful and enjoyable!<br /></div></div>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com1tag:blogger.com,1999:blog-2800835365312821409.post-83665419426406685862012-05-01T16:30:00.001-07:002012-05-01T16:40:57.389-07:00How To Play and Win Notakto: 3+ Boards<ul id="tabs"><span id="fullpost"><li><a id="notaktotwo1" href="#review" class="s">Review</a></li><li><a id="notaktotwo2" href="#threeboards" class="s">3 Boards</a></li><li><a id="notaktotwo3" href="#present" class="s">Presenting</a></li><li><a id="notaktotwo4" href="#tips" class="s">Tips</a></li></span></ul><div class="panes"><div><h3>Review</h3>For those who have come across this post by accident, this is Part 2 of a 2-part post on a tic-tac-toe-like game called Notakto. <a href="http://gmmentalgym.blogspot.com/2012/05/how-to-play-and-win-notakto.html#intro">Part 1 can be found here</a>, and will give you a more complete introduction to the game, as well as lessons on how to play and win on 1 or 2 boards against someone else.<br /><br /><span id="fullpost">Everything from this point on assumes that you've practiced all the strategies and can win 1- and 2-board Notakto games every time.<br /><br />You should know and understand the importance of terms like sacrifice, boot trap, and 2X trap. You should also be very familiar with the few rules we've introduced so far:<br /><blockquote>• When playing on an <b>odd</b> number (1, 3, 5, etc.) of Notakto boards, you can guarantee yourself a win by being Player 1 - the <b>odd</b>-numbered player. When playing on an <b>even</b> number (2, 4, 6, etc.) of Notakto boards, you can guarantee yourself a win by being Player 2 - the <b>even</b>-numbered player.<br /><br />• Your first move will always be placing your X in the center square of any empty board (empty board refers to any Notakto board with no Xs already on it).<br /><br />• When the other player marks their X on a board with pre-existing Xs, your next move will be made on that same board. When the other player marks their X on a previously-empty board, your next X will be placed in the center of another empty board.</blockquote><br />Starting from this point, I'll show you how to generalize what you already know to play and win Notakto on 3 boards, 4 boards, and beyond!<br /><br /><a href="#threeboards" class="jumpup">In the next section</a>, you'll start by learning how to play 3 boards.<br /></span><br /></div><div><h3>3 Boards</h3>Let's start with the simplest example of a 3-board Notakto game.<br /><br />Since there are an odd number of boards, you start the game, and mark an X in the center of any board. In this example, the other player responds by marking an X on the same board, and your reply is to sacrifice that board. <br /><br /><table><tr><td><div id="sacr_board" style="margin-left:35px;"></div></td><td><div id="blank_b"></div></td></tr></table><div id="blank_c" style="margin-left:152px;"></div><br />At that point, the game reduces to a 2-board Notakto game with the other player effectively going first. Even before they place their first X on the remaining boards, you should already know that you're going to win.<br /><br />This is the basis of another general rule you should keep in mind:<br /><blockquote>Your basic strategy is to sacrifice boards, until you get down to the final remaining 2 boards. These remaining 2 boards will be played just as you would play any standard 2-board Notakto game.</blockquote><h3>Marking a Different Board</h3>In this next example, you play first once again, but your opponent marks an X on the edge (it could just as easily be a corner or the center) of a different board. You recall this rule, and respond accordingly:<br /><blockquote>When the other player marks their X on a previously-empty board, your next X will be placed in the center of another empty board.</blockquote>With 3 boards, all 3 now have an X on them. From there, you play to eliminate the first board you can, and play the rest as a standard 2-board Notakto game.<br /><br /><table><tr><td><div id="three_full_a" style="margin-left:35px;"></div></td><td><div id="three_full_b"></div></td></tr></table><div id="three_full_c" style="margin-left:152px;"></div><br />There are a few more lessons we can learn from this game. First, if your opponent doesn't mark a previously-empty board in the center, the defenses you've learned will usually prevent them from placing an X in the center of that same board until they're forced to. Of course, if they do mark a previously-empty board with an X in the center, you can easily sacrifice it or set up a boot trap, as needed.<br /><br />Because of the rule that tells you when to be player 1 or player 2, combined with the rule that tells you when to place an X in the center of a previously-empty board, you can always guarantee yourself a minimum number of boards with Xs in the center.<br /><br />With an even number, such as 4, going second and only marking previously-empty boards after your opponent does the same thing, it's easy to see a pattern of theirs-yours-theirs-yours guarantees you a minimum of 2 boards with Xs in the center (it's also possible ALL of them could have Xs in the center). Extending this to 6, you should easily see that the minimum number of boards with Xs in the center will be 3. Given any <b><i>even</i></b> number <i>n</i>, the minimum number of Xs in the center you'll have is <i>n</i>/2.<br /><br />What about odd numbers? With an odd number of boards, you always start, effectively guaranteeing yourself an extra board with an X in the center. So, for any <b><i>odd</i></b> number of boards <i>n</i>, the minimum number of boards with Xs in the center works out to be (<i>n + 1</i>)/2. For 3 boards, that is (3+1)/2 = 4/2 = 2 boards minimum with Xs in the center. For 5 boards, you'll have a minimum of 3 boards with Xs in the center, and so on.<br /><br />Why are the Xs in the center so important? When learning how to play 2-board Notakto, your defense depended on at least one of the two boards having an X in the center. Even if you didn't end the game on this particular board, it was the board with the X in the center which allowed you to keep control of both boards and win with either one.<br /><br />Because of this, we're going to amend the rule taught from the simple 3-game demonstration above. The revised rule is below:<br /><blockquote>Your basic strategy is to sacrifice boards, until you get down to a set of boards, only 1 of which has an X in the center. On the sole remaining board with an X in the center, you will build your boot trap. If there are two or more boards without Xs in the center, play to sacrifice them until you get down to 2 boards (one of which is the board with an X in the center). These remaining 2 boards will be played just as you would play any standard 2-board Notakto game.</blockquote>It's time once again to practice. Practice 3-board Notakto either <a href="http://plambeck.org/t5.html">online</a> or with the <a href="http://notakto.com/">iPad Notakto app</a> until you can win every time.<br /><br />Once you feel confident playing and winning 3-board Notakto every time, you're ready to apply what you know to win on 4 boards, 5 boards, and beyond! Just make sure you can win every time on a given number of boards, before moving on. You'll probably notice that it takes you less and less time to play perfect games on each level.<br /><br />Once you can win every time on any level, it's time to stop playing against computers and <a href="#present" class="jumpup">learn how to present this as a game to real people</a>.<br /></div><div><h3>How To Present Notakto</h3>Now that you know how to play and win Notakto every time, it's time to learn how to present this to a real person. My first bit of advice comes from <a href="http://geniimagazine.com/magicpedia/Bob_Farmer">Bob Farmer</a>, who would often include the following warning in his <i>Flim-Flam!</i> column:<br /><blockquote><b>Caveat Scamtor:</b> Ethical Hustlers warn the Mark the game is fixed. Money lost is an educational investment. Gambling may be illegal where you live. Information in this column may be wrong, so don't bet the farm until you've verified it's right.</blockquote>Since Notakto is so similar to tic-tac-toe, that's often the best way to introduce it. Here are a few key points that help when introducing the game:<br /><br />• <i>“Ever play tic-tac-toe? It's fun until you get to the point where both players are good enough that it's always a tie.”</i> - This brings up the topic, and establishes familiarity.<br /><br />• <i>“My friends and I liked the fact you could play it almost anywhere, but hated those tie games, too.”</i> - This takes the familiarity, and gives a reason for the non-standard rules you're about to introduce.<br /><br />• <i>“To prevent the ties, we decided that both players should play as X. After all, if you only mark Xs on the board, somebody has to get 3 in a row sooner or later, right?”</i> - This introduces the all-Xs rule in a sensible way.<br /><br />• <i>“After some testing, we found it makes for a longer and more interesting game when the person who makes 3 Xs in a row is the loser instead of the winner.”</i> - This brings up the other major rule change. Note that both new rules are introduces with the real reasons for their existence.<br /><br />• <i>“We've found it's even more fun when played on more than one board at the same time! When we do that, any board with 3 Xs in a row is out of play, and the last person to make 3 Xs in a row on the last available board is the loser.”</i> - This quickly establishes the idea and rules of multiple board play. It is <b><i>important</i></b> for later than you do not mention a specific number of boards at this point.<br /><h3>Who Plays First?</h3>At this point, you've already mentioned that the game will be played on multiple boards, but avoided mentioning exactly how many. This is about to give you the advantage in the game.<br /><br />Ask the other player whether they'd like to go first.<br /><br />If they decide that they're going first, draw 2 boards (or 4, if you prefer), and invite them to place their X anywhere. If they decide you're going first, draw 3 boards (5 is often too intimidating for a first game), and mark your X in the center square of any board, as usual.<br /><br />You've subtly guaranteed yourself a win by having their choice of who goes first determine the number of boards!<br /><br />If you want to state the number of boards before asking whether they go first, mention specifically that you'll be playing on 3 boards (or any odd number), and ask whether they'd like to go first. If they let you play first, play and win the game as normal.<br /><br />If they decide they're going to play first instead, mention that, since the game is new to them, you should start with a practice game, so they can get the idea. Play the practice game, preferably playing to lose to build their confidence. Remind them once or twice through this game that it's a practice game. Once this “practice game” is over, play a legitimate game, mentioning that, because they went first last time, you get to go first this time.<br /><br /><a href="#tips" class="jumpup">You can find more tips on presenting Notakto in the next section.</a><br /></div><div><h3>Tips</h3>• One more suggestion for the “practice game” technique: You could always have your practice game take place on a single board, explaining that this is to help them get the idea. Then, for the real game, you can move on to 3 boards as promised, in which you go first in that game, since they went first in the practice game.<br /><br />• After you make each move during the game, you'll notice that usually all available boards will have an odd number (1, 3, or 5) of Xs. Naturally, this means that before you make your move, there will be only one board with an even number of Xs. This can act as a strong signal to tell you which board you need to play.<br /><br />There are two exceptions to this pattern:<br /><br />1) At the beginning of the game, when your opponent has just marked an X on a previously-empty board. In this situation, you're going to mark a new board with an X in the center square, of course. That makes this one case where each board played starts with an odd number of Xs before you play, while the same is true after you play (since you're marking a new board).<br /><br />2) The other exception happens at the end of the game, the one <a href="http://gmmentalgym.blogspot.com/2012/05/how-to-play-and-win-notakto.html#attacked">described in the <i>Attacked!</i> section of this tutorial</a>. If you're down to two boards, one of which has an X at the center and the other one doesn't, and your opponent sacrifices the board with the X at the center, then each move you make will leave an even number of Xs on the remaining board, instead.<br /><br />• If you want to understand more about Notakto, here are a few helpful resources:<br /><br />- <a href="http://www.bgonline.org/forums/webbbs_config.pl?noframes;read=67080">Another puzzle</a> (bgonline.org discussion, where the idea was first posted to the internet)<br />- <a href="http://mathoverflow.net/questions/24693/neutral-tic-tac-toe">Neutral Tic-Tac-Toe</a> (MathOverflow discussion)<br />- <a href="http://plambeck.org/banff2011.pdf">Impartial Tic-Tac-Toe Presentation</a> (PDF)<br />- <a href="http://miseregames.files.wordpress.com/2012/04/x-onlyttt.pdf">The Secrets of Notakto: Winning at X-only Tic-Tac-Toe</a> (PDF)<br /><br /><br />• This winning strategies don't need to be top secret. If someone genuinely shows an interest in learning how to play Notakto and win every time, feel free to teach them and/or send them to this tutorial. Above all, enjoy it and have fun!<br /></div></div><script type="text/javascript">$(document).ready(function() { //http://headinside.blogspot.com/2012/04/secrets-of-nim-notakto.html var sacrifice_first = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], ]; var blank = [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ]; var three_full_one = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ] ]; var three_full_two = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", "x", " "], ["x", " ", " "], [" ", " ", " "] ], [ [" ", "x", " "], ["x", " ", " "], [" ", " ", "x"] ], [ ["x", "x", " "], ["x", " ", " "], [" ", " ", "x"] ], [ ["x", "x", "x"], ["x", " ", " "], [" ", " ", "x"] ], [ ["x", "x", "x"], ["x", " ", " "], [" ", " ", "x"] ], [ ["x", "x", "x"], ["x", " ", " "], [" ", " ", "x"] ], [ ["x", "x", "x"], ["x", " ", " "], [" ", " ", "x"] ], [ ["x", "x", "x"], ["x", " ", " "], [" ", " ", "x"] ], [ ["x", "x", "x"], ["x", " ", " "], [" ", " ", "x"] ] ]; var three_full_three = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", "x"], [" ", " ", " "] ], [ ["x", " ", " "], [" ", "x", "x"], [" ", " ", " "] ], [ ["x", "x", " "], [" ", "x", "x"], [" ", " ", " "] ], [ ["x", "x", " "], [" ", "x", "x"], ["x", " ", " "] ], [ ["x", "x", " "], ["x", "x", "x"], ["x", " ", " "] ] ]; $("div#sacr_board").tictactoeAnimator(sacrifice_first, 2500); $("div#blank_b").tictactoe(blank); $("div#blank_c").tictactoe(blank); $("div#three_full_a").tictactoeAnimator(three_full_one, 2500); $("div#three_full_b").tictactoeAnimator(three_full_two, 2500); $("div#three_full_c").tictactoeAnimator(three_full_three, 2500); }); </script>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com3tag:blogger.com,1999:blog-2800835365312821409.post-3607371535619314662012-05-01T16:30:00.000-07:002012-05-01T17:29:31.374-07:00How to Play and Win Notakto<ul id="tabs"><span id="fullpost"><li><a id="notakto1" href="#intro" class="s">Intro</a></li><li><a id="notakto2" href="#onebrd" class="s">1 board</a></li><li><a id="notakto3" href="#twobrds" class="s">2 boards</a></li><li><a id="notakto4" href="#sacrifice" class="s">Sacrificing</a></li><li><a id="notakto5" href="#xxtrap" class="s">2X Trap</a></li><li><a id="notakto6" href="#attacked" class="s">Attacked!</a></li></span></ul><div class="panes"><div><h3>Introduction</h3>Math professor and Backgammon expert Bob Koca was playing tic-tac-toe with his 5-year-old nephew, when the <a href="http://www.bgonline.org/forums/webbbs_config.pl?noframes;read=67080">nephew whimsically suggested that they should both play X</a>. After mathematically analyzing such a game, Professor Koca realized that this was a deceptive new version of the <a href="http://headinside.blogspot.com/search/label/nim">classic game of Nim</a>.<br /><br /><a href="http://thaneplambeck.typepad.com/">Thane Plambeck</a> later dubbed this game Notakto (pronounced No-tac-toe). In this tutorial, you'll learn how to play this game so that you can win every time!<br /><br /><span id="fullpost">Notakto is played on a standard 3-by-3 tic-tac-toe board, and the rules are as follows:<br /><br />• Both players alternate making an X on the board.<br /><br />• Players may mark on X on an available space (again, any space not already occupied by an X) any available board during their turn.<br /><br />• The person who makes a horizontal, vertical, or diagonal line of 3 Xs on the board is the <b><i>loser</i></b>.<br /><br />If you'd like to try out this game for yourself, <a href="http://plambeck.org/t5.html">you can play the first level online here</a> (click <i>reset</i> if you pass the first level to stay). If you have an iPad, you can <a href="http://notakto.com/">download and play the Notakto app here</a>.<br /><br />When referring to general types of squares, I'll use the terms <i>center</i>, <i>corner</i>, and <i>edge</i> to apply to the various squares as follows:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/notakto_areas.png" style="display:block;margin-left:auto;margin-right:auto;" /><br /><br />When I need to refer to a square in more specific terms, I'll refer to the various squares with these terms: <br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/notakto_squares.png" style="display:block;margin-left:auto;margin-right:auto;" /><br /><br />I'll also frequently use the terms <i>rotations</i> and <i>reflections</i>.<br /><br />If you rotate a given pattern of Xs through quarter turn (90°) increments to match another pattern of Xs, then those two patterns are <i>rotations</i> of each other. Two given patterns of Xs that are mirror images of each other, with left and right switched, and/or top and bottom switched, are <i>reflections</i> of each other.<br /><br />These are important concepts, since patterns that are rotations or reflections will share the same strategy.<br /><br />Now that you've got a basic understanding of the concepts involved, it's time to <a href="#onebrd" class="jumpup">learn how to win 1-board Notakto</a>!<br /></span></div><div><h3>Winning 1-board Notakto</h3><a href="http://mathoverflow.net/questions/24693/neutral-tic-tac-toe/24811#24811">Mathematician Timothy Chow originally likened the winning moves to that of a chess knight</a>. If you're not familiar with chess, chess knights move either 1 square vertically and 2 squares horizontally or 1 square horizontally and 2 squares vertically, resulting in an unusual L-shaped move.<br /><br />If we think of a chess knight on a Notakto board, you'll note that the knight in the corner square below (on your left) can only move into either of the edge squares marked with a dot. The knight located in the edge square (on your right) can only move into either of the corner squares marked with a dot.<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/notakto_knight.png" style="display:block;margin-left:auto;margin-right:auto;" /><br /><br />Because of the unusual way the knight moves, a knight in the center doesn't have any possible moves.<br /><br />Here's how to use the knowledge of a knight's move to win at Notakto.<br /><br />To guarantee yourself a win on 1-board Notakto, you must play first, and start by placing your X in the center.<br /><br />After each time the other player marks an X in a given square, you'll place your X a knight's move away from that square.<br /><br />As seen in the knight's move graphic above, there will often be two open squares that qualify. Before placing your X, make sure that you're not inadvertently making 3 in a horizontal, vertical, or diagonal line of 3 Xs, thus losing the game.<br /><br />Played properly, the resulting game should look something like this:<br /><br /><div id="onebrdwin" style="margin-left:152px;"></div><h3>Why This Works</h3>By starting with your X in the center, that limits every following move to be played on centers and edges, which are squares where you can use the knight's move strategy.<br /><br />If the other player places an X in a corner at this point, the knight's move will place your X on an edge square. Conversely, If the other player places an X in the edge at this point, the knight's move will place your X on a corner square. This results in a boot-shaped arrangement of Xs at this point:<br /><br /><div id="boottrp" style="margin-left:152px;"></div><br />I refer to this arrangement (and any rotations and reflections of this arrangement) as the <b><i>boot trap</i></b>. Take a close look at it. The other player in the boot trap above won't place their X in the lower edge or the upper right corner, because they would instantly lose the game.<br /><br />That leaves 4 remaining squares that seem harmless enough. However, when they place their X on any one of those squares, and you place your X a knight's move away (again, making sure you don't accidentally complete a horizontal, vertical, or diagonal line of 3 Xs), the board then looks something like this:<br /><br /><div id="fivetrp" style="margin-left:152px;"></div><br />Notice that placing ANY X on this board must result in a losing play! From the boot trap, you can always force this situation, which means you'll always be able to win the game.<br /><br />Practice 1-board Notakto <a href="http://plambeck.org/t5.html">online</a> or with the <a href="http://notakto.com/">iPad Notakto app</a> until you can always win.<br /><br />Once you feel comfortable enough with the 1-board strategy, it's time to <a href="#twobrds" class="jumpup">learn to win 2-board Notakto</a>!<br /><br /></div><div><h3>Playing 2-board Notakto</h3>For playing Notakto with 2 or more boards simultaneously, the rules are similar, but there are a few changes:<br /><br />• Both players alternate making an X on the board.<br /><br />• Once an individual board has a horizontal, vertical, or diagonal line of 3 Xs on it, that board becomes unavailable (no more moves may be made on it).<br /><br />• Players may mark on X on an available space (any space not already occupied by an X on any <i>available</i> board) any available board during their turn.<br /><br />• The person who makes a horizontal, vertical, or diagonal line of 3 Xs <i>on the last available board</i> is the loser.<br /><br />While you'll still use the boot trap and the knight's move strategy, there are some new adjustments and new strategies to learn in order to win multi-board Notakto every time.<br /><br />To guarantee yourself a win in 2-board Notakto, the other player must go first. In fact, there is a simple pattern that will help guarantee you a win with any number of boards:<br /><blockquote>When playing on an <b>odd</b> number (1, 3, 5, etc.) of Notakto boards, you can guarantee yourself a win by being Player 1 - the <b>odd</b>-numbered player. When playing on an <b>even</b> number (2, 4, 6, etc.) of Notakto boards, you can guarantee yourself a win by being Player 2 - the <b>even</b>-numbered player.</blockquote>There's also a simple rule for remembering where to mark your first X:<br /><blockquote>Your first move will always be placing your X in the center square of any empty board (empty board refers to any Notakto board with no Xs already on it).</blockquote>When you go first, all the boards are empty, so of course you can make your first move this way. If you're Player 2, there will always be at least one other empty board after the other player's first move, so you can be assured of still having an empty board on which to mark the center square.<br /><br />These are great strategies for knowing how to start the game in your favor, but as I mentioned earlier, you'll need to learn some more strategies to assure yourself a win. <a href="#sacrifice" class="jumpup">The first new strategy is learning how to sacrifice a board</a>.<br /><br /></div><div><h3>Sacrificing</h3>Since only the person who makes a horizontal, vertical, or diagonal line of 3 Xs on the final available board loses, taking other boards out of play by purposely completing a line of 3 Xs can be very helpful. Taking a board out of play in this way is called <i>sacrificing</i>, just like the <a href="http://en.wikipedia.org/wiki/Sacrifice_(chess)">same concept in chess</a>.<br /><br />Let's start with the simplest possible example of sacrificing a board. In the example below, the other player is Player 1, and you are Player 2 (because there's an even number of boards, remember?).<br /><br />Their first move is the center square of one of the boards, and your reply is the center square of the remaining empty board. From this arrangement, no matter where they put their next X, there will always be 2 Xs in a line. Your response is to complete that line with a 3rd X, and sacrifice that board:<br /><br /><table><tr><td><div id="simple_sacr_a" style="margin-left:35px;"></div></td><td><div id="simple_sacr_b"></div></td></tr></table><br />Once that sacrifice is made, the game effectively reduces to a 1-board Notakto in which the other person is the second player. As shown in the animation above, you set up your boot trap, and proceed to win the game just as before!<br /><br />While the above game can and does happen, not every game happens in such a simple and straightforward manner.<br /><br />Our next example will still show the concept of sacrificing a board, but it will happen later, and after a more complex series of moves.<br /><br />This game starts, again, with the other player going first. This time, they're going to start in a corner (though it could just as easily be an edge), and you respond just as you should, marking an X in the center square of the remaining board.<br /><br />This time, however, the other player marks an X on the same board on which you just played your center X. What do you do in this case?<br /><br />Simple! You respond just as you would in 1-board Notakto, and set up your boot trap.<br /><br />From here, we'll assume the other player marks an X in line with the X they played first. Naturally, you complete the row of 3 and sacrifice that board. The game then returns to the board on which you've set up your boot trap, and you win in the usual way:<br /><br /><table><tr><td><div id="compl_sacr_a" style="margin-left:35px;"></div></td><td><div id="compl_sacr_b"></div></td></tr></table><br />This latter, more complex game actually shows a number of concepts that will be important through the rest of this tutorial:<br /><br />1) Any strategy you learn in this tutorial can be delayed and still remain effective.<br /><br />2) This is a another good lesson in determining which board to play:<br /><blockquote>When the other player marks their X on a board with pre-existing Xs, your next move will be made on that same board. When the other player marks their X on a previously-empty board, your next X will be placed in the center of another empty board.</blockquote><a href="#twobrds" class="jumpup">In the previous tab</a>, we discussed a similar rule that helps determine where you start. This rule, on the other hand, determines on which board you will continue play.<br /><br />Try practicing 2-board Notakto <a href="http://plambeck.org/t5.html">online</a> or with the <a href="http://notakto.com/">iPad Notakto app</a> using this approach, but don't be discouraged if you don't win.<br /><br />Playing this way will guarantee a win if the computer responds as we've assumed above, but you'll notice that there are some situations that haven't been covered yet. The most common is when they start on a corner or an edge, and the next time they make a move on that board, there's no way to make 3 Xs and sacrifice the board!<br /><br /><a href="#xxtrap" class="jumpup">In the next section</a>, you'll learn how to use that kind of play to set up another trap for the other player! <br /><br /></div><div><h3>The 2X Trap</h3>When the other player marks their first X in a corner or an edge, it's quite possible that their next move could prevent you from sacrificing the board on your next move. It's not uncommon to see a situation such as this (the X in the right board is yours, the 2 on the left belong to the other player):<br /><br /><table><tr><td><div id="sacr_stopped_a" style="margin-left:35px;"></div></td><td><div id="sacr_stopped_b"></div></td></tr></table><br />Another arrangement that could prevent an immediate sacrifice happens when two Xs are marked on edges that aren't directly across from each other (Again, the X in the right board is yours, the 2 on the left belong to the other player):<br /><br /><table><tr><td><div id="sacr_stopped_c" style="margin-left:35px;"></div></td><td><div id="sacr_stopped_d"></div></td></tr></table><br />In both of the above cases, the next move is yours. What is the best move to make?<br /><br />With both arrangements, the answer is exactly the same! You should place an X to make the pattern shown on the left board:<br /><br /><table><tr><td><div id="twoxstrapped_a" style="margin-left:35px;"></div></td><td><div id="twoxstrapped_b"></div></td></tr></table><br />Why? The next time your opponent places an X anywhere on a left board with that arrangement, they'll wind up with 2 Xs in a line. When they do, you can place the 3rd X and sacrifice that board! Yet again, you can prepare your boot trap on the right board, and win the game as usual.<br /><br />Because this design forces your opponent to place 2 Xs in a line, I refer to this as <i>the 2X trap</i>. It's easy to visualize, as the 2X trap always has 1 X in a corner, and 2 edge Xs, both of which are <a href="#onebrd" class="jumpup">a knight's move</a> away from the corner X.<br /><br />Below is a full game animated, in which the 2X trap is used. This particular game involves a rotation of the 2X trap depicted above, so you can get used to seeing it in another arrangment. As with all 2-board Notakto games, the other player goes first.<br /><br /><table><tr><td><div id="twox_played_a" style="margin-left:35px;"></div></td><td><div id="twox_played_b"></div></td></tr></table><br />As with the earlier example games, the 2X trap could be played even if you had developed the boot trap further on the left board. Delayed use of tactics, as I've said before, can still be effective.<br /><br />Go practice 2-board Notakto either <a href="http://plambeck.org/t5.html">online</a> or with the <a href="http://notakto.com/">iPad Notakto app</a> with your knowledge of the 2X trap, and you should find that you're winning more 2-board games than before.<br /><br />However, your 2-board game still won't be perfect. Sometimes, your opponent can be sneaky and sacrifice your carefully-prepared boot trap! <a href="#attacked" class="jumpup">You'll learn how to handle that situation in the next section</a>.<br /><br /></div><div><h3>When They Sacrifice Your Boot Trap</h3>Up to this point, every strategy discussed has involved sacrificing all but the last board (if any), and then winning the final board via the boot trap and the knight's move strategy that has been taught.<br /><br />It isn't difficult to conceive of sacrificing a board, however, and your opponent can do it just as easily as you can. Below is a snapshot of a 2-board Notakto game where the following has occurred:<br /><br />1) The other player moved first, and placed their X on an edge square (left board). You responded by placing your X in the center of the other (right) board.<br /><br />2) They marked their next x on an edge square on the right board, and you responded preparing your boot trap.<br /><br />3) They then marked an X on an edge square on the left board in such a way that you couldn't immediately sacrifice the board. You respond by setting up the 2X trap.<br /><br />4) They then surprise you by sacrificing the right board, ruining your boot trap.<br /><br />It's now your move. What do you do?<br /><br /><table><tr><td><div id="attacked_a" style="margin-left:35px;"></div></td><td><div id="attacked_b"></div></td></tr></table><br />In this situation, there's only one effective response. You must place your X in the corner directly opposite the other corner X in the 2X trap:<br /><br /><table><tr><td><div id="attacked_solved_a" style="margin-left:35px;"></div></td><td><div id="attacked_solved_b"></div></td></tr></table><br />Why does that work? While there are 5 remaining spaces open, the other player cannot place their X in the center or either of the open corner squares, because they'd lose the game. Their only possible response is to place their next X in one of the remaining edge squares, and your response will be to place your X in the other remaining edge square.<br /><br />After they mark their edge square, and you mark your edge square, it's their move again, and the board now looks like this:<br /><br /><table><tr><td><div id="attacked_final_a" style="margin-left:35px;"></div></td><td><div id="attacked_final_b"></div></td></tr></table><br />Anywhere they place their X on the left board, they must lose (Remember, the right board is out of play).<br /><h3>When They Sacrifice Early</h3>Sometimes, when the other player sacrifices your boot trap early, the other board only has a single X on a corner or an edge (If the other board had a single X in the center, then you built your boot trap too early and on the wrong board), like this:<br /><br /><table><tr><td><div id="attacked_early_a" style="margin-left:35px;"></div></td><td><div id="attacked_early_b"></div></td></tr></table><br />The response for this situation is easy, but different enough that it warrants its own section.<br /><br />The strategy for this situation is simple. Your next move is to <i>mirror</i> the placement of the other player's Xs. What do I mean by <i>mirroring the placement</i>?<br /><br />If they placed an X on the upper edge, you place your X on the lower edge (and vice-versa). If they placed an X on the right edge, you place your X on the left edge (and vice-versa).<br /><br />Similarly with the corners, if they placed an X on the upper left corner, you place your X on the lower right corner (and vice-versa). If they placed an X on the upper right corner, you place your X on the lower left corner (and vice-versa).<br /><br />In the case shown above, there an X in the lower left corner of the right board, and it's your move. The mirroring strategy tells you to place your X in the upper right corner, and keep mirroring their plays as discussed above.<br /><br />If they mark a mixture of corner and edge squares, and you mirror those appropriately the boards will eventually look like this after your last move:<br /><br /><table><tr><td><div id="attacked_early_mixed_a" style="margin-left:35px;"></div></td><td><div id="attacked_early_mixed_b"></div></td></tr></table><br />Does the pattern on the right board look familiar? It's the pattern of 6 Xs with an open diagonal (albeit a rotation of that earlier pattern) that ended the game discussed above.<br /><br />Alternatively, if the other player keeps marking Xs only in corners, and you keep mirroring the appropriate corners in response, you'll come to this pattern much more quickly after your last move:<br /><br /><table><tr><td><div id="attacked_early_corner_a" style="margin-left:35px;"></div></td><td><div id="attacked_early_corner_b"></div></td></tr></table><br />Even though there's only 4 Xs in this pattern, the other player must lose. It's their turn, and marking an X in the center or any edge means completing a horizontal, vertical, or diagonal row of 3 Xs, thus costing them the game.<br /><br />With everything you've learned here, you're now equipped with enough knowledge to win every 1-board and 2-board Notakto game everytime.<br /><br />To make sure you know how to use this knowledge, it's time again to practice 1-board and 2-board Notakto either <a href="http://plambeck.org/t5.html">online</a> or with the <a href="http://notakto.com/">iPad Notakto app</a>.<br /><br />Keep practicing until you can win the 1-board and 2-board games every time! Try and play without looking back at these strategies, but don't be afraid to look back at them when you need to do so.<br /><br />Not only have you learned all the strategies you need to win every 1- and 2-board Notakto game, you've also learned all the strategies you need to play on any number of boards! <a href="http://gmmentalgym.blogspot.com/2012/05/how-to-play-and-win-notakto-3-boards.html#review">In the next post</a>, I'll take what you've already learned and show you how to generalize those strategies so you can apply them to any number of boards.<br /></div></div><script type="text/javascript">$(document).ready(function() { //http://headinside.blogspot.com/2012/04/secrets-of-nim-notakto.html var oneboard_win_anim = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ ["x", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ ["x", " ", " "], [" ", "x", " "], [" ", "x", " "] ], [ ["x", " ", " "], [" ", "x", "x"], [" ", "x", " "] ], [ ["x", " ", " "], [" ", "x", "x"], ["x", "x", " "] ], [ ["x", "x", " "], [" ", "x", "x"], ["x", "x", " "] ] ]; var boot_trap = [ [" ", "x", " "], [" ", "x", " "], ["x", " ", " "] ]; var five_trap = [ [" ", "x", " "], ["x", "x", " "], ["x", " ", "x"] ]; var simple_sacrifice_anim_one = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", "x", " "] ] ]; var simple_sacrifice_anim_two = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", " ", "x"] ], [ [" ", "x", "x"], [" ", "x", " "], [" ", " ", "x"] ], [ [" ", "x", "x"], ["x", "x", " "], [" ", " ", "x"] ], [ ["x", "x", "x"], ["x", "x", " "], [" ", " ", "x"] ] ]; var complex_sacr_a = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", "x"], [" ", " ", " "] ], [ ["x", " ", " "], [" ", "x", "x"], [" ", " ", " "] ], [ ["x", " ", " "], [" ", "x", "x"], [" ", " ", " "] ], [ ["x", " ", " "], [" ", "x", "x"], [" ", " ", " "] ], [ ["x", " ", " "], [" ", "x", "x"], [" ", "x", " "] ], [ ["x", " ", "x"], [" ", "x", "x"], [" ", "x", " "] ], [ ["x", " ", "x"], ["x", "x", "x"], [" ", "x", " "] ] ]; var complex_sacr_b = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ ["x", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ ["x", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ ["x", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ ["x", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ ["x", " ", " "], [" ", " ", " "], [" ", " ", "x"] ], [ ["x", " ", " "], [" ", "x", " "], [" ", " ", "x"] ], [ ["x", " ", " "], [" ", "x", " "], [" ", " ", "x"] ], [ ["x", " ", " "], [" ", "x", " "], [" ", " ", "x"] ], [ ["x", " ", " "], [" ", "x", " "], [" ", " ", "x"] ] ]; var sacrifice_halted_a = [ ["x", " ", " "], [" ", " ", "x"], [" ", " ", " "] ]; var sacrifice_halted_b = [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ]; var sacrifice_halted_c = [ [" ", " ", " "], [" ", " ", "x"], [" ", "x", " "] ]; var two_x_trap = [ ["x", " ", " "], [" ", " ", "x"], [" ", "x", " "] ]; var two_x_game_a = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], [" ", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], ["x", " ", " "] ], [ [" ", "x", " "], [" ", "x", " "], ["x", " ", "x"] ], [ [" ", "x", " "], ["x", "x", " "], ["x", " ", "x"] ], [ ["x", "x", " "], ["x", "x", " "], ["x", " ", "x"] ] ]; var two_x_game_b = [ [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ], [ [" ", " ", " "], [" ", " ", " "], [" ", " ", "x"] ], [ [" ", " ", " "], [" ", " ", " "], [" ", " ", "x"] ], [ [" ", "x", " "], [" ", " ", " "], [" ", " ", "x"] ], [ [" ", "x", " "], ["x", " ", " "], [" ", " ", "x"] ], [ [" ", "x", " "], ["x", " ", " "], [" ", "x", "x"] ], [ [" ", "x", " "], ["x", "x", " "], [" ", "x", "x"] ], [ [" ", "x", " "], ["x", "x", " "], [" ", "x", "x"] ], [ [" ", "x", " "], ["x", "x", " "], [" ", "x", "x"] ], [ [" ", "x", " "], ["x", "x", " "], [" ", "x", "x"] ], [ [" ", "x", " "], ["x", "x", " "], [" ", "x", "x"] ], [ [" ", "x", " "], ["x", "x", " "], [" ", "x", "x"] ] ]; var sacrifice_boot_a = [ [" ", "x", " "], ["x", " ", " "], [" ", " ", "x"] ]; var sacrifice_boot_b = [ [" ", " ", " "], ["x", "x", "x"], [" ", " ", "x"] ]; var sacrifice_boot_solved_a = [ ["x", "x", " "], ["x", " ", " "], [" ", " ", "x"] ]; var sacrifice_boot_final_a = [ ["x", "x", " "], ["x", " ", "x"], [" ", "x", "x"] ]; var sacrifice_early_a = [ ["x", " ", " "], [" ", "x", " "], [" ", "x", "x"] ]; var sacrifice_early_b = [ [" ", " ", " "], [" ", " ", " "], ["x", " ", " "] ]; var sacrifice_early_mixed_b = [ [" ", "x", "x"], ["x", " ", "x"], ["x", "x", " "] ]; var sacrifice_early_corner_b = [ ["x", " ", "x"], [" ", " ", " "], ["x", " ", "x"] ]; $("div#onebrdwin").tictactoeAnimator(oneboard_win_anim, 2500); $("div#boottrp").tictactoe(boot_trap); $("div#fivetrp").tictactoe(five_trap); $("div#simple_sacr_a").tictactoeAnimator(simple_sacrifice_anim_one, 2500); $("div#simple_sacr_b").tictactoeAnimator(simple_sacrifice_anim_two, 2500); $("div#compl_sacr_a").tictactoeAnimator(complex_sacr_a, 2500); $("div#compl_sacr_b").tictactoeAnimator(complex_sacr_b, 2500); $("div#sacr_stopped_a").tictactoe(sacrifice_halted_a); $("div#sacr_stopped_b").tictactoe(sacrifice_halted_b); $("div#sacr_stopped_c").tictactoe(sacrifice_halted_c); $("div#sacr_stopped_d").tictactoe(sacrifice_halted_b); $("div#twoxstrapped_a").tictactoe(two_x_trap); $("div#twoxstrapped_b").tictactoe(sacrifice_halted_b); $("div#twox_played_a").tictactoeAnimator(two_x_game_a, 2500); $("div#twox_played_b").tictactoeAnimator(two_x_game_b, 2500); $("div#attacked_a").tictactoe(sacrifice_boot_a); $("div#attacked_b").tictactoe(sacrifice_boot_b); $("div#attacked_solved_a").tictactoe(sacrifice_boot_solved_a); $("div#attacked_solved_b").tictactoe(sacrifice_boot_b); $("div#attacked_final_a").tictactoe(sacrifice_boot_final_a); $("div#attacked_final_b").tictactoe(sacrifice_boot_b); $("div#attacked_early_a").tictactoe(sacrifice_early_a); $("div#attacked_early_b").tictactoe(sacrifice_early_b); $("div#attacked_early_mixed_a").tictactoe(sacrifice_early_a); $("div#attacked_early_mixed_b").tictactoe(sacrifice_early_mixed_b); $("div#attacked_early_corner_a").tictactoe(sacrifice_early_a); $("div#attacked_early_corner_b").tictactoe(sacrifice_early_corner_b); }); </script>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com0tag:blogger.com,1999:blog-2800835365312821409.post-67871709787985037672012-01-01T00:00:00.000-08:002012-01-01T02:03:01.528-08:00Sliding Calendar Puzzle<p><a href="#tabs">Click here to jump down to the rules of this puzzle.</a></p><div id="ifdisp" style="display:none;"><iframe frameborder=0 scrolling="no" width="530" height="725" src="http://dl.dropbox.com/u/23420016/15cal.html"></iframe></div><ul id="tabs"><span id="fullpost"> <li><a id="calfif1" href="#calfpuz" class="s">Puzzle</a></li> <li><a id="calfif2" href="#calfsolve" class="s">Solving</a></li></span></ul><div class="panes"><div><h3>Rules</h3>Somebody has mixed up the calendar! Can you help straighten it out? <span id="fullpost"><p>Just like the 15 puzzle, the object of this puzzle is to return all the pieces to their correct order. Instead of 15 pieces to move around, however, the puzzle below has 41 pieces. In addition, the calendar aspect adds an extra dimension to the challenge!</p><p>Note the year and month above the calendar puzzle itself. Your challenge is to arrange the pieces so that they form the correct calendar for that month and year. The following rules apply:</p><p><b>• The blue square marked with a “1” will always be located somewhere in the top row.</b> This should make sense. You don't start any calendar on the 2nd week.</p><p><b>• The blue numbered tiles are arranged on their corresponding days in the month.</b> If the 1st fell on a Tuesday in the given month, then the blue “1” needs to be placed in the Tuesday column, and so on.</p><p><b>• The blue numbered tiles must be arranged in numerical order, reading from left to right, then top to bottom.</b></p><p><b>• The white lettered tiles are used to fill in the remaining spaces not used by the dates, and must be arrange in alphabetical order, reading from left to right, then top to bottom.</b></p><p>For example, if you're given a 30-day month that begins on Tuesday, the goal would be to arrange the puzzle like this:</p><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/calslide/slidecalsample.png" style="margin-left:auto;margin-right:auto;display:block;" /><p>Note, in this example, that A and B are used to fill the first Sunday and Monday respectively, since the month begins on a Tuesday. After the month ends, the remaining lettered pieces, C through K, are used to fill the remaining spaces.</p><p>The <i>Year Range</i> selection menus can be used to choose the range of years for your next puzzle (the default range is 2000 to 2099), and the <i>New Puzzle</i> button will generate a new month and year, as well as shuffle the pieces.</p><p>For help in solving the puzzle, <a href="#calfsolve">try the next section</a>.</p><p>Post your record times and moves, along with the year and month you solved, in the comments!<br /><br /></p></span></div><div><h3>Solving</h3><p>The two challenges that were combined to make the sliding calendar puzzle are taught separately here in the Grey Matters Mental Gym.</p><p>First, learn how to solve the <a href="http://gmmentalgym.blogspot.com/2010/10/solving-15-puzzle.html">classic versions of the 15 puzzle in this tutorial</a>.</p><p>After that, you need to <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-revised.html">learn how to determine the day of the week for any given date</a>.</p><p>To apply them to this particular puzzle, consider the year and month you're given, along with the first of the month. Once you figure out on which day of the week the first day falls, you also know which lettered tiles (if any) come before it.</p><p>Once you get the first lettered and numbered tiles in place, it's mostly like solving the original 15 puzzle.</p><p>When you get to the last two rows, the tricky part becomes working out which letter goes below which other piece. If you take into account where the letters in the top row (again, if any) left off, and how many days are in the month, this isn't too difficult.</p><p>Yes, you could cheat and look up the given month calendar online, but it's far more impressive to do it without looking.</p></div></div><script type='text/javascript'>//<![CDATA[ $(document).ready(function() { whr = location.href; whr = whr.toLowerCase(); wrtst = whr.indexOf('sliding-calendar-puzzle'); if (wrtst != -1) { $('div#ifdisp').css('display','block'); }; }); //]]></script>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com2tag:blogger.com,1999:blog-2800835365312821409.post-72313546940071460662011-07-17T14:00:00.000-07:002011-07-17T14:04:57.327-07:00Unit Circle 2: Trig Functions<ul id="tabs"><span id="fullpost"><li><a id="tf1" href="#tfintro" class="s">Intro</a></li><li><a id="tf2" href="#tfslope" class="s">Slope</a></li><li><a id="tf3" href="#tftan" class="s">Tangent</a></li><li><a id="tf4" href="#tfcot" class="s">Cotangent</a></li><li><a id="tf5" href="#tfseccsc" class="s">Sec/Csc</a></li><li><a id="tf6" href="#tfreview" class="s">Review</a></li></span></ul><div class="panes"><div><h3>Introduction</h3>This tutorial is meant as a sequel to <a href="http://gmmentalgym.blogspot.com/2011/02/unit-circle.html">my unit circle tutorial</a>. Much of this tutorial assumes you have already been through that one, so if haven't already done so, please go through the previous tutorial now.<br /><br />The unit circle is meant as a sort of idealized circle, from which all other measurements can be scaled up. <a href="http://gmmentalgym.blogspot.com/2011/02/unit-circle.html#ucunderstd">Radians, for example, made it easy to determine how far a wheel was traveling</a>, given its rotation in radians. All that was required was a single multiplication.<br /><br /><span id="fullpost">As a matter of fact, all the measurements on the unit circle work this way. Sine and cosine can be applied to real world measurements with a single multiplication to scale them up or down.<br /><br />That's why, in the unit circle, all the trigonometric functions do a sort of double duty. They're ratios, as you've been taught, but in the idealized world of the unit circle, they can also be treated as absolutes, since they result in useful coordinates. For example, sine and cosine are both ratios that relate in different ways to the length of the hypotenuse, but also give exact coordinates to graph.<br /><br />In this tutorial, we'll go beyond sine and cosine, and explore the other trigonometric functions of tangent, cotangent, secant, and cosecant. The goal of this tutorial is to explain them in a way that can be easily understood, comprehended, and remembered.<br /><br />To explain these, we're going to scale the triangle up beyond the bounds of the unit circle. In the previous tutorial, the hypotenuse always had a length of 1 because it was representing the radius of the unit circle.<br /><br />The hypotenuse of a right triangle is, by definition, the longest of the three sides, so this meant that, with any given angle, the other two side must always fall on or inside the unit circle itself, because they have to be 1 (in the case of 90 degree or π/2 angles) or less.<br /><br />What happens, though, if we scale up a right triangle in the unit circle so that the width or height is 1 instead of the hypotenuse? In this tutorial, we'll try that out, and examine the useful measurements that result.<br /><br />To start off simply, however, we'll focus on <a href="#tfslope" class="jumpup">the one thing that doesn't change as the right triangle is scaled up - its slope</a>.</span></div><div><h3>Slope</h3>Question: What's the slope of a 30 degree angle? Many would answer something like, “What kind of question is that? It's 30 degrees!“<br /><br />I'd give that answer half credit. It does recognize that, regardless of the lengths of the sides of the triangle, the slope does remain the same.<br /><br />However, slope is usually stated as decimal number, so that it's easy to multiply by. Here's a quick refresher course in slope, <a href="http://video.google.com/videoplay?docid=8445649264514656651">excerpted from the series <span style="font-style:italic;">The Mechanical Universe</span></a>:<br /><br /><div class="playorlink"><object data="http://static.photobucket.com/player.swf" width="530" height="405" type="application/x-shockwave-flash"> <param name="movie" value="http://static.photobucket.com/player.swf" /><param name="flashvars" value="file=http%3A%2F%2Fvid261.photobucket.com%2Falbums%2Fii45%2Ftestingfark%2Fgreymatters%2Fslopeanim.mp4" /><param name="allowFullScreen" value="true" /></object><div class="jfeAlternate jfeAlternateDefault" style="display:none;"><span style="font-weight:bold;"><a href="http://s261.photobucket.com/albums/ii45/testingfark/greymatters/?action=view¤t=slopeanim.mp4">Click here to view the <span style="font-style:italic;">slope animation</span> video</a></span></div></div><br />“Change in elevation” over “change in horizontal distance” is usually stated in a way that's catchier and easier to remember:<br /><br /><img src="http://latex.codecogs.com/gif.latex?slope = \frac{rise}{run}" title="slope = \frac{rise}{run}" /><br /><br />For example, take a 45 degree angle in the unit circle. When the hypotenuse was 1 (the radius of the unit circle), what was the rise and what was the run? If you remember the hand trick from the video, it shouldn't be too hard to recall:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\ rise(45^{\circ}) = \frac{\sqrt{2}}{2} = 0.7071...\\ \\ \\ run(45^{\circ}) = \frac{\sqrt{2}}{2} = 0.7071... \\ \\ \\ slope(45^{\circ}) = \frac{0.7071...}{0.7071...} = 1" title="\\ rise(45^{\circ}) = \frac{\sqrt{2}}{2} = 0.7071...\\ \\ \\ run(45^{\circ}) = \frac{\sqrt{2}}{2} = 0.7071... \\ \\ \\ slope(45^{\circ}) = \frac{0.7071...}{0.7071...} = 1" /><br /><br />So, for a 45-degree angle the slope is 1. In other words, for every 1 unit you move horizontally, you're going to move 1 unit vertically, as well. This makes sense for a 45-degree right triangle, since the two shorter sides are the same length.<br /><br />What about that 30-degree angle I asked about earlier? Lets work through that problem:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\ rise(30^{\circ}) = \frac{\sqrt{1}}{2} = \frac{1}{2} =0.5\\ \\ \\ run(30^{\circ}) = \frac{\sqrt{3}}{2} = 0.8660... \\ \\ \\ slope(30^{\circ}) = \frac{0.5}{0.8660...} = 0.57735..." title="\\ rise(30^{\circ}) = \frac{\sqrt{1}}{2} = \frac{1}{2} =0.5\\ \\ \\ run(30^{\circ}) = \frac{\sqrt{3}}{2} = 0.8660... \\ \\ \\ slope(30^{\circ}) = \frac{0.5}{0.8660...} = 0.57735..." /><br /><br /><a href="http://www.wolframalpha.com/input/?i=%28sqrt%281%29%2F2%29%2F%28sqrt%283%29%2F2%29">You can see a more exact answer at Wolfram|Alpha</a>. It can also be <a href="http://www.wolframalpha.com/input/?i=%28sqrt%283%29%29%2F3">stated as the square root of 3 over 3</a>.<br /><br />As you'll see it again and again, you should <a href="http://www.youtube.com/watch?v=9MgZ9U713M8">find a way to remember the square root of 3</a>.<br /><br />The number is less exact than in our 45-degree answer, but the meaning remains the same. With a 30-degree angle, for every 1 unit you run (move horizontally), you're going to rise (move vertically) 0.57735... units. That's more than half a unit, but less than a slope of 0.60.<br /><br />We've been talking quite a bit about slope, but not much about the unit circle here. This is <a href="#tftan" class="jumpup">a very important tangent however, as you'll learn in the next section</a>.</div><div><h3>Tangent</h3>Ever been told by someone that you're going off on a tangent? Ultimately, the complaint is that you're going off on a line that will only take the discussion farther and farther from the main point.<br /><br />It's almost exactly the same definition in math. One mathematical definition of tangent is a line that touches a circle (a unit circle, for our purposes) at only one point. Starting at that one point, and then traveling along the tangent would only take you farther and farther away from that main point.<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/tangent.png" style="display:block;margin-left:auto;margin-right:auto;" /><br /><br />As you can see, a tangent is easy to draw. Draw a radius line at any angle, and at the point where it touches the circle, draw a line perpendicular (at a 90° angle) to the radius, and that's the tangent.<br /><br />To keep things simple in this tutorial, we're only going to consider the horizontal and vertical tangents. In this particular section, we'll only focus on the vertical tangent.<br /><br />The <a href="http://www.wolframalpha.com/input/?i=y%3D0%2Cx%5E2%2By%5E2%3D1%2Cx%3D1">formula to graph a vertical tangent is easy, it's x=1</a>. When y=0, x=1. When y=5, x=1. When y=4,287, x=1. You get the idea. Not surprisingly, the only point at which it intersects the unit circle is <br /><br /><a href="http://gmmentalgym.blogspot.com/2011/02/unit-circle.html">In the previous tutorial</a>, we always created the length of the hypotenuse (the longest side) to be 1. Imagine that, instead of the hypotenuse having length 1, we had the base have a length of 1.<br /><br />Here's a picture of the situation:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/tantri.png" style="display:block;margin-left:auto;margin-right:auto;" /><br /><br />Here's a question for you: If we tried scaling up a 45° right triangle in this manner, what would the coordinates be where the hypotenuse of this new larger triangle intersects the tangent line?<br /><br />Let's think about this. Because the tangent is defined as x=1, the x coordinate where the hypotenuse intersects the tangent will also obviously be x=1. So, the coordinates we have so far are (1, <span style="font-style:italic;">something</span>). That's half the work already done!<br /><br /><a href="#tfslope" class="jumpup">In the previous section</a>, we worked out that the slope of a 45° angle was 1, at that meant that for every 1 unit you moved horizontally, you moved 1 unit vertically. As it happens, a base width of 1 means we are moving over 1 unit horizontally, so we should obviously move up 1 unit vertically!<br /><br />So, <a href="http://www.wolframalpha.com/input/?i=y%3D0%2Cx%5E2%2By%5E2%3D1%2Cx%3D1%2Cy%3D1x">the coordinates of a 45° angle where it intersects the tangent line</a> would simply by (1,1)!<br /><br />Did that seem easier than it should have? Let's try it with our 30° angle example, too. What was the slope of that angle? <a href="http://www.wolframalpha.com/input/?i=sqrt%283%29%2F3">It was 0.57735...</a> and so on. Let's take <a href="http://www.wolframalpha.com/input/?i=y%3D0%2Cx%5E2%2By%5E2%3D1%2Cx%3D1%2Cy%3D0.57735x">a look at that angle plotted by Wolfram|Alpha</a>.<br /><br />That means, for every 1 unit we travel horizontally, we travel 0.57735... units vertically. Yep, the coordinates where the hypotenuse meets the tangent line is (1, 0.57735...).<br /><br />See the pattern? Whenever a right triangle with a given angle has a base length of 1 in the unit circle, the coordinates where the hypotenuse will intersect the vertical tangent line is (1, <span style="font-style:italic;">slope of that angle</span>)!<br /><br />As with sine and cosine in the unit circle, the slope is doing double duty. It's both the slope itself, and the y coordinate where the hypotenuse intersects the tangent at x=1. In fact, we could just call this number the tangent.<br /><br />Remember <a href="http://www.mathsisfun.com/algebra/sohcahtoa.html">SOHCAHTOA</a>? That helps remind us, among other things that the formula for the tangent is the opposite side's length over the adjacent side's length. Also, remember that those lengths on the unit circle are worked out by figuring sine (the height) and the cosine (the width)<br /><br />Let's take a closer look at the formulas for slope and tangent:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\ slope(\theta) = \frac{rise}{run} \\ \\ \\ tangent(\theta) = \frac{opposite}{adjacent} = \frac{sin(\theta)}{cos(\theta)} \\ \\ \\ sin(\theta) = rise \\ cos(\theta) = run \\ tangent(\theta) = \frac{opposite}{adjacent} = \frac{sin(\theta)}{cos(\theta)}=\frac{rise}{run}=slope(\theta)" title="\\ slope(\theta) = \frac{rise}{run} \\ \\ \\ tangent(\theta) = \frac{opposite}{adjacent} = \frac{sin(\theta)}{cos(\theta)} \\ \\ \\ sin(\theta) = rise \\ cos(\theta) = run \\ tangent(\theta) = \frac{opposite}{adjacent} = \frac{sin(\theta)}{cos(\theta)}=\frac{rise}{run}=slope(\theta)" /><br /><br />Yep, the tangent and the slope are always the same, which is why it works out as it does! This should also help you better understand the <a href="http://gmmentalgym.blogspot.com/2011/02/unit-circle.html#ucunderstd">brief reference to figuring out tangent on your fingers from the previous tutorial</a>.<br /><br />So far, we've only dealt with scaling triangles up to meet a vertical tangent. <a href="#tfcot" class="jumpup">What happens if we scale them up to meet a horizontal tangent?</a></div><div><h3>Horizontal Tangent</h3>With a horizontal tangent, we're simply dealing with <a href="http://www.wolframalpha.com/input/?i=y%3D0%2Cx%5E2%2By%5E2%3D1%2Cy%3D1">what happens when y=1</a>, instead of x=1.<br /><br />Remember how we determined the tangent (the same as the slope) of a 45° angle was 1, so the coordinates where the hypotenuse met the vertical tangent was (1,1)? For a 45°, this works out nicely, since it intersects the horizontal tangent in the same place.<br /><br />Let's go back to our 30° example, and get a better idea of what changes. The slope is 0.57735..., so let's view what happens when we try this out:<br /><br /><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/cottri.png" style="display:block;margin-left:auto;margin-right:auto;" /><br /><br /><a href="http://www.wolframalpha.com/input/?i=y%3D0%2Cx%3D1%2Cy%3D1%2Cx%5E2%2By%5E2%3D1%2Cy%3D0.57735x">Here's another look at the same situation, via Wolfram|Alpha</a> (albeit slightly distorted). Even without knowing the exact coordinates, we can see that the hypotenuse, in the 30° case, is MUCH longer than where it intersected the vertical tangent.<br /><br />So, what are the coordinates? We start in a manner similar to before, with the coordinates (<span style="font-style:italic;">something</span>, 1), because the horizontal tangent formula is y=1 (instead of x=1 for the vertical tangent).<br /><br />In the case of the vertical tangent, we just multiplied 1 (the x coordinate) times the slope to get the y coordinate. Since we're still talking about the same 30° angle, the slope is still the same 0.57735... we used before. We'll just have to come at it from the other way:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\(x,y) \ where \ y = x \times 0.57735... \\ \\ if \ y = 1, then: \\ \\ 1 = x \times0.57735... \\ \\ \frac{1}{0.57735...} = \frac{x \times 0.57735...}{0.57735...} \\ \\ \\ \frac{1}{0.57735...} = x \\ \\ 1.73205... = x \\ \\ (x,y) = (1.73205...,1)" title="\\(x,y) \ where \ y = x \times 0.57735... \\ \\ if \ y = 1, then: \\ \\ 1 = x \times0.57735... \\ \\ \frac{1}{0.57735...} = \frac{x \times 0.57735...}{0.57735...} \\ \\ \\ \frac{1}{0.57735...} = x \\ \\ 1.73205... = x \\ \\ (x,y) = (1.73205...,1)" /><br /><br />You can actually see several important things here. First, we found the coordinates for where our 30° angle intersects the horizontal tangent at (1.73205...,1). Second, while the tangent relationship of y = x × 0.57735... still holds, it would seem easier just to state the relationship the other way around, as in x = y × 1.73205..., especially when that lets you multiply by 1.<br /><br />Finally, note that you can always find where the hypotenuse intersects the horizontal tangent by dividing 1 by the tangent of the same angle. That's why this number is given the name <span style="font-style:italic;">cotangent</span>.<br /><br />If you think about it, there are several ways to find the cotangent:<br /><br /><img src="http://latex.codecogs.com/gif.latex?cotangent(\theta) = \frac{1}{tangent(\theta)} = \frac{run}{rise} = \frac{cos \ \theta}{sin \ \theta} = \frac{adjacent}{hypotenuse}" title="cotangent(\theta) = \frac{1}{tangent(\theta)} = \frac{run}{rise} = \frac{cos \ \theta}{sin \ \theta} = \frac{adjacent}{hypotenuse}" /><br /><br />As a brief review, we <a href="http://gmmentalgym.blogspot.com/2011/02/unit-circle.html">covered sine and cosine in the previous tutorial</a>, and now we've <a href="#tftan" class="jumpup">covered tangent</a> and cotangent. If you think of the horizontal tangent as being a cotangent line, then this is easier to understand.<br /><br />We keep talking about the slope of the hypotenuse and the coordinates where the hypotenuse intersects the tangent and cotangent lines, but what happens to the length of the hypotenuse as triangles are scaled up to meet the tangent and cotangent lines? <a href="#tfseccsc" class="jumpup">That's discussed in the next section</a>.</div><div><h3>Hypotenuse Length</h3>We're going to switch from focusing on the slope of the hypotenuse to its length.<br /><br />This almost means a return to our old friend from the right-triangle, the <a href="http://en.wikipedia.org/wiki/Pythagorean_theorem">Pythagorean Theorem</a>: a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup>.<br /><br />When the hypotenuse is 1 unit long, the squares of the other two sides must add up to 1. For example, in our 30° angle, where the cosine (width) is 0.8660... and the sine (height) is 0.5, we get:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\ a^{2} + b^{2} = c^{2} \\ (0.8660...)^{2} + (0.5)^{2} = c^{2} \\ 0.75 + 0.25 = c^{2} \\ 1 = c^{2} \\ \sqrt{1} = \sqrt{c^{2}} \\ 1 = c" title="\\ a^{2} + b^{2} = c^{2} \\ (0.8660...)^{2} + (0.5)^{2} = c^{2} \\ 0.75 + 0.25 = c^{2} \\ 1 = c^{2} \\ \sqrt{1} = \sqrt{c^{2}} \\ 1 = c" /><br /><br />However, the hypotenuse must get longer to meet the tangent lines as we've seen. Let's start as before, scaling up to meet the tangent line (that's the vertical tangent). We've already seen that the coordinates of a 30° angle gives us coordinates of (1, 0.57735...). As in the above example, we note that the coordinates are also the lengths of the two smaller sides. That being the case, let's figure out how long the hypotenuse is when it meets the vertical tangent:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\ (1)^{2} + (0.57735...)^{2} = c^{2} \\ 1 + 0.\overline{333} = c^{2} \\ 1.\overline{333} = c^{2} \\ \\ \sqrt{1.\overline{333}} = \sqrt{c^{2}} \\ 1.1547... = c" title="\\ (1)^{2} + (0.57735...)^{2} = c^{2} \\ 1 + 0.\overline{333} = c^{2} \\ 1.\overline{333} = c^{2} \\ \\ \sqrt{1.\overline{333}} = \sqrt{c^{2}} \\ 1.1547... = c" /><br /><br />So, we see that the hypotenuse is now 1.1547... units long. Since the original hypotenuse was only 1 unit long, this is a sort of scaling factor for the hypotenuse.<br /><br />Take another look, though. When we scaled the width of a 30° right triangle from 0.866... to 1, that's a factor of 1.1547... times, as well. The height went from 0.5 units to 0.57735... units, which is also a scaling factor of 1.1547... times!<br /><br />So, this one factor, when scaling a right triangle up to meet the tangent line tells us how to scale the lengths of all the sides in order to do so! Since we're scaling up from a hypotenuse of 1, this factor also gives us the exact length of the hypotenuse after being scaled up to the tangent line.<br /><br />In trigonometry, this factor is called the <span style="font-style:italic;">secant</span>. Since we scale the width of the triangle (the cosine, in the unit triangle) up to 1, it shouldn't be surprising that we can find the secant in this manner:<br /><br /><img src="http://latex.codecogs.com/gif.latex?secant(\theta) = \frac{1}{cos(\theta)}" title="secant(\theta) = \frac{1}{cos(\theta)}" /><br /><br />The hypotenuse length was 1 before scaling it up, so you could also work it out by dividing the hypotenuse by the width:<br /><br /><img src="http://latex.codecogs.com/gif.latex?secant(\theta) = \frac{1}{cos(\theta)} =\frac{hypotenuse}{adjacent}" title="secant(\theta) = \frac{1}{cos(\theta)} =\frac{hypotenuse}{adjacent}" /><br /><h3>Meeting the Cotangent Line</h3>Let's not forget the length of hypotenuse when scaled up to meet the cotangent line (that's the horizontal tangent line).<br /><br />Our example 30° right triangle, when scaled up to meet the cotangent line, we found the coordinates (and side lengths) of (1.73205...,1). Let's run the numbers just as before, and find the hypotenuse length:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\ (1.73205...)^{2} + (1)^{2} = c^{2} \\ 3 + 1 = c^{2} \\ 4 = c^{2} \\ \sqrt{4} = \sqrt{c^{2}} \\ 2 = c" title="\\ (1.73205...)^{2} + (1)^{2} = c^{2} \\ 3 + 1 = c^{2} \\ 4 = c^{2} \\ \sqrt{4} = \sqrt{c^{2}} \\ 2 = c" /><br /><br />Oh! The hypotenuse in this case is exactly 2 units long. We took the height (the sine) from 0.5 to 1, which is a factor of exactly 2 units, so we shouldn't be surprised when the hypotenuse (and the width, for that matter) scales up by a factor of 2 units.<br /><br />Since this scaling factor deals with scaling the height up to the cotangent line, this factor is naturally called the <span style="font-style:italic;">cosecant</span>. The formulas for cosecant are as follows:<br /><br /><img src="http://latex.codecogs.com/gif.latex?cosecant(\theta) = \frac{1}{sin(\theta)} =\frac{hypotenuse}{opposite}" title="cosecant(\theta) = \frac{1}{sin(\theta)} =\frac{hypotenuse}{opposite}" /><br /><br />At this point, you should understand all 6 trigonometric functions: sine, cosine, tangent, cotangent, secant and cosecant. Once understood, however, they can be easily confused. In our final section, <a href="#tfreview" class="jumpup">I'll offer some mnemonics to help keep them all straight</a>.</div><div><h3>Mnemonics</h3>When you have the explanations and formulas in front of you, it's much easier to keep these things straight. How is it possible to keep all this straight in your head?<br /><br />Let's break things up several ways. First, by the pairs in which you learned them.<br /><br />Sine and cosine can be thought of as the simple lengths of the sides in the unit circle, when the hypotenuse is 1. Think of <span style="font-style:italic;font-weight:bold;">signs</span> that tell you the length of a road.<br /><br />Tangent and cotangent deal with the unit coordinates when the triangles are scaled up to meet the tangent and the cotangent lines respectively. This is its own mnemonic: tangents deal with tangents.<br /><br />Secant and cosecant are the scaling factors to the tangent and cotangent lines respectively. Think <span style="font-style:italic;font-weight:bold;">secant</span> means <span style="font-style:italic;font-weight:bold;">“secaling” factor</span>.<br /><br />Once you get the functions themselves straight, it can seem tricky to remember which of each pair deals with horizontal information and which ones deal with vertical information. However, there's an almost built-in mnemonic: look for the “o”.<br /><br />Sine is the <span style="font-weight:bold;">vertical</span> length of the triangle. Tangent deals with coordinates when scaled up to the <span style="font-weight:bold;">vertical</span> tangent line. Secant deals with scaling factors up to the <span style="font-weight:bold;">vertical</span> tangent.<br /><br />On the other hand, cosine is the <span style="font-weight:bold;">horizontal</span> length of the triangle. Cotangent deals with coordinates when scaled up to the <span style="font-weight:bold;">horizontal</span> tangent line. Cosecant deals with scaling factors up to the <span style="font-weight:bold;">horizontal</span> tangent.<br /><br />Do you see what I mean by “looking for the o”? The words <span style="font-weight:bold;">horizontal</span>, <span style="font-weight:bold;">cosine</span>, <span style="font-weight:bold;">cotangent</span>, and <span style="font-weight:bold;">cosecant</span> all have an o in them, so they all go together.<br /><br />Similarly, none of the words <span style="font-weight:bold;">vertical</span>, <span style="font-weight:bold;">sine</span>, <span style="font-weight:bold;">tangent</span>, and <span style="font-weight:bold;">secant</span> feature an o in them, so they all go together.<br /><br />Looking for the letter o is an appropriate mnemonic for a circle, don't you think?<br /><br />Another challenge is remembering the respective formulas. As mentioned before, <a href="http://www.mathsisfun.com/algebra/sohcahtoa.html">SOHCAHTOA</a> is the classic way to remember this, but that only gives 3 formulas.<br /><br />Here's a lesser known yet more amusing mnemonic that gives all 6 formulas. Start by writing down the dividing lines, and writing “OOH AAH” above them:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\ A = adjacent \ side \ length \\ H = hypotenuse \ length \\ O = opposite \ side \ length \\ \\ \frac{O}{ } \ \ \frac{O}{ } \ \ \frac{H}{ } \ \ \frac{A}{ } \ \ \frac{A}{ } \ \ \frac{H}{ }" title="\\ A = adjacent \ side \ length \\ H = hypotenuse \ length \\ O = opposite \ side \ length \\ \\ \frac{O}{ } \ \ \frac{O}{ } \ \ \frac{H}{ } \ \ \frac{A}{ } \ \ \frac{A}{ } \ \ \frac{H}{ }" /><br /><br />“OOH AAH” is, no doubt, the sound you made upon first learning about unit circles. On the bottom, you're going to write “OOH AAH” again, but this time from right to left (as in “HAA HOO”):<br /><br /><img src="http://latex.codecogs.com/gif.latex?\frac{O}{H} \ \ \frac{O}{A} \ \ \frac{H}{A} \ \ \frac{A}{H} \ \ \frac{A}{O} \ \ \frac{H}{O}" title="\frac{O}{H} \ \ \frac{O}{A} \ \ \frac{H}{A} \ \ \frac{A}{H} \ \ \frac{A}{O} \ \ \frac{H}{O}" /><br /><br />From left to right, these are the formulas for the three vertical functions, sine (O/H), tangent (O/A), secant (H/A), followed by the three horizontal functions in the same order, cosine (A/H), cotangent (A/O), and cosecant (H/O).<br /><br />You've also noticed that you can get some of these ratios simply by taking the inverse (dividing 1 by another number) of other factors. Tangent and cotangent are easy:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\ tan \ \theta = \frac{1}{cot \ \theta} \\ \\ \\ cot \ \theta = \frac{1}{tan \ \theta}" title="\\ tan \ \theta = \frac{1}{cot \ \theta} \\ \\ \\ cot \ \theta = \frac{1}{tan \ \theta}" /><br /><br />The ones beginning with t's are easy, so they can be thought of together. The ones featuring c's and s's are a little trickier:<br /><br /><img src="http://latex.codecogs.com/gif.latex?\\ csc \ \theta = \frac{1}{sin \ \theta} \\ \\ \\ sin \ \theta = \frac{1}{csc \ \theta} \\ \\ \\ sec \ \theta = \frac{1}{cos \ \theta} \\ \\ \\ cos \ \theta = \frac{1}{sec \ \theta}" title="\\ csc \ \theta = \frac{1}{sin \ \theta} \\ \\ \\ sin \ \theta = \frac{1}{csc \ \theta} \\ \\ \\ sec \ \theta = \frac{1}{cos \ \theta} \\ \\ \\ cos \ \theta = \frac{1}{sec \ \theta}" /><br /><br />When focusing on secant or cosecant, ignore the first s or c you see, and look for the second s or c. In the case of secant, you'd look at it as se<span style="font-style:italic;font-weight:bold;">C</span>ant. This C lets you know that it's the inverse of the function that begins with C - cosine!<br /><br />With cosecant, you'd look at it as co<span style="font-style:italic;font-weight:bold;">S</span>ecant, and remember that this S it telling you that it's the inverse of the other S - sine!<br /><br />Once you have that relationship down, <a href="http://www.youtube.com/watch?v=McIbWHgjQng">here's a video that will take your knowledge of the trigonometric functions to the next level</a>. It plays quickly, so you should pause it to read and understand everything it says:<br /><br /><object width="530" height="427"><param name="movie" value="http://www.youtube.com/v/McIbWHgjQng?version=3&hl=en_US&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/McIbWHgjQng?version=3&hl=en_US&rel=0" type="application/x-shockwave-flash" width="530" height="427" allowscriptaccess="always" allowfullscreen="true"></embed></object><br /><br />Any further questions, class?</div></div>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com0tag:blogger.com,1999:blog-2800835365312821409.post-39853550365604901672011-03-01T22:01:00.000-08:002011-03-01T22:07:30.200-08:00Day of the Week For Any Date Quiz (Revised)<script type='text/javascript'>//<![CDATA[ function random(maxValue) { day= new Date(); hour= day.getHours(); min=day.getMinutes(); sec=day.getSeconds(); mili=day.getTime() return(((hour*3600)+(min*60)+(sec)+mili) % maxValue); } function ranom(maxValue) { return(Math.floor(Math.random()*maxValue)); } function weekquiz() { var quiz = [ { ques: "What's the week code for Sunday?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"], ansInfo: "Remember: SUNday = NONEday." }, { ques: "What's the week code for Monday?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"], ansInfo: "Remember: MONday = ONEday." }, { ques: "What's the week code for Tuesday?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"], ansInfo: "Remember: TWOSday." }, { ques: "What's the week code for Wednesday?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"], ansInfo: "Remember: 3 fingers look like a W." }, { ques: "What's the week code for Thursday?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"], ansInfo: "Remember: FOURSday." }, { ques: "What's the week code for Friday?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"], ansInfo: "Remember: FIVEday." }, { ques: "What's the week code for Saturday?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null], ansInfo: "Remember: SIXturday." } ]; var options = { title: "Weekday Codes", quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function mnthquiz() { var quiz = [ { ques: "What's the month code for January?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null], ansInfo: "Remember: WINTER has 6 letters." }, { ques: "What's the month code for February?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"], ansInfo: "Remember: February is the 2nd month." }, { ques: "What's the month code for March?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"], ansInfo: "Remember: March 2 the beat." }, { ques: "What's the month code for April?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"], ansInfo: "Remember: APRIL and FOOLS have 5 letters." }, { ques: "What's the month code for May?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"], ansInfo: "Remember: May-0." }, { ques: "What's the month code for June?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"], ansInfo: "Remember: June BUG, and BUG has 3 letters." }, { ques: "What's the month code for July?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"], ansInfo: "Remember: On July 4th, you'll see 5verworks." }, { ques: "What's the month code for August?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"], ansInfo: "Remember: August picnic with A-1 sauce." }, { ques: "What's the month code for September?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"], ansInfo: "Remember: FALL has 4 letters." }, { ques: "What's the month code for October?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null], ansInfo: "Remember: 6 or treat!" }, { ques: "What's the month code for November?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"], ansInfo: "Remember: 2 legs on a 2rkey." }, { ques: "What's the month code for December?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"], ansInfo: "Remember: LAST (or XMAS) has 4 letters." } ]; var options = { title: "Month Codes", quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function whichothree() { var dayname=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var mons=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); var monlen=new Array(31,28,31,30,31,30,31,31,30,31,30,31); var moncode=new Array(6,2,2,5,0,3,5,1,4,6,2,4); var fakedays=new Array(); lp=0; maxValue=4; numA=random(maxValue); maxValue=8; numB=numA + 2000; numC=numA % 4; numD=(numA / 4) - (numC / 4); numD=numD + numA; maxValue=12; numE=ranom(maxValue); numD=numD + moncode[numE]; strE=mons[numE]; ck=numA % 4; if (ck == 0) { lp=1; }; ck=numA % 100; if (ck == 0) { ck2=numB % 400; if (ck2 != 0) { lp=0; } }; maxValue=monlen[numE]; if (numE == 1) { maxValue=maxValue + lp; }; numF=random(maxValue); numF=numF + 1; numD=numD + numF; if (lp == 1) { if ((numE == 0) || (numE == 1)) { numD=numD - 1; }; }; if (ck == 0) { if (ck2 != 0) { if (lp == 0) { numD=numD - 1; }; }; }; numD=numD % 7; strC=dayname[numD]; fkar = 0; i=0; do { if (dayname[i] != strC) { fakedays[fkar] = dayname[i]; } else{ fakedays[fkar] = null; }; fkar = fkar + 1; i++; if (i == 7) { break; }; } while (i != 8); strR="On which day of the week is " + strE + " " + numF + ", " + numB + "?"; var quiz = [ { ques: strR, ans: strC, ansSel: fakedays, } ]; var options = { title: "Dates: 2000 to 2003", disableRestart: true, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function lpcodetwofour() { var quiz = [ { ques: "What's the year code for 2000?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"], ansInfo: "Remember: 2000 is mostly 0s." }, { ques: "What's the year code for 2004?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"], ansInfo: "Remember: Count: 4...5...." }, { ques: "What's the year code for 2008?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"], ansInfo: "Remember: Right half of 8 looks like 3." }, { ques: "What's the year code for 2012?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"], ansInfo: "Remember: 12 ÷ 12 = 1 (12 rule)." }, { ques: "What's the year code for 2016?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null], ansInfo: "Remember: 16 ends in 6." }, { ques: "What's the year code for 2020?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"], ansInfo: "Remember: 2 + 0 + 2 + 0 = 4." }, { ques: "What's the year code for 2024?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"], ansInfo: "Remember: 24 ÷ 12 = 2 (12 rule)." } ]; var options = { title: "Leap Year Codes: 2000 to 2024", quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function lpdatetwofour() { var dayname=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var mons=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); var monlen=new Array(31,28,31,30,31,30,31,31,30,31,30,31); var moncode=new Array(6,2,2,5,0,3,5,1,4,6,2,4); var fakedays=new Array(); lp=0; maxValue=7; numA=random(maxValue); numA=numA * 4; maxValue=8; numB=numA + 2000; numC=numA % 4; numD=(numA / 4) - (numC / 4); numD=numD + numA; maxValue=12; numE=ranom(maxValue); numD=numD + moncode[numE]; strE=mons[numE]; ck=numA % 4; if (ck == 0) { lp=1; }; ck=numA % 100; if (ck == 0) { ck2=numB % 400; if (ck2 != 0) { lp=0; } }; maxValue=monlen[numE]; if (numE == 1) { maxValue=maxValue + lp; }; numF=random(maxValue); numF=numF + 1; numD=numD + numF; if (lp == 1) { if ((numE == 0) || (numE == 1)) { numD=numD - 1; }; }; if (ck == 0) { if (ck2 != 0) { if (lp == 0) { numD=numD - 1; }; }; }; numD=numD % 7; strC=dayname[numD]; fkar = 0; i=0; do { if (dayname[i] != strC) { fakedays[fkar] = dayname[i]; } else{ fakedays[fkar] = null; }; fkar = fkar + 1; i++; if (i == 7) { break; }; } while (i != 8); strR="On which day of the week is " + strE + " " + numF + ", " + numB + "?"; var quiz = [ { ques: strR, ans: strC, ansSel: fakedays, } ]; var options = { title: "Leap Year Dates: 2000 to 2024", disableRestart: true, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function lpcodeninesix() { var quiz = [ { ques: "What's the year code for 2000?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"], ansInfo: "Remember: 2000 is mostly 0s." }, { ques: "What's the year code for 2004?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"], ansInfo: "Remember: Count: 4...5...." }, { ques: "What's the year code for 2008?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"], ansInfo: "Remember: Right half of 8 looks like 3." }, { ques: "What's the year code for 2012?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"], ansInfo: "Remember: 12 ÷ 12 = 1 (12 rule)." }, { ques: "What's the year code for 2016?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null], ansInfo: "Remember: 16 ends in 6." }, { ques: "What's the year code for 2020?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"], ansInfo: "Remember: 2 + 0 + 2 + 0 = 4." }, { ques: "What's the year code for 2024?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"], ansInfo: "Remember: 24 ÷ 12 = 2 (12 rule)." }, { ques: "What's the year code for 2028?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"], ansInfo: "Remember: 2028 - 28 = 2000 = 0." }, { ques: "What's the year code for 2032?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"], ansInfo: "Remember: 2032 - 28 = 2004 = 5." }, { ques: "What's the year code for 2036?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"], ansInfo: "Remember: 36 ÷ 12 = 3 (12 rule)." }, { ques: "What's the year code for 2040?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"], ansInfo: "Remember: 2040 - 28 = 2012 = 1." }, { ques: "What's the year code for 2044?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null], ansInfo: "Remember: 2044 - 28 = 2016 = 6." }, { ques: "What's the year code for 2048?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"], ansInfo: "Remember: 48 ÷ 12 = 4 (12 rule)." }, { ques: "What's the year code for 2052?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"], ansInfo: "Remember: 2052 - 28 = 2024 = 2." }, { ques: "What's the year code for 2056?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"], ansInfo: "Remember: 2056 - 56 = 2000 = 0." }, { ques: "What's the year code for 2060?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"], ansInfo: "Remember: 60 ÷ 12 = 5 (12 rule)." }, { ques: "What's the year code for 2064?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"], ansInfo: "Remember: 2064 - 56 = 2008 = 3." }, { ques: "What's the year code for 2068?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"], ansInfo: "Remember: 2068 - 56 = 2012 = 1." }, { ques: "What's the year code for 2072?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null], ansInfo: "Remember: 72 ÷ 12 = 6 (12 rule)." }, { ques: "What's the year code for 2076?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"], ansInfo: "Remember: 2076 - 56 = 2020 = 4." }, { ques: "What's the year code for 2080?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"], ansInfo: "Remember: 2080 - 56 = 2024 = 2." }, { ques: "What's the year code for 2084?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"], ansInfo: "Remember: 84 ÷ 12 = 7 = 0 (12 rule)." }, { ques: "What's the year code for 2088?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"], ansInfo: "Remember: 2088 - 84 = 2004 = 5." }, { ques: "What's the year code for 2092?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"], ansInfo: "Remember: 2092 - 84 = 2008 = 3." }, { ques: "What's the year code for 2096?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"], ansInfo: "Remember: 96 ÷ 12 = 8 = 1 (12 rule)." } ]; var options = { title: "Leap Year Codes: 2000 to 2096", quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function lpdateninesix() { var dayname=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var mons=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); var monlen=new Array(31,28,31,30,31,30,31,31,30,31,30,31); var moncode=new Array(6,2,2,5,0,3,5,1,4,6,2,4); var fakedays=new Array(); lp=0; maxValue=25; numA=random(maxValue); numA=numA * 4; maxValue=8; numB=numA + 2000; numC=numA % 4; numD=(numA / 4) - (numC / 4); numD=numD + numA; maxValue=12; numE=ranom(maxValue); numD=numD + moncode[numE]; strE=mons[numE]; ck=numA % 4; if (ck == 0) { lp=1; }; ck=numA % 100; if (ck == 0) { ck2=numB % 400; if (ck2 != 0) { lp=0; } }; maxValue=monlen[numE]; if (numE == 1) { maxValue=maxValue + lp; }; numF=random(maxValue); numF=numF + 1; numD=numD + numF; if (lp == 1) { if ((numE == 0) || (numE == 1)) { numD=numD - 1; }; }; if (ck == 0) { if (ck2 != 0) { if (lp == 0) { numD=numD - 1; }; }; }; numD=numD % 7; strC=dayname[numD]; fkar = 0; i=0; do { if (dayname[i] != strC) { fakedays[fkar] = dayname[i]; } else{ fakedays[fkar] = null; }; fkar = fkar + 1; i++; if (i == 7) { break; }; } while (i != 8); strR="On which day of the week is " + strE + " " + numF + ", " + numB + "?"; var quiz = [ { ques: strR, ans: strC, ansSel: fakedays, } ]; var options = { title: "Leap Year Dates: 2000 to 2096", disableRestart: true, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function yrcodes() { var quiz = [ { ques: "What's the year code for 2000?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2001?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2002?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2003?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2004?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2005?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2006?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2007?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2008?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2009?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2010?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2011?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2012?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2013?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2014?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2015?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2016?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2017?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2018?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2019?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2020?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2021?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2022?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2023?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2024?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2025?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2026?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2027?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2028?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2029?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2030?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2031?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2032?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2033?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2034?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2035?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2036?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2037?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2038?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2039?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2040?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2041?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2042?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2043?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2044?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2045?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2046?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2047?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2048?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2049?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2050?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2051?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2052?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2053?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2054?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2055?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2056?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2057?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2058?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2059?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2060?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2061?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2062?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2063?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2064?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2065?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2066?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2067?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2068?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2069?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2070?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2071?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2072?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2073?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2074?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2075?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2076?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2077?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2078?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2079?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2080?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2081?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2082?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2083?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2084?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2085?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2086?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2087?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2088?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2089?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2090?", ans: "0", ansSel: [null, "1", "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2091?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2092?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2093?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] }, { ques: "What's the year code for 2094?", ans: "5", ansSel: ["0", "1", "2", "3", "4", null, "6"] }, { ques: "What's the year code for 2095?", ans: "6", ansSel: ["0", "1", "2", "3", "4", "5", null] }, { ques: "What's the year code for 2096?", ans: "1", ansSel: ["0", null, "2", "3", "4", "5", "6"] }, { ques: "What's the year code for 2097?", ans: "2", ansSel: ["0", "1", null, "3", "4", "5", "6"] }, { ques: "What's the year code for 2098?", ans: "3", ansSel: ["0", "1", "2", null, "4", "5", "6"] }, { ques: "What's the year code for 2099?", ans: "4", ansSel: ["0", "1", "2", "3", null, "5", "6"] } ]; var options = { title: "Year Codes: 2000 to 2099", numOfQuizQues: 10, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function whichnrw() { var dayname=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var mons=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); var monlen=new Array(31,28,31,30,31,30,31,31,30,31,30,31); var moncode=new Array(6,2,2,5,0,3,5,1,4,6,2,4); var fakedays=new Array(); lp=0; maxValue=100; numA=random(maxValue); maxValue=8; numB=numA + 2000; numC=numA % 4; numD=(numA / 4) - (numC / 4); numD=numD + numA; maxValue=12; numE=ranom(maxValue); numD=numD + moncode[numE]; strE=mons[numE]; ck=numA % 4; if (ck == 0) { lp=1; }; ck=numA % 100; if (ck == 0) { ck2=numB % 400; if (ck2 != 0) { lp=0; } }; maxValue=monlen[numE]; if (numE == 1) { maxValue=maxValue + lp; }; numF=random(maxValue); numF=numF + 1; numD=numD + numF; if (lp == 1) { if ((numE == 0) || (numE == 1)) { numD=numD - 1; }; }; if (ck == 0) { if (ck2 != 0) { if (lp == 0) { numD=numD - 1; }; }; }; numD=numD % 7; strC=dayname[numD]; fkar = 0; i=0; do { if (dayname[i] != strC) { fakedays[fkar] = dayname[i]; } else{ fakedays[fkar] = null; }; fkar = fkar + 1; i++; if (i == 7) { break; }; } while (i != 8); strR="On which day of the week is " + strE + " " + numF + ", " + numB + "?"; var quiz = [ { ques: strR, ans: strC, ansSel: fakedays, } ]; var options = { title: "Dates: 2000 to 2099", disableRestart: true, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; function whichwide() { var dayname=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var mons=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); var monlen=new Array(31,28,31,30,31,30,31,31,30,31,30,31); var moncode=new Array(6,2,2,5,0,3,5,1,4,6,2,4); var fakedays=new Array(); lp=0; maxValue=100; numA=random(maxValue); maxValue=8; numB=ranom(maxValue); numB=numB + 1; numR=numB; numB=(numB * 100) + numA + 1500; numC=numA % 4; numD=(numA / 4) - (numC / 4); numD=numD + numA; maxValue=12; numE=ranom(maxValue); numD=numD + moncode[numE]; strE=mons[numE]; ck=numA % 4; if (ck == 0) { lp=1; }; ck=numA % 100; if (ck == 0) { ck2=numB % 400; if (ck2 != 0) { lp=0; } }; maxValue=monlen[numE]; if (numE == 1) { maxValue=maxValue + lp; }; numF=random(maxValue); numF=numF + 1; numD=numD + numF; if (lp == 1) { if ((numE == 0) || (numE == 1)) { numD=numD - 1; }; }; if (numR == 2) { numD=numD + 5; }; if (numR == 3) { numD=numD + 3; }; if (numR == 4) { numD=numD + 1; }; if (numR == 6) { numD=numD + 5; }; if (numR == 7) { numD=numD + 3; }; if (numR == 8) { numD=numD + 1; }; if (ck == 0) { if (ck2 != 0) { if (lp == 0) { numD=numD - 1; }; }; }; numD=numD % 7; strC=dayname[numD]; fkar = 0; i=0; do { if (dayname[i] != strC) { fakedays[fkar] = dayname[i]; } else{ fakedays[fkar] = null; }; fkar = fkar + 1; i++; if (i == 7) { break; }; } while (i != 8); strR="On which day of the week is " + strE + " " + numF + ", " + numB + "?"; var quiz = [ { ques: strR, ans: strC, ansSel: fakedays, } ]; var options = { title: "Dates: 1600 to 2399", disableRestart: true, quizType: "multi" }; $("#quizarea").jQuizMe(quiz, options); }; //]]></script><span id="fullpost"><a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-revised.html">Learn to perform the Day of the Week For Any Date (Revised) feat here</a>.<br /><br /><a class="gmButton" onclick="weekquiz()">Weekday Codes</a><br /><br /><a class="gmButton" onclick="mnthquiz()">Month Codes</a><br /><br /><a class="gmButton" onclick="whichothree()">Dates: 2000 to 2003</a><br /><br /><a class="gmButton" onclick="lpcodetwofour()">Leap Year Codes: 2000 to 2024</a><br /><br /><a class="gmButton" onclick="lpdatetwofour()">Leap Year Dates: 2000 to 2024</a><br /><br /><a class="gmButton" onclick="lpcodeninesix()">Leap Year Codes: 2000 to 2096</a><br /><br /><a class="gmButton" onclick="lpdateninesix()">Leap Year Dates: 2000 to 2096</a><br /><br /><a class="gmButton" onclick="yrcodes()">Year Codes: 2000 to 2099</a><br /><br /><a class="gmButton" onclick="whichnrw()">Dates: 2000 to 2099</a><br /><br /><a class="gmButton" onclick="whichwide()">Dates: 1600 to 2399</a><br /><br />Quiz will appear below:<br /><div id="quizarea"></div></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com32tag:blogger.com,1999:blog-2800835365312821409.post-34664038599693215802011-03-01T22:00:00.000-08:002014-05-25T07:51:40.975-07:00Day of the Week For Any Date (Revised)<b>Note:</b> If you're interested in <a href="http://gmmentalgym.blogspot.com/search/label/calendar">calendar calculations</a>, you also might want to check out <a href="http://gmmentalgym.blogspot.com/2014/05/quick-calendar-month-creation.html">my <i>Quick Calendar Month Creation</i> tutorial</a>.<br /><ul id="tabs"><span id="fullpost"><li><a id="nd1" href="#ndatebasics" class="s">Basics</a></li><li><a id="nd2" href="#ndateformula" class="s">Formula</a></li><li><a id="nd3" href="#ndateleaps" class="s">Leap Years</a></li><li><a id="nd4" href="#ndateally" class="s">All Years</a></li><li><a id="nd4" href="#ndate1900s" class="s">1900s +</a></li><li><a id="nd4" href="#ndatetips" class="s">Tips</a></li></span></ul><div class="panes"><div><h2>Re-Introduction</h2>In this feat, someone gives you a date, and you quickly state the day of the week on which it fell. This new approach is updated for the 21st century, and employs new tips and tricks that help make this feat simpler to learn and quicker to perform.<br /><span id="fullpost"><h2>Approach:</h2>The Day of the Week For Any Date feat combines both memory and mental math. A relatively simple mastery of both, though, will create a response far out of proportion to the required work.<br /><br />Before I describe the basics of the approach, I'd like to help you get a good idea of your goal, as well as what's possible, by seeing this feat performed by various people in the following videos:<br /><ul><li><a href="http://www.youtube.com/watch?v=M4vqr3_ROIk#t=7m50s">Dr. Arthur Benjamin performing at TED</a></li><li><a href="http://www.youtube.com/watch?v=jA-WUCNW-jI">8-year old Florian Osmani on German TV</a> (in <a href="http://www.speakgerman.co.uk/vocab/days_of_the_week">German</a>)</li></ul>Here's the basic principles, broken down into simple steps:<br /><br /><span style="font-weight:bold;">1) Day and Months Number Conversion:</span> To work out the days of the week mentally, we need to convert them into numbers. We'll also need to convert the months into numbers, to adjust for their effects. These are taught in an easy-to-remember manner. <br /><br /><span style="font-weight:bold;">2) Addition of 3 Numbers:</span> Without using a calculator, can you tell me what 6 + 6 + 31 is? That's about as difficult as the basic formula gets. If you're comfortable doing that, you won't have a problem working through the formula.<br /><br /><span style="font-weight:bold;">3) Subtracting Multiples of 7:</span> Let's say you're asked about the 27th of a month. Regardless of the month or year, we can state with certainty that the 27th of a month will fall on the 6th (since it's 3 weeks, or 21 days, earlier). Since adding 6 is simpler than adding 27, and will give the same result, why not use 6? If you learn to subtract multiples of 7, this makes the arithmetic so easy that you won't have to worry about addition problems any tougher than 6 + 6 + 6!<br /><br /><span style="font-weight:bold;">4) Year Number Conversion:</span> After becoming comfortable with all of the above when given dates in the years 2000 to 2003, you'll learn how to remember and adjust the leap years in the 21st century to key dates. After learning those, you'll learn a simple way to adjust for any year from 2000 to 2099, and even adjust for other centuries!<br /><br />Running through all these principles, there will be an emphasis on recognizing and taking advantage of patterns. The quicker you can recognize a pattern, the quicker will be your calculation.<br /><br />We'll start with the codes for the days of the week, since that is our goal. All the formulas and patterns you'll learn later will result in a number from 0 to 6. This number is turned into a weekday as follows:<br /><br /><table class="flexme"><thead><tr> <th width="164">Day of Week</th> <th width="164">Number</th> <th width="164">Mnemonic</th></tr></thead> <tbody><tr> <td>Sunday</td> <td>0</td> <td>SUNday=NONEday</td></tr><tr> <td>Monday</td> <td>1</td> <td>MONday=ONEday</td></tr><tr> <td>Tuesday</td> <td>2</td> <td>TWOSday</td></tr><tr> <td>Wednesday</td> <td>3</td> <td><a href="http://commons.wikimedia.org/wiki/File:Counting_Hands_3.png">Three fingers look like a W</a></td></tr><tr> <td>Thursday</td> <td>4</td> <td>FOURSday</td></tr><tr> <td>Friday</td> <td>5</td> <td>FIVEday</td></tr><tr> <td>Saturday</td> <td>6</td> <td>SIXturday</td></tr></tbody> </table><br />To help get you comfortable with converting numbers into days, <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">take the Weekday Codes quiz here</a>. Once you can get a perfect score in a short time, then continue with this tutorial.<br /><br />Next, you need to learn the codes for the months. Like the weekdays, they range from 0 to 6:<br /><br /><table class="flexme"><thead><tr> <th width="164">Month</th> <th width="164">Number</th> <th width="164">Mnemonic</th></tr></thead> <tbody><tr> <td>January</td> <td>6</td> <td>WINTER has 6 letters</td></tr><tr> <td>February</td> <td>2</td> <td>February is 2nd month</td></tr><tr> <td>March</td> <td>2</td> <td>March 2 the beat.</td></tr><tr> <td>April</td> <td>5</td> <td>APRIL has 5 letters (& FOOLS!)</td></tr><tr> <td>May</td> <td>0</td> <td>MAY-0</td></tr><tr> <td>June</td> <td>3</td> <td>June BUG (BUG has 3 letters)</td></tr><tr> <td>July</td> <td>5</td> <td>FIVERworks</td></tr><tr> <td>August</td> <td>1</td> <td>A-1 Steak Sauce at picnic</td></tr><tr> <td>September</td> <td>4</td> <td>FALL has 4 letters</td></tr><tr> <td>October</td> <td>6</td> <td>SIX or treat!</td></tr><tr> <td>November</td> <td>2</td> <td>2 legs on 2rkey</td></tr><tr> <td>December</td> <td>4</td> <td>LAST (or XMAS) has 4 letters</td></tr></tbody> </table><br /><a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">Take the Month Codes quiz here</a> to help reinforce the mnemonics.<br /><br /><span style="font-weight:bold;">Note:</span> It's important to note that, in leap years, January reduces by one to 5, and February reduces by one to 1. The other years don't change in leap years. Leap years will be discussed in more detail later.<br /><br />Once you're comfortable with both the month and weekday codes, you're ready to start calculating your first dates. In the <a href="#ndateformula" class="jumpup">next tab, you'll learn how to use these codes to work out dates for the years 2000 to 2003</a>.</span></div><div><h2>Formula</h2>Ready for the formula? Here it is: <span style="font-weight:bold;">Month Code + Date + Year Code = Day of Week Code</span>. It's a lot simpler than many people think, but there are some fine points to learn.<br /><br />We haven't covered year codes yet, so I'm just going to teach you four simple ones with which to start out:<br /><ul><li>2000 = 0</li><li>2001 = 1</li><li>2002 = 2</li><li>2003 = 3</li></ul>Those shouldn't be too hard to remember, should they? We'll learn more year codes later in this tutorial, but for now, we'll just focus on these years.<br /><br />Let's start with a simple example. Let's figure out May 1, 2000. The code for May is what? The mnemonic is MAY-0, so May is a 0. The date itself is the first, so we use 1. The year code for 2000 is 0, so our problem is 0 + 1 + 0 = 1.<br /><br />Which weekday has a code of 1? ONEday is MONday, so Monday is the day of the week on which May 1, 2000 fell. <a href="http://www.searchforancestors.com/utility/dayofweek.html">You can verify that at this site</a>. Congratulations, you've just calculated your first date!<br /><br />Let's try a date that's a little more challenging. Our next date is October 4, 2000. October is 6 (remember “SIX or treat”?), and 2000 is still 0, so that gives us 6 + 4 + 0 = 10. And the weekday that goes with 10 is...<br /><br />Wait a minute, the weekday codes only range from 0 to 6! What do we do with a 10, or any result higher than 6 for that matter?<br /><br />If you look on a calendar, the 10th of any month will always fall on the same day of the week as the 3rd, because the 3rd is 7 days earlier. So, with the result, or any number in the formula, we can subtract 7, or any multiples of 7 to reduce the answer. You may want to <a href="http://www.youtube.com/watch?v=LDHTJGVWgG4">refresh yourself on the multiples of 7 with the help of Schoolhouse Rock here</a>.<br /><br />In our October 4, 2000 example, we got 10 as a result, so we can reduce that by 7. 10 - 7 = 3, so our result boils down to 3. Which day of the week is 3? Since 3 fingers looks like the letter W, that's Wednesday. <a href="http://www.searchforancestors.com/utility/dayofweek.html">Once again, you can check that here</a>.<br /><br />This reduction of the multiples of 7 can make the problem itself easier, as well. Let's try figuring out the day of the week for Halloween 2001, or October 31, 2001. October is 6, and 2001 is a 1, so the problem works out to be 6 + 31 + 1 = 38. The closest multiple of 7 to 38 is 35, so we do 38 - 35 = 3, which <a href="http://www.searchforancestors.com/utility/dayofweek.html">gives us another Wednesday</a>.<br /><br />That approach works, but it could be made simpler. When you hear that the date is the 31st, you can reduce that right away by working out that 31 - 28 (the closest multiple of 7 to 31) = 3, and doing 6 + 3 + 1 = 10. True, you would still need to reduce that 10 to 3 again to get Wednesday, but you'd need to subtract multiples of 7 either way.<br /><br />Note that, by bringing the dates down by multiples of 7, you're making the problem you have to add much simpler. If 6 + 31 + 1 and 6 + 3 + 1 will both give you the same results, wouldn't you prefer to make it easier on yourself?<br /><br />The scary technical term for subtracting multiples in this manner is <a href="http://betterexplained.com/articles/fun-with-modular-arithmetic/">modulo arithmetic, which is explained quite clearly at BetterExplained.com</a>.<br /><br />Let's try this with Valentine's Day in 2003. We start by making sure of the date, February 14, 2003. February is a 2 (remember the mnemonic?), and 2003 is a 3. The problem then becomes 2 + 14 + 3. However, if you spotted that 14 was already a multiple of 7, you should realize that you can drop it out completely! 14, or any multiple of 7, is the same as 0, so you can ignore them. For February 14, 2003, all you really need to add is 2 + 3 = 5. 5 is a FIVEday, or rather a Friday, <a href="http://www.searchforancestors.com/utility/dayofweek.html">so that's our answer</a>!<br /><br />Let's try one last problem before we go. What about February 2, 2000 (Groundhog Day)? February is 2, and 2000 is 0, so the problem we get is 2 + 2 + 0 = 4. 4 is a Thursday (remember FOURSday?), so February 2, 2000 should be a Thursday. Once again, <a href="http://www.searchforancestors.com/utility/dayofweek.html">we verify that information here and...</a>OOPS! That site says February 2, 2000 is a <span style="font-style:italic;">Wednesday</span>! What went wrong?<br /><br />I briefly mentioned this at <a href="#ndatebasics" class="jumpup">the end of the previous tab</a>, but it needs to be repeated now. Whenever you're working in January or February dates in a leap year, you need to reduce the month code by 1 to compensate. Effectively the extra day, February 29, hasn't happened yet, so we're subtracting one to adjust for that fact. January becomes 5 (6 - 1) and February becomes 1 (2 - 1).<br /><br />Since February 2, 2000 is a February date in a leap year, the code for February needs to be 1, not 2. Let's try the equation again, with that in mind. February in a leap year is 1, and 2000 is 0, so the equation is 1 + 2 + 0 = 3, which you should know by now is a Wednesday. As we saw when we originally made the error, Wednesday is indeed the correct day of the week.<br /><br /><a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">Practice the Dates: 2000 to 2003 quiz here</a>, making sure to keep an eye out for January and February dates in 2000, and adjusting your calculations accordingly. Practice these dates until you can calculate them with little trouble, and don't forget to subtract multiples of 7 to make your work easier!<br /><br />Once you're comfortable with dates from 2000 to 2003, we're going to teach you <a href="#ndateleaps" class="jumpup">how to better handle leap years in the next section</a>.</div><div><h2>Year Codes: Why?</h2>You'll note that the year codes for 2000-2003 progressed in a nice, simple, 0-1-2-3 order. This is because a normal year consists of exactly 52 weeks (52 × 7 = 364) plus 1 day, to make 365 days. So, from one 365-day year to the next 365-day year, a given date in a given month will fall one day later.<br /><br />However, a 366-day leap year means that everything must jump ahead 2 days. This also means that the year codes for leap years will jump ahead 2 instead of 1. You might expect 2004 to be a 4, but because it's a leap year, it jumps ahead to 5.<br /><br />To get you comfortable with the strange nature of leap years, I'm going to start by teaching you the first 7 leap years.<br /><h2>First 7 Leap Years</h2>Here are the year codes for the first 7 leap years, along with handy mnemonics by which to remember them:<br /><br /><table class="flexme"><thead><tr> <th width="164">Leap Year</th> <th width="164">Year Code</th> <th width="164">Mnemonic</th></tr></thead> <tbody><tr> <td>2000</td> <td>0</td> <td>2000 is mostly 0s</td></tr><tr> <td>2004</td> <td>5</td> <td>Count: 4...5...</td></tr><tr> <td>2008</td> <td>3</td> <td>Right half of 8 looks like 3</td></tr><tr> <td>2012</td> <td>1</td> <td>12 ÷ 12 = 1 (See below)</td></tr><tr> <td>2016</td> <td>6</td> <td>16 ends in 6</td></tr><tr> <td>2020</td> <td>4</td> <td>2 + 0 + 2 + 0 = 4</td></tr><tr> <td>2024</td> <td>2</td> <td>24 ÷ 12 = 2 (See below)</td></tr></tbody> </table><br />With 2012 and 2024, you'll note that all you have to do is divide their last 2 digits by 12 to get their year code. This pattern keeps working all the way through 2096, which will give you a few extra leap year codes quite easily, <a href="http://www.youtube.com/watch?v=BblsNzx6yEk">assuming you know your 12 multiples</a>:<br /><ul><li>2012 = 1</li><li>2024 = 2</li><li>2036 = 3</li><li>2048 = 4</li><li>2060 = 5</li><li>2072 = 6</li><li>2084 = 7 = 0 (Remember to drop any multiples of 7!)</li><li>2096 = 8 = 1 (Remember to drop any multiples of 7!)</li></ul>First, <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">practice just recalling the codes with the Leap Year Codes: 2000 to 2024 quiz here</a>.<br /><br />Once you're comfortable recalling all the codes, <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">practice working out dates for those years with the Leap Year Dates: 2000 to 2024 quiz here</a>. Don't forget that that the month codes for January and February are both reduced by 1 in leap years!<br /><br />Once you've practiced those years, you're ready to learn how to handle any leap year in the 21st century!<br /><h2>All Leap Years</h2>If you're given a leap year that ends in a multiple of 12, you can already handle those through 2096 quite easily, of course. What about the remaining leap years?<br /><br />If there were no such thing as leap years, the pattern year codes would simply repeat every 7 years. Because of the effect of leap years every 4 years, however, the pattern of year codes usually repeats every 28 years.<br /><br />I say “usually” because years ending in 00 are an exception. Years ending in 00 are only leap years if they're divisible by 400. So, 1600, 2000, and 2400 are leap years, while 1800, 1900, and 2100 are not.<br /><br />Thanks to the 00 exception the calendar only repeats EXACTLY every 400 years. However, when you're dealing with a range of years in which EVERY (without exception) 4th year is a leap year, then you can still rely on the 28-year rule.<br /><br />This means that you can depend on the 28-year rule for every leap year from 2000-2096! I'll break this down in a simpler manner, so you can see how this is useful.<br /><br />For the leap years 2028 through 2052, all you have to do is subtract 28 years, and you'll get a year with the same year code! 2028 - 28 is 2000, which you already know has a year code of 0, so 2028's year code is 0. 2032 - 28 = 2004, whose year code is 5, and so on.<br /><br />While doing 2028 - 28 = 2000 in your head is simple enough, some people find that working out problems like 2040 - 28 or 2052 - 28 during a performance to be a little challenging. There's a way to make it simpler.<br /><br />If you're worried about subtracting 28 from a number, add 2 and then subtract 30 instead. For example, instead of doing 2040 - 28, work out 2040 + 2 - 30 = 2042 - 30 = 2012. 2012 is a 1 year, so 2040 is a 1 year as well! What year has the same year code as 2052? Add 2 and subtract 30, and you'll get your answer in no time.<br /><br />Similarly, for the years 2056 to 2080, you subtract 56 to get the year code. The mathematical short cut here, if you feel you need it, is to add 4 and then subtract 60. What's the year code for 2064? 2064 + 4 - 60 = 2068 - 60 = 2008 = a year code of 3! How about 2068? You should get a year code of 1, just like 2012.<br /><br />How about 2072? Did you start by adding 4? Stop! 72 is a multiple of 12, so we just work out that 2072 is 6 from the pattern of 12s above. Don't forget to take advantage of the 12 pattern when you can! You should ask yourself if a year is divisible by 12 first, before subtracting.<br /><br />Finally, for the years 2084 to 2096, just subtract 84. For 2084 and 2096, of course, just use the 12 pattern we discussed earlier.<br /><br />If you need a shortcut for 84 for the remaining years, simply subtract 4, then subtract 80. 2092 - 4 - 80 = 2088 - 80 = 2008 = year code of 3! I'm sure you have the idea by now.<br /><br />You can <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">practice this process with the Leap Year Codes: 2000 to 2096 quiz here</a>. Again, don't forget to take advantage of the 12 pattern when you can.<br /><br />Also, don't forget to <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">practice actual dates in these leap years with this Leap Year Dates: 2000 to 2096 quiz</a>.<br /><br />Once you're comfortable working through both of these quizzes, it's time to <a href="#ndateally" class="jumpup">learn how to determine the code for every year from 2000-2099 in the next section</a>!</div><div><h2>2000-2099</h2>Are you ready to handle any date from 2000 to 2099? You're probably more ready thank you think!<br /><br />Once you can handle leap years, the remaining years are simple.<br /><br />When given a non-leap year, you need 2 pieces of information: The year code for the nearest leap year BEFORE the given year, and how far the given year is from that leap year. When you have these two pieces of information, simply add them together (remembering to drop any multiples of 7, as we've discussed before), and you have the year code.<br /><br />For example, take 2009. The closest leap year is 2008, which has a year code of 3 (remember?), and 2009 is 1 year later. So, we work out 3 + 1 = 4, so 2009's year code is 4!<br /><br />How about the year code for 2051? The nearest leap year BEFORE that is 2048, and we can use the 12 rule to determine that the year code is 4. Since 2051 is 3 years later, we do 4 + 3 = 7 = 0 (don't forget to drop out multiples of 7!), so 2051 has a year code of 0.<br /><br />How about a tricky one like 2094? It's 2 years after 2092, which has a year code of 3 (remember how we know that?), so 2 + 3 = 5, so 2094 has a year code of 5.<br /><br />Since you can't be more than 3 years after a leap year in any date from 2000-2099, this is a relatively simple adjustment.<br /><br />To get practiced with this approach for determining year codes for any year, <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">use this Year Codes: 2000 to 2099 quiz</a>.<br /><br />Once you get comfortable with that quiz, <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">move on to the Dates: 2000 to 2099 quiz here</a>.<br /><br />Being able to determine the day of the week for any date in the 21st century is an impressive feat on its own. Once you're comfortable with doing that, you can move on <a href="#ndate1900s" class="jumpup">learning how to handle dates in other centuries in the next section</a>.<br /></div><div><h2>Other Centuries</h2>Often you'll get asked about dates in the 20th century, especially if you're discussing someone's birthday. How do you handle those?<br /><br />For dates from 1900 to 1999, simply work out the similar date for the 2000s, and then add 1. That's it!<br /><br />For example, Let's say someone tells you they were born on January 20, 1985. Start as if you were working out January 20, 2085. 85 is a 1 year and January is a 6, so 1 + 6 = 7 = 0. Reduce 20 to 6 (cast out multiples of 7!) to get 6, and add 1 for the 20th century to get 7, which drops to 0. That 0 is the code for Sunday, and sure enough, <a href="http://www.searchforancestors.com/utility/dayofweek.html">January 20, 1985, was a Sunday</a>.<br /><br />Once you've worked out the day of the week for a given date in the 21st century, there's a simple pattern to alter the day for other centuries:<br /><ul><li>2300 to 2399 = add 1</li><li>2200 to 2299 = add 3</li><li>2100 to 2199 = add 5</li><li>2000 to 2099 = add 0</li><li>1900 to 1999 = add 1</li><li>1800 to 1899 = add 3</li><li>1700 to 1799 = add 5</li><li>1600 to 1699 = add 0</li></ul>There is one VERY important note here for January and February dates in the years ending in 00: If a year ends in 00, it's only a leap year if it's divisible by 400. The years 1600, 2000, and 2400, and so on are leap years, while years like 1900, 1800, and 2100 are not. If you're given a January or February date in a year ending in 00, double check whether it's a leap year before you make the leap year adjustment.<br /><br />Take a few minutes to study these adjustments, and then <a href="http://gmmentalgym.blogspot.com/2011/03/day-of-week-for-any-date-quiz-revised.html">practice using them in the Dates: 1600 to 2399 quiz here</a>.<br /><br />Assuming you've put in the practice, you should be ready to give the day of the week for any date. <a href="#ndatetips" class="jumpup">In the next section, I'll provide a few tips and some background that can help improve your performance</a>.<br /><br /></div><div><h2>Calendar Background</h2>The current calendar system we use is known as the <a href="http://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian calendar</a>, since it was introduced by <a href="http://en.wikipedia.org/wiki/Pope_Gregory_XIII">Pope Gregory XIII</a>. It was first put into use in 1582 by the Catholic countries, so the calculations you've learned aren't really effective for dates before 1600.<br /><br />In addition, many non-Catholic countries didn't adopt the Gregorian calendar until much later. Britain and its colonies didn't adapt the calendar until 1752. The use of the Gregorian calendar as a worldwide standard, however, didn't happen until the 1920s!<br /><h2>Tips</h2>• I can't emphasize enough the speed advantages of dropping multiples of 7, and becoming comfortable with that process. After you get use to doing this for dates from the 7th to the 31st several times, it almost becomes automatic.<br /><br />• Carry a perpetual calendar! It's one thing to do this feat and know you're right. When you're doing it for an audience, they'll need some way to verify that you're correct. Originally, this meant carrying around a bulky book of calendars, but many mobile devices today make this much easier.<br /><br />You'll generally want an app that mainly generates calendars for a wide variety of year, without appointment features, such as <a href="http://appshopper.com/productivity/quickcal">QuickCal</a> for the iPhone and iPod Touch. iPad users can use <a href="http://appshopper.com/productivity/yearviewer-for-ipad">YearViewer</a>, and Android users can use <a href="https://market.android.com/details?id=phoenix.TwoHundredYearCalendar">Two Hundred Year Calendar</a> or <a href="https://market.android.com/details?id=com.marblemice.dayofweek&feature=search_result">Day of Week</a>.<br /><br />• Want to practice on the go? <a href="http://x42.com/mp3/doy/">Download these free mp3 files</a> that give a date, then pause, then give the day of the week. The pauses range from 30 seconds down to 3 seconds, so you can challenge yourself as you get better. They're available in both DATE/MONTH/YEAR order (common in the UK, Australia, and Europe) and MONTH/DATE/YEAR (common in the US).<br /><br />• As you've seen, working out year codes can take longer than just remembering the month, date, and week codes. When performing, the smart thing to do is ask for the year first, work out the year code as needed (including whether a leap adjustment will be needed), and only then ask for the specific date.<br /><br />That way, not only do you get the year calculation out of the way, but you'll be able to determine the weekday more quickly and it will appear more impressive to your audience.<br /><br />• When you're comfortable performing the feat this way, but you find you desire to be quicker, there is a more advanced step you can take. You can completely eliminate the calculations of the year code by memorizing the 100 codes needed for the years 2000-2099.<br /><br />To do this, you'll need to be familiar with the <a href="http://www.youtube.com/watch?v=Hwq5rJgkYUw">Link System</a>, the <a href="http://www.youtube.com/watch?v=LdnN9nd4KzQ">Shape Peg System</a> and the <a href="http://memory.uva.nl/memimprovement/eng/phon_peg.htm">Phonetic Peg System (AKA the Major System)</a> (with images for 0 to 99).<br /><br />Once you've practiced those systems and are comfortable with them, you use the Phonetic Peg System for images to represent the last two digits of the year (0 to 99), and the Shape Peg system for the year code (from 0 to 6). You then use the Link System to mentally link those two images together.<br /><br />If you decide to go this method, here's a complete chart of the years from 2000 to 2099 with their corresponding year codes. Because the images people use with the above systems are so widely varied, I've avoided suggesting any mnemonics.<br /><br /><table class="flexme"><thead><tr> <th width="252">Year</th> <th width="252">Year Code</th></tr></thead> <tbody><tr> <td>2000</td> <td>0</td></tr><tr> <td>2001</td> <td>1</td></tr><tr> <td>2002</td> <td>2</td></tr><tr> <td>2003</td> <td>3</td></tr><tr> <td>2004</td> <td>5</td></tr><tr> <td>2005</td> <td>6</td></tr><tr> <td>2006</td> <td>0</td></tr><tr> <td>2007</td> <td>1</td></tr><tr> <td>2008</td> <td>3</td></tr><tr> <td>2009</td> <td>4</td></tr><tr> <td>2010</td> <td>5</td></tr><tr> <td>2011</td> <td>6</td></tr><tr> <td>2012</td> <td>1</td></tr><tr> <td>2013</td> <td>2</td></tr><tr> <td>2014</td> <td>3</td></tr><tr> <td>2015</td> <td>4</td></tr><tr> <td>2016</td> <td>6</td></tr><tr> <td>2017</td> <td>0</td></tr><tr> <td>2018</td> <td>1</td></tr><tr> <td>2019</td> <td>2</td></tr><tr> <td>2020</td> <td>4</td></tr><tr> <td>2021</td> <td>5</td></tr><tr> <td>2022</td> <td>6</td></tr><tr> <td>2023</td> <td>0</td></tr><tr> <td>2024</td> <td>2</td></tr><tr> <td>2025</td> <td>3</td></tr><tr> <td>2026</td> <td>4</td></tr><tr> <td>2027</td> <td>5</td></tr><tr> <td>2028</td> <td>0</td></tr><tr> <td>2029</td> <td>1</td></tr><tr> <td>2030</td> <td>2</td></tr><tr> <td>2031</td> <td>3</td></tr><tr> <td>2032</td> <td>5</td></tr><tr> <td>2033</td> <td>6</td></tr><tr> <td>2034</td> <td>0</td></tr><tr> <td>2035</td> <td>1</td></tr><tr> <td>2036</td> <td>3</td></tr><tr> <td>2037</td> <td>4</td></tr><tr> <td>2038</td> <td>5</td></tr><tr> <td>2039</td> <td>6</td></tr><tr> <td>2040</td> <td>1</td></tr><tr> <td>2041</td> <td>2</td></tr><tr> <td>2042</td> <td>3</td></tr><tr> <td>2043</td> <td>4</td></tr><tr> <td>2044</td> <td>6</td></tr><tr> <td>2045</td> <td>0</td></tr><tr> <td>2046</td> <td>1</td></tr><tr> <td>2047</td> <td>2</td></tr><tr> <td>2048</td> <td>4</td></tr><tr> <td>2049</td> <td>5</td></tr><tr> <td>2050</td> <td>6</td></tr><tr> <td>2051</td> <td>0</td></tr><tr> <td>2052</td> <td>2</td></tr><tr> <td>2053</td> <td>3</td></tr><tr> <td>2054</td> <td>4</td></tr><tr> <td>2055</td> <td>5</td></tr><tr> <td>2056</td> <td>0</td></tr><tr> <td>2057</td> <td>1</td></tr><tr> <td>2058</td> <td>2</td></tr><tr> <td>2059</td> <td>3</td></tr><tr> <td>2060</td> <td>5</td></tr><tr> <td>2061</td> <td>6</td></tr><tr> <td>2062</td> <td>0</td></tr><tr> <td>2063</td> <td>1</td></tr><tr> <td>2064</td> <td>3</td></tr><tr> <td>2065</td> <td>4</td></tr><tr> <td>2066</td> <td>5</td></tr><tr> <td>2067</td> <td>6</td></tr><tr> <td>2068</td> <td>1</td></tr><tr> <td>2069</td> <td>2</td></tr><tr> <td>2070</td> <td>3</td></tr><tr> <td>2071</td> <td>4</td></tr><tr> <td>2072</td> <td>6</td></tr><tr> <td>2073</td> <td>0</td></tr><tr> <td>2074</td> <td>1</td></tr><tr> <td>2075</td> <td>2</td></tr><tr> <td>2076</td> <td>4</td></tr><tr> <td>2077</td> <td>5</td></tr><tr> <td>2078</td> <td>6</td></tr><tr> <td>2079</td> <td>0</td></tr><tr> <td>2080</td> <td>2</td></tr><tr> <td>2081</td> <td>3</td></tr><tr> <td>2082</td> <td>4</td></tr><tr> <td>2083</td> <td>5</td></tr><tr> <td>2084</td> <td>0</td></tr><tr> <td>2085</td> <td>1</td></tr><tr> <td>2086</td> <td>2</td></tr><tr> <td>2087</td> <td>3</td></tr><tr> <td>2088</td> <td>5</td></tr><tr> <td>2089</td> <td>6</td></tr><tr> <td>2090</td> <td>0</td></tr><tr> <td>2091</td> <td>1</td></tr><tr> <td>2092</td> <td>3</td></tr><tr> <td>2093</td> <td>4</td></tr><tr> <td>2094</td> <td>5</td></tr><tr> <td>2095</td> <td>6</td></tr><tr> <td>2096</td> <td>1</td></tr><tr> <td>2097</td> <td>2</td></tr><tr> <td>2098</td> <td>3</td></tr><tr> <td>2099</td> <td>4</td></tr></tbody> </table><br /></div></div>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com215tag:blogger.com,1999:blog-2800835365312821409.post-78793172113028098382011-02-19T21:00:00.000-08:002011-06-18T17:05:12.454-07:00The Unit Circle<ul id="tabs"><span id="fullpost"><li><a id="uc1" href="#ucradians" class="s">Radians?!?</a></li><li><a id="uc2" href="#uccircle" class="s">Unit Circle</a></li><li><a id="uc3" href="#uccrdsone" class="s">Coords 1</a></li><li><a id="uc4" href="#uccrdstwo" class="s">Coords 2</a></li><li><a id="uc4" href="#ucunderstd">Understanding</a></li></span></ul><div class="panes"><div>We'll start with the basics by introducting the concept of radians. What exactly are radians?<br /><br /><span id="fullpost">Radians are an alternative to degrees. Let's make sure that everyone is on the same page, with a quick and fun refresher course in degrees:<br /><br /><object width="530" height="428"><param name="movie" value="http://www.youtube.com/v/tqIki33mTgs?fs=1&hl=en_US&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/tqIki33mTgs?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="530" height="428"></embed></object><br /><br />Most people are familiar with degrees. They're an absolute necessity when studying things like geography (where on Earth am I?) or astronomy (When will I be able to see a given star from where I am on Earth?). So why do we even need an alternative to degrees?<br /><br />I'll highlight the problem with a smaller-scale example. Imagine a public park with circular running tracks of varying sizes, and two people, one who is trying to build his speed and stamina for a 100 meter race, and the other person who is timing the runner. They find a track, and the timer stands in the center of the circular track. The runner notes that the circular track is some weird amount, say, 142 meters in circumference, so he needs to know the location of the 100 meter mark.<br /><br />The timer whips out his calculator, divides 100 by 142, getting 0.704225352. He multiplies this by 360 degrees, since the track is circular, and cheerfully exclaims that all the runner has to do is run 254 degrees (253.521127 degrees, to be more precise) to cover 100 meters on that track. At this point, the runner gives the timer a funny look.<br /><br />See the problem now? 254 degrees is great when describing how far the timer, standing in the center of the circular track, has to turn to watch the runner. This doesn't help the runner much, as the runner isn't standing in the center. That's the whole thing with degrees; they're great for observers, such as the timer, but not so much for people or things moving around a circumference, such as our runner. This is why there's a need for an alternative to degrees.<br /><br />Note that the absolute distance of 100 meters isn't of much help, either. On the different sized tracks in the park, that distance will be a different number of laps on each track. So, absolute distance and degrees aren't handy, thus we introduce radians. So what exactly are they?<br /><br />Since the radius of a circle has a constant relationship with the circumference, that of <a href="http://gmmentalgym.blogspot.com/search/label/Pi">Pi</a> times twice the radius, how about counting off how far we've traveled around the circumference of a circle in terms of that circle's own “radius units”? It's a good idea, but “radius units” sounds weird (I think it's the repetition of the letter U), so we use the term radians instead!<br /><br />It boils down to this: 1 radian is simply the length of a circle's radius traveled around that same circle's circumference.<br /><br /><a href="http://en.wikipedia.org/wiki/File:Radian_cropped_color.svg"><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/radian.png" alt="Stannered's radian illustration" style="display:block;margin-left:auto;margin-right:auto;" /></a><br />That also gives us the formula to calculate radians: Radians = distance traveled / radius.<br /><br />Math books like to scare you by writing this same formula as <span style="font-style:italic;">θ = s / r</span>. <span style="font-style:italic;">θ</span> is pronounced “theta”, and simply refers to the answer in radians. <span style="font-style:italic;">s</span> means “arc length”, or, the distance traveled around the circumference. <span style="font-style:italic;">r</span>, the only straightforward shorthand in this formula, means the length of the radius.<br /><br />Going back briefly to the oberver's point of view, 1 radian translates into about 57.3 degrees (actually 57.29577951... and on and on). For the oberver, this certainly isn't a nice neat number, like 90 degrees, 180 degrees, or 360 degrees. As we've already learned though, the observer's viewpoint is not the point of radians.<br /><br />However, <a href="#uccircle" class="jumpup">in the next tab, we'll introduce the unit circle concept itself</a>, and see how radians make things nice and easy for the person or thing that is moving around it.</span></div><div>Since we now have the <a href="#ucradians" class="jumpup">scalable concept of radians</a> to work with, we can now develop an entire scalable circle with which to work. We'll start by drawing on graph paper <a href="http://www.wolframalpha.com/input/?i=x%5E2+%2B+y%5E2+%3D+1">a circle centered at the (0,0) mark that has a 1 unit radius</a> (remember <a href="http://en.wikipedia.org/wiki/Cartesian_coordinate_system">cartesian coordinates</a>?). It looks at it does below, with the coordinates marked where it crosses an axis:<br /><br /><a href="http://commons.wikimedia.org/wiki/File:Yhvyvczsa8.png"><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/unitcircle1.png" alt="Drandstrom's unit circle illustration" style="display:block;margin-left:auto;margin-right:auto;" /></a><br />That fact that it's a circle with a one-unit radius gives us the shorthand term for it: <span style="font-style:italic;">unit circle</span>. Let's take a closer look at it what a unit circle can do.<br /><br />Here's your first question: Since radians measure how far around a circle you've traveled, what's the distance around a full unit circle in radians? Let's work this out.<br /><br />Our circle has a radius of 1 unit, so the circumference (our total distance traveled, in this case) is 2 times the radius times Pi, so we have 2 times 1 unit, giving 2 units, times Pi, resulting in 2 * Pi, or 2π for short (That π symbol is the Pi symbol, not a small letter n). That's just the total distance traveled, though.<br /><br />To convert that to radians, we need to divide by the radius, of course. Our radius is 1 unit, so we work out 2π/1, which is simply 2π. In other words, the distance around a full circle is 2π radians in length!<br /><br />Now you see why 1 radian is such a weird angle in degrees (1 radian = 57.29577951... degrees). When doubled and multiplied by Pi, it has to give a nice even 360 degrees. Again, we're going to stick to radians in this discussion, so just think of 2π radians as a full circle.<br /><br />From here, it's not hard to see that π radians gives us half of a circle, and π/2 radians gives us a quarter circle. <a href="http://www.wolframalpha.com/input/?i=%283%2F4%29+*+%282+*+pi%29">Three-quarters of a circle</a>, then, would give us a distance of 3π/2 radians.<br /><br /><a href="http://commons.wikimedia.org/wiki/File:Arco1.png"><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/unitcircle2.png" alt="Drandstrom's unit circle in radians illustration" style="display:block;margin-left:auto;margin-right:auto;" /></a><br />So, what distances are we traveling in radians when we traveling 45 degrees? 45 degrees is the centered observer's way of saying an eighth of a circle. The mover thinks of a circle as being 2π radians, so 2π times 1/8 would be 2π/8, or the same as π/4 radians.<br /><br />Every 1/8 of a trip around the circle, then, would be in units of π/4 radians:<br /><ul><li>1/8 = π/4 radians</li><li>2/8 = 2π/4 = π/2 radians</li><li>3/8 = 3π/4 radians</li><li>4/8 = 4π/4 = &pi radians</li><li>5/8 = 5π/4 radians</li><li>6/8 = 6π/4 = 3π/2 radians</li><li>7/8 = 7π/4 radians</li><li>8/8 = 8π/4 = 2π radians</li></ul>When you see the patterns and understand the process, it's actually not hard to understand.<br /><br />Since angles of 30 degrees, or 1/12 of the distance around the circle, are also common, they're not hard to work out in radians. 1/12 of 2π radians comes down to π/6 radians. From there, we get:<br /><ul><li>1/12 = π/6 radians</li><li>2/12 = 2π/6 = π/3 radians</li><li>3/12 = 3π/6 = π/2 radians</li><li>4/12 = 4π/6 = 2π/3 radians</li><li>5/12 = 5π/6 radians</li><li>6/12 = 6π/6 = π radians</li><li>7/12 = 7π/6 radians</li><li>8/12 = 8π/6 = 4π/3 radians</li><li>9/12 = 9π/6 = 3π/2 radians</li><li>10/12 = 10π/6 = 5π/3 radians</li><li>11/12 = 11π/6 radians</li><li>12/12 = 12π/6 = 2π radians</li></ul>Here's everything you've learned so far in one diagram, with the 90 degree units marked in black, the 45 degree units marked in red, and the 30 degree units marked in blue:<br /><br /><a href="http://commons.wikimedia.org/wiki/File:Unit_circle_angles_color.svg"><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/unitcircle3.png" alt="Jim Belk's unit circle in radians illustration without angle coordinates" style="display:block;margin-left:auto;margin-right:auto;" /></a><br />So, if you can remember that 2π radians takes you all the way around the circle, and that π radians, as well as 6π/6 and 4π/4 radians, takes you halfway around the circle, working out the rest of the numbers isn't difficult at all.<br /><br />In the next tab, we'll discuss another amazing way the unit circle becomes useful when we <a href="#uccrdsone" class="jumpup">focus on figuring out coordinates</a>.<br /><br /><span style="font-style:italic;"></span></div><div>I have some quick refresher questions before we move on. When you've traveled π/2 radians, at what (x,y) coordinates are you? You're at (0,1).<br /><br />Here's a tougher one: When you've traveled π/4 radians, at what (x,y) coordinates are you? That one's a little trickier. For this one, we're going to have to go back the viewpoint of the observer in the center, and thus back to degrees.<br /><br />The radius of the unit circle is, of course, always 1 unit. If we construct a right triangle with the radius line as the <a href="http://en.wikipedia.org/wiki/Hypotenuse">hypotenuse</a>, we could construct a right triangle for any angle in the circle:<br /><br /><a href="http://commons.wikimedia.org/wiki/File:Trigo-unitcircle-animation.gif"><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/unitcircle4.gif" alt="Peleg's triangle and unit circle animation" style="display:block;margin-left:auto;margin-right:auto;" /></a><br />Since π/4 radians from the central observer's point of view is 45 degrees, we'll create a 45 degree right triangle to help work out those coordinates:<br /><br /><a href="http://commons.wikimedia.org/wiki/File:Trigo-unitcircle-animation.gif"><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/unitcircle5.png" alt="Peleg's triangle and unit circle drawing of a 45 degree angle" style="display:block;margin-left:auto;margin-right:auto;" /></a><br />Since we're looking for the (x,y) coordinate, the length of the side adjacent to our angle (the one running along the x axis) would give us the x coordinate. The height of the side opposite the angle (the one running straight up to meet the radius/hypotenuse) would give us the y coordinate.<br /><br />If you remember all those lessons about right triangles, it's at this point where you begin to realize how many tools we can use here.<br /><ul><li>Pythagorean Theorem: a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup></li><li>Sine of any angle = opposite/hypotenuse</li><li>Cosine of any angle = adjacent/hypotenuse</li></ul>(Don't forget: <a href="http://mathworld.wolfram.com/SOHCAHTOA.html">SOHCAHTOA</a>)<br /><br />Since the hypotenuse is 1, and both the sine and cosine divide by the hypotenuse, not only does this make the math nice and easy, but the answers will also be the exact coordinates we need!<br /><br />The x coordinate is the length of the side adjacent to the angle, so we need to use the cosine formula. By cheating and using a calculator (make sure to set it in degrees, not radians!) we find that <a href="http://www.google.com/search?q=cos(45+degrees)">cos(45 degrees) = 0.707106781...</a>. To get the y coordinate, we find the length of the side opposite the angle by using <a href="http://www.google.com/search?q=sin(45+degrees)">sin(45 degrees), which is also 0.707106781...</a>.<br /><br />So, we have our coordinates for a 45 degree, or π/4 radian, angle: (0.707106781...,0.707106781...). Hmmm, that's another one of <a href="http://en.wikipedia.org/wiki/Irrational_number">those numbers that goes on forever</a>. Isn't there a better way to state that number?<br /><br />Let's run through the Pythagorean Theorem approach, especially know that we know that sides a and b are equal, and see what we can come up with:<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ a^{2} @plus; b^{2}= 1 \\ a = b \\ a^{2} @plus; a^{2}= 1 \\ 2a^{2}= 1 \\ \\ a^{2}= \frac{1}{2} = .5 \\ a = b = \sqrt{.5} = 0.707106781..." target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ a^{2} + b^{2}= 1 \\ a = b \\ a^{2} + a^{2}= 1 \\ 2a^{2}= 1 \\ \\ a^{2}= \frac{1}{2} = .5 \\ a = b = \sqrt{.5} = 0.707106781..." title="\\ a^{2} + b^{2}= 1 \\ a = b \\ a^{2} + a^{2}= 1 \\ 2a^{2}= 1 \\ \\ a^{2}= \frac{1}{2} = .5 \\ a = b = \sqrt{.5} = 0.707106781..." /></a><br /><br />“OK,” you say, “so what? We just came up with the same numbers.” Let's back up a bit to to where a squared (and b squared, in the specific case of a 45 degree right triangle) was equal to 1/2. Instead of using .5, let's see where working with that 1/2 as a fraction can take us:<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ a^{2} = \frac{1}{2} \\ \\ \\ a = b = \sqrt{\frac{1}{2}} \\ \\ \\ a = b = \frac{\sqrt{1}}{\sqrt{2}} \\ \\ \\ a = b = \frac{1}{\sqrt{2}} \\" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ a^{2} = \frac{1}{2} \\ \\ \\ a = b = \sqrt{\frac{1}{2}} \\ \\ \\ a = b = \frac{\sqrt{1}}{\sqrt{2}} \\ \\ \\ a = b = \frac{1}{\sqrt{2}} \\" title="\\ a^{2} = \frac{1}{2} \\ \\ \\ a = b = \sqrt{\frac{1}{2}} \\ \\ \\ a = b = \frac{\sqrt{1}}{\sqrt{2}} \\ \\ \\ a = b = \frac{1}{\sqrt{2}} \\" /></a><br /><br />Hmmm...writing one over the square root of 2 is certainly much easier than that long string of numbers. Indeed, when you're tested on unit circles on many standardized tests, they'll usually ask you to write the π/4 radian or 45-degree coordinate in exactly that way.<br /><br />Before moving on, though, I'd like to make that fraction a bit neater by making the bottom a whole number. We do that by multiplying both the top and bottom by the square root of two, and expressing the coordinates as fractions:<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ a = b = \frac{1}{\sqrt{2}} \\ \\ \\ a = b = \frac{\sqrt{2}}{2} \\ \\ \\ (\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ a = b = \frac{1}{\sqrt{2}} \\ \\ \\ a = b = \frac{\sqrt{2}}{2} \\ \\ \\ (\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})" title="\\ a = b = \frac{1}{\sqrt{2}} \\ \\ \\ a = b = \frac{\sqrt{2}}{2} \\ \\ \\ (\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})" /></a><br /><br />Not only is this a cleaner way to write the coordinates, it will make this and the other coordinates we work out much easier to remember, as you'll see in later sections.<br /><br />The fractions may look funny, but all they're really saying is, “If you take the square root of 2, and divide it in half, that's a shortcut to working out this coordinate.” Or, put the opposite way, “Hey, if you take this coordinate, double it, and then square it, you get a nice, simple number, in this case - 2!”<br /><br /><a href="#uccrdstwo" class="jumpup">We'll work out the coordinates and their corresponding fractions for the 30- and 60-degree angles in the next section</a>, as well as their multiples.</div><div>So, now we not only know the coordinates for a 45 degree, or π/4 radian, point on a circle, we know that the cosine will give us the x coordinate and that the sine will give us the y coordinate on the unit circle. We also know that expressing these coordinates in fractions is much simpler than writing out the endless irrational decimals.<br /><br />Let's work out the coordinates for the point at 30 degrees (π/6 radians):<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ cos(30^{\circ}) = 0.866025404...\\ sin(30^{\circ}) = 0.5\\ (0.866025404..., 0.5)\\ \\ (0.866025404..., \frac{1}{2})\\" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ cos(30^{\circ}) = 0.866025404...\\ sin(30^{\circ}) = 0.5\\ (0.866025404..., 0.5)\\ \\ (0.866025404..., \frac{1}{2})\\" title="\\ cos(30^{\circ}) = 0.866025404...\\ sin(30^{\circ}) = 0.5\\ (0.866025404..., 0.5)\\ \\ (0.866025404..., \frac{1}{2})\\" /></a><br /><br />Hey! That .5 is nice. That's easy to express as a fraction. But what about that other number? Well, everything else has been expressed over 2, so let's see what happens when we express that number over 2:<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ (\frac{1.73205081...}{2}, \frac{1}{2})\\" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ (\frac{1.73205081...}{2}, \frac{1}{2})\\" title="\\ (\frac{1.73205081...}{2}, \frac{1}{2})\\" /></a><br /><br />Ummm...yuck. Well, square roots seem to be popular in these fractions. Is 1.73205081... the square root of anything? Yep! It turns out that it's the square root of 3! So, the coordinates could be expressed this way:<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ (\frac{\sqrt{3}}{2}, \frac{1}{2})\\" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ (\frac{\sqrt{3}}{2}, \frac{1}{2})\\" title="\\ (\frac{\sqrt{3}}{2}, \frac{1}{2})\\" /></a><br /><br />Next, let's work out the coordinates for 60 degrees (π/3 radians):<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ cos(60^{\circ}) = 0.5\\ sin(60^{\circ}) = 0.866025404...\\ (0.5, 0.866025404...)\\ \\ (\frac{1}{2}, \frac{\sqrt{3}}{2} )\\" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ cos(60^{\circ}) = 0.5\\ sin(60^{\circ}) = 0.866025404...\\ (0.5, 0.866025404...)\\ \\ (\frac{1}{2}, \frac{\sqrt{3}}{2} )\\" title="\\ cos(60^{\circ}) = 0.5\\ sin(60^{\circ}) = 0.866025404...\\ (0.5, 0.866025404...)\\ \\ (\frac{1}{2}, \frac{\sqrt{3}}{2} )\\" /></a><br /><br />Whoah! We get the same numbers as the 30 degree angle, only switched! That's not a coincidence. Remember that the internal angles of triangles always add up to 180 degrees. With a right triangle (a triangle with a 90 degree angle in it) that has a 30 degree angle in it, we find that 180 - 90 - 30 = 60 degrees, the remaining angle. Effectively, the 60 degree coordinates are just the 30 degree coordinates viewed from the other side of the triangle.<br /><br />Let's review all the information, including the coordinates, that we know so far:<br /><br /><a href="http://commons.wikimedia.org/wiki/File:Unit_circle_angles_color.svg"><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/unitcircle6.png" alt="Jim Belk's unit circle in radians illustration with only positive angle coordinates" style="display:block;margin-left:auto;margin-right:auto;" /></a><br />If you think of 1 as also being the square root of 1, you could write 1/2 this way:<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ \frac{1}{2} = \frac{\sqrt{1}}{2}" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ \frac{1}{2} = \frac{\sqrt{1}}{2}" title="\\ \frac{1}{2} = \frac{\sqrt{1}}{2}" /></a><br /><br />So, at all the points where the circle crosses an axis, the coordinates involve 0, +1, or -1 - Simple! And at the oft-used 30° (π/6 radians), 45° (π/4 radians), and 60° (π/6 radians), all the coordinates involve these interesting fractions:<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ \frac{\sqrt{1}}{2}, \ \frac{\sqrt{2}}{2}, \ \frac{\sqrt{3}}{2}" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ \frac{\sqrt{1}}{2}, \ \frac{\sqrt{2}}{2}, \ \frac{\sqrt{3}}{2}" title="\\ \frac{\sqrt{1}}{2}, \ \frac{\sqrt{2}}{2}, \ \frac{\sqrt{3}}{2}" /></a><br /><br />See that? Everything in the fractions is a square root of something over 2! Even better, there's a simple 1, 2, 3 progression! Even with all the complex math involved, it's all boiling down to 0, 1, 2, and 3.<br /><br />That's easy enough to remember, but how do you remember which fractions are set at which coordinates, especially since it's not hard to make a mistake and switch around the coordinates for both 30° and 60°? Here's a video that will teach you quickly, using that 1, 2, 3 progression:<br /><br /><object width="530" height="428"><param name="movie" value="http://www.youtube.com/v/ao4EJzNWmK8?fs=1&hl=en_US&rel=0&iv_load_policy=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ao4EJzNWmK8?fs=1&hl=en_US&rel=0&iv_load_policy=3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="530" height="428"></embed></object><br /><br />What about all the remaining major angles, such as 120°, 135°, and so on?<br /><br />Well, you could go through and work out the coordinates laboriously as we did above, working out the sines and cosines, and so on. However, there's an easier way. We're measuring the 135° (3π/4 radians) angle from the 0° angle. When measured from the 180° (π radians) angle, it works out to be our old friend, the 45° (π/4 radians) angle.<br /><br />One difference, though, is that we're now on the negative side of the x axis, so that the x coordinate will be negative. The means the coordinate for the 135° (3π/4 radians) angle will be:<br /><br /><a href="http://www.codecogs.com/eqnedit.php?latex=\\ (-\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\\ (-\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})" title="\\ (-\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})" /></a><br /><br />Similarly, you can work out the 150° angle as a 30° angle, and so on. They work out to the coordinates we've already determined, but you need to make sure that you adjust the signs (+ or -) for the appropriate section.<br /><br />Are you ready for this? Here's the entire unit circle worked out:<br /><br /><a href="http://commons.wikimedia.org/wiki/File:Unit_circle_angles_color.svg"><img src="http://i261.photobucket.com/albums/ii45/testingfark/greymatters/unitcircle7.png" alt="Jim Belk's unit circle in radians illustration" style="display:block;margin-left:auto;margin-right:auto;" /></a><br />And here's how to draw it that so you remember all that data:<br /><br /><object width="530" height="428"><param name="movie" value="http://www.youtube.com/v/cIVpemcoAlY?fs=1&hl=en_US&rel=0&iv_load_policy=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/cIVpemcoAlY?fs=1&hl=en_US&rel=0&iv_load_policy=3" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="530" height="428"></embed></object><br /><br />I like the approach used in this video of counting the π/3, π/4, and π/6 sections separately, so as to keep them mentally separate.<br /><br /><a href="#ucunderstd" class="jumpup">In the next tab, I'll review and break down the patterns for easier understanding</a>. You'll also learn how to do some quick math on your fingers to get the coordinates.</div><div>It may seem like a lot that you've learned so far, but it boils down to a few basic things:<br /><ul><li>Degrees deal with the observer's point of view. Radians deal with the mover's point of view.</li><li>1 radian = 1 radius length around the circle's circumference.</li><li>Radians work very well with <a href="http://gmmentalgym.blogspot.com/search/label/Pi">Pi</a>, to the extent that π radians = 180 degrees, and 2π radians = 360 degrees.</li><li>If you think of π radians as being 180 degrees, and you know your multiples of 30 and 45, the remaining degree angles aren't difficult to work out in radians.</li><li>All the coordinate points where the circle cross an axis involve a 0, a -1, or a +1. Knowing coordinates makes it easy to work out which is which.</li><li>All the coordinate points of π/6 (30°), π/4 (45°), and π/3 (60°) radians involve fractions easily remembered with <a href="#uccrdstwo" class="jumpup">the 1, 2, 3 progression taught in the video in the previous tab</a>.</li><li>The other major coordinate points can be worked out quite easily from those first 3 sets, as long as you adjust the signs properly.</li><li>Cosine will always give the x coordinate on the unit circle, and sine will always give the y coordinate on the unit circle.</li></ul>That last fact is especially interesting. Thanks to the simple progressions involved, you can actually work out the cosine and sine on your fingers with a simple trick! If you're familiar with <a href="http://en.wikipedia.org/wiki/Trigonometric_functions#Sine.2C_cosine.2C_and_tangent">tangents and cotangents</a>, this video teaches how to handle those on your fingers, as well.<br /><br /><object width="530" height="428"><param name="movie" value="http://www.youtube.com/v/OBmhgiLi77k?fs=1&hl=en_US&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/OBmhgiLi77k?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="530" height="428"></embed></object><br /><br /><a href="http://betterexplained.com/">Betterexplained.com</a> has a wonderful article you should read at this point, called <a href="http://betterexplained.com/articles/intuitive-guide-to-angles-degrees-and-radians/"><span style="font-style:italic;">Intuitive Guide to Angles, Degrees and Radians</span></a>.<br /><br />It really drives home the power of radians. Take this example from the article:<br /><blockquote>Let’s try a real example: you have a bus with wheels of radius 2 meters (it’s a monster truck bus). I’ll say how fast the wheels are turning and you say how fast the bus is moving. Ready?<br /><br />“The wheels are turning 2000 degrees per second”. You’d think:<br /><blockquote>Ok, the wheels are going 2000 degrees per second. That means it’s turning 2000/360 or 5 and 5/9ths rotations per second. Circumference = 2 * pi * r, so it’s moving, um, 2 * 3.14 * 5 and 5/9ths… where’s my calculator…</blockquote>“The wheels are turning 6 radians per second”. You’d think:<br /><blockquote>Radians are distance along a unit circle — we just scale by the real radius to see how far we’ve gone. 6 * 2 = 12 meters per second. Next question.</blockquote>Wow! No crazy formulas, no pi floating around — just multiply to convert rotational speed to linear speed. All because radians speak in terms of the mover.<br /><br />The reverse is easy too. Suppose you’re cruising 90 feet per second on the highway (60 miles per hour) on your 24″ inch rims (radius 1 foot). How fast are the wheels turning?<br /><br />Well, 90 feet per second / 1 foot radius = 90 radians per second.<br /><br />That was easy. I suspect rappers sing about 24″ rims for this very reason.</blockquote>I'm not sure that's the reason they sing about 24″ rims, but I'll go along with it while it lasts.<br /><br />Think of the power you have here. Sure, the unit circle seems complex at first, but the power and patterns it presents when remembered and understood make many things simple.<br /><br />Scaling up to real-world circles and back down to the unit of circles, as well as determining their motion, becomes a simple matter of multiplication. You can work out sines, cosines, tangents, and cotangents on your fingers.<br /><br />Converting from radians to degrees and back, with a little practice, isn't difficult.<br /><br />Which brings to mind the question of practice. The simplest practice I can offer is to <a href="http://webhome.broward.edu/~jguild/unit%20circle%20quiz%20practice.pdf">print out several copies of this PDF</a>, and repeatedly fill it out until you're good enough to do so in under 5 minutes, just as it says.<br /><br /><a href="http://www.sporcle.com/games/Baileyth/unitcircle">Sporcle offer this ingenious quiz for practicing radians and degrees</a>. With help from <a href="#ucunderstd" class="jumpup">the videos from the previous tab</a>, this shouldn't be too tough.<br /><br />The most complete quiz on the unit circle that I've found, however, is <a href="http://www.mathfanatics.com/math/Unit_Circle_Quiz.php">Math Fanatic's Unit Circle and Trigonometry Quiz</a>. The menu lets you select exactly what aspects you want to practice, and the quiz itself lets you practice each section for as long as you need or want. Since it covers most of trigonometry, and not just the unit circle, there will be some quizzes not covered in my unit circle tutorial.<br /><br />I hope you find this useful, and I also hope it helped you better understand the unit circle.</div></div>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com1tag:blogger.com,1999:blog-2800835365312821409.post-22937677054912141982011-01-18T18:01:00.000-08:002011-01-18T18:01:00.902-08:00Squaring 2-Digit Numbers Quiz<script type='text/javascript'>function numberFormat(nStr,prefix){ var prefix = prefix || ''; nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) x1 = x1.replace(rgx, '$1' + ',' + '$2'); return prefix + x1 + x2; } function random(maxValue) { day= new Date(); hour= day.getHours(); min=day.getMinutes(); sec=day.getSeconds(); mili=day.getTime() return(((hour*3600)+(min*60)+(sec)+mili) % maxValue); }; function ranom(maxValue) { day= new Date(); mil=day.getTime(); return((mil) % maxValue); }; function tenandfive() { maxValue=9; numA=random(maxValue); numA=numA + 1; numA=numA * 10; numE=ranom(maxValue); if (numE > 5) { numA = numA + 5; }; numB=numA * numA; strD=numA.toString(); strC=numB.toString(); strR="What is " + strD + " squared?"; var quiz = [ { ques: strR, ans: strC, } ]; var options = { title: "Squaring Multiples of 10 and 5", disableRestart: true, quizType: "fill" }; $("#quizarea").jQuizMe(quiz, options); }; function firstgroup() { maxValue=25; numA=random(maxValue); numA=numA + 1; numB=numA * numA; strD=numA.toString(); strC=numB.toString(); strR="What is " + strD + " squared?"; var quiz = [ { ques: strR, ans: strC, } ]; var options = { title: "Squaring numbers 1-25", disableRestart: true, quizType: "fill" }; $("#quizarea").jQuizMe(quiz, options); }; function secondgroup() { maxValue=25; numA=random(maxValue); numA=numA + 26; numB=numA * numA; strD=numA.toString(); strC=numB.toString(); strR="What is " + strD + " squared?"; var quiz = [ { ques: strR, ans: strC, } ]; var options = { title: "Squaring numbers 26-50", disableRestart: true, quizType: "fill" }; $("#quizarea").jQuizMe(quiz, options); }; function thirdgroup() { maxValue=25; numA=random(maxValue); numA=numA + 51; numB=numA * numA; strD=numA.toString(); strC=numB.toString(); strR="What is " + strD + " squared?"; var quiz = [ { ques: strR, ans: strC, } ]; var options = { title: "Squaring numbers 51-75", disableRestart: true, quizType: "fill" }; $("#quizarea").jQuizMe(quiz, options); }; function fourthgroup() { maxValue=25; numA=random(maxValue); numA=numA + 76; numB=numA * numA; strD=numA.toString(); strC=numB.toString(); strR="What is " + strD + " squared?"; var quiz = [ { ques: strR, ans: strC, } ]; var options = { title: "Squaring numbers 76-100", disableRestart: true, quizType: "fill" }; $("#quizarea").jQuizMe(quiz, options); }; function fifthgroup() { maxValue=25; numA=random(maxValue); numA=numA + 101; numB=numA * numA; strD=numA.toString(); strC=numB.toString(); strR="What is " + strD + " squared?"; var quiz = [ { ques: strR, ans: strC, } ]; var options = { title: "Squaring numbers 101-125", disableRestart: true, quizType: "fill" }; $("#quizarea").jQuizMe(quiz, options); }; </script><span id="fullpost"><a href="http://gmmentalgym.blogspot.com/2011/01/squaring-2-digit-numbers-mentally.html">Learn to perform the 2-digit number squaring feat here</a>.<br /><br /><span style="font-weight:bold;">Note:</span> Enter answers without any commas.<br /><br /><br /><a class="gmButton" onClick="tenandfive()">Squaring Multiples of 10 and 5</a><br /><br /><a class="gmButton" onClick="firstgroup()">Squaring Numbers from 1 to 25</a><br /><br /><a class="gmButton" onClick="secondgroup()">Squaring Numbers from 26 to 50</a><br /><br /><a class="gmButton" onClick="thirdgroup()">Squaring Numbers from 51 to 75</a><br /><br /><a class="gmButton" onClick="fourthgroup()">Squaring Numbers from 76 to 100</a><br /><br /><a class="gmButton" onClick="fifthgroup()">Squaring Numbers from 101 to 125</a><br /><br />Quiz will appear below:<br /><div id="quizarea"></div></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com1tag:blogger.com,1999:blog-2800835365312821409.post-60408035847033871612011-01-18T18:00:00.000-08:002011-06-18T17:04:56.985-07:00Squaring 2-Digit Numbers Mentally<ul id="tabs"><span id="fullpost"><li><a id="sq1" href="#sqbasics" class="s">Basics</a></li><li><a id="sq2" href="#sqmath" class="s">Math</a></li><li><a id="sq3" href="#sqmem" class="s">Memory</a></li></span></ul><div class="panes"><div><h2>Introduction</h2>In this post, you'll learn how to square numbers from 1-100 in your head!<br /><br /><span id="fullpost">As a refresher, squaring a number simply means to multiply it by itself. For example, 4 squared is 16 because 4 times 4 is 16. You should know the squares of all the numbers from 1 through 10 by heart already.<br /><h2>Multiples of 10</h2>If you already know your squares of the numbers 1 through 10, the multiples of 10 are easy. When a number from 1-100 ends in zero, simply drop the ending 0, square the remaining number, and then add 2 zeroes. For example, to work out 20 squared, drop the zero leaving the 2, square it to get 4, then tack on 2 zeroes to that 4, resulting in 400.<br /><br />70 squared? 4900, because 7 squared is 49, and the two zeroes added make it 4900. 100 is trickier, but uses the same approach. 100 with the final zero dropped gives us 10. 10 squared is 100, and adding 2 zeroes gives us 10,000.<br /><h2>Multiples of 5</h2>Multiples of 5 are almost as easy. You do need to make sure you know your multiplication tables up to at least 10 times 10. The method taught here is also <a href="http://gmmentalgym.blogspot.com/2010/10/root-extractions.html#rtnumfive">taught in the root extraction tutorial</a>, as well.<br /><br />When given a number ending in 5, simply take the 10s digit, and multiply by a number one higher than itself. Take that answer, take a "25" on the end, and you've got the answer!<br /><br />For example, let's say you're asked what 35 squared is. Take the 3 (the 10s digit), and multply it by 4 (which is one higher than 3), and you get 12. Tack a 25 on the end, giving you 1225. Simple, isn't it?<br /><br />Let's try a higher number, like 75 squared. 7 times 8? 56. Tacking on the 25, gives us 5625!<br /><br />Here's a slideshow to help explain this procedure in more detail:<br /><br /><div class="playorlink"><object data="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=squaring-numbers-ending-in-5-7176&rel=0&stripped_title=squaring-numbers-ending-in-5&userName=greymatters" width="530" height="434" type="application/x-shockwave-flash"> <param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=squaring-numbers-ending-in-5-7176&rel=0&stripped_title=squaring-numbers-ending-in-5&userName=greymatters" /><param name="flashvars" value="xml=flash/assets/jfeFlash.xml" /><param name="allowFullScreen" value="true" /></object><div class="jfeAlternate jfeAlternateDefault" style="display:none;"><span style="font-weight:bold;"><a href="http://www.slideshare.net/greymatters/squaring-numbers-ending-in-5">Click here to view the <span style="font-style:italic;">Squaring Numbers Ending in 5</span> slideshow</a></span></div></div><br />To quiz yourself on squaring multiples of 10 and 5, <a href="http://gmmentalgym.blogspot.com/2011/01/squaring-2-digit-numbers-quiz.html">click here</a>. To learn the mental math approach to squaring the remaining numbers, <a href="#sqmath" class="jumpup">click here</a>. To learn the memorization approach to squaring the remaining numbers, <a href="#sqmem" class="jumpup">click here</a>.<br /></div><div><h2>Numbers from 1-25</h2>For the approach using pure mental math, you'll need to know your squares from 1-25 by heart. From 1 to 10 you should already know, and from <a href="#sqbasics" class="jumpup">the techniques on the first page</a>, 15, 20, and 25 will be easily handled, as well. That leaves these squares to learn by heart:<br /><br /><table class="flexme"><thead><tr> <th width="252">Number</th> <th width="252">Square of Number</th></tr></thead> <tbody><tr> <td>11</td> <td>121</td></tr><tr> <td>12</td> <td>144</td></tr><tr> <td>13</td> <td>169</td></tr><tr> <td>14</td> <td>196</td></tr><tr> <td>16</td> <td>256</td></tr><tr> <td>17</td> <td>289</td></tr><tr> <td>18</td> <td>324</td></tr><tr> <td>19</td> <td>361</td></tr><tr> <td>21</td> <td>441</td></tr><tr> <td>22</td> <td>484</td></tr><tr> <td>23</td> <td>529</td></tr><tr> <td>24</td> <td>576</td></tr></tbody> </table><br />The must be known by heart, because the method we're going to use to work out the remaining numbers requires that you can give the above numbers quickly.<br /><h2>Numbers from 26-50</h2>To work out the numbers from 26 to 50, we're going to use an approach in which we multiply by 50.<br /><br />Multiplying any number by 50 is easy – all you have to do is divide the number by 2, and add 2 zeroes (more accurately, you would move the decimal 2 places to the right). 48 times 50? Half of 48 is 24, and two zeroes added results in 2400, which is the correct answer. This method only involves multiplying even numbers by 50, so you won't have to worry about dealing with numbers like 24.5 (Half of 49).<br /><br />When given any number from 26-50, you're first going to work out how far that number is from 50, then subtract that distance from the given number. For example, if you're given the number 47, it's easy to work out that it's only 3 away from 50. Subtracting that 3 from 47, we get 44.<br /><br />Instead of solving 47 times 47, then, we're going to work out the much easier problem of 44 times 50, which is 2200. However, this isn't the same as the answer to 47 squared, so we need to make an adjustment.<br /><br />From 47, we both moved up 3 to 50 and down 3 to 44. So, we square this 3 to get 9, and add that to the other answer we worked out, 2,200, to get a total of 2,209. This is the answer to 47 times 47!<br /><br />So, when given a number, you work out how far the given is from 50, and find a number that's equally far <span style="font-style:italic;">below</span> the given number (the “low” number), and also remember this difference. Multiply 50 times the “low” number, adjust it by squaring the difference you moved, and adding that amount, and the result will be the square!<br /><br />Let's try this with 44, to help make this clearer. 44 is 6 away from 50, so we figure out that 44 - 6 = 38. 38 times 50 is easy, 1,900. We moved a difference of 6 in both directions, so we add 36 (6 squared) to 1900, to get 1,936!<br /><br />How about 39 squared? That's 11 away from both 50 and 28. 28 times 50? 1,400. 11 squared is 121, and adding that to 1,400, we get 1,521!<br /><br />How about 35? Trick question! That's made easier by <a href="#sqbasics" class="jumpup">the multiples of 5 technique from the first page</a>. Don't forget to use the easier techniques in the easier cases.<br /><h2>Numbers from 51-75</h2>The same technique is going to be used for numbers from 51 to 75, but with one minor change. You'll be moving down to 50, and up to another number (Previously, you moved up to 50, and down to another number). Other than that, the process is basically the same.<br /><br />Let's try 56 squared. 56 is 6 away from 50 and 62. 50 times 62 is 3,100, plus 36 (6 squared) gives us 3,136!<br /><br />How about 67? The distance makes this a little more challenging, but the process is still the same. 67 is 17 away from 50 and 84, so we multiply those two numbers to get 4,200. 17 squared is 289, so we work out 4,200 plus 289 to get our final answer of 4,489.<br /><h2>Numbers from 76-100</h2>As easy as multiplying by 50 has been, multiplying by 100 is even easier – just add 2 zeroes!<br /><br />For numbers from 76-100, we're going to adjust upward to 100, as opposed to using 50 as we have been. Wait until you see how easy this makes the process!<br /><br />Let's try working out 98 squared. 98 is 2 away from 100 and 96, and multiplied together, that gives us 9,600. 2 squared is 4, and 9600 plus 4 is 9,604. That's 98 squared!<br /><br />How about 91? We start out with 8,200 (do you see why?), and add 81 (again, do you see why?), to get 8,281.<br /><br />The more you practice each of these stages, the more you'll get a feel for certain patterns. This will allow you to speed up your calculations.<br /><h2>Numbers from 100-125</h2>By now, you've probably figured out that you can go up to 125 with just a minor adaptation, similar to that we used when going above 50.<br /><br />What's 103 squared? It's between 106 and 100, so we multiply those to get 10,600. 3 squared is 9, so that added in gives us 10,609!<br /><br />What about a toughie, like 124? That's between 100 and 148, so we start with 14,800. 24 squared is 576, so we add those together to get 15,376.<br /><br />With a little practice, you should have this process down in a faster time than you may have ever thought possible.<br /><br />To practice squaring numbers, <a href="http://gmmentalgym.blogspot.com/2011/01/squaring-2-digit-numbers-quiz.html">click here</a>. To learn an alternative approach using memorization for squaring the numbers from 1 to 100, <a href="#sqmem" class="jumpup">click here</a>.<br /></div><div><h2>Memorizing the Squares</h2>It was <a href="http://www.jimwilder.com/">Alabama math and science teacher Jim Wilder</a> who first suggested the idea of memorizing the squares to me. The process is similar to <a href="http://gmmentalgym.blogspot.com/2010/10/400-digits-of-pi.html">the one I use for memorizing 400 digits of Pi</a>.<br /><br />First, you should learn the <a href="#sqbasics" class="jumpup">the multiples of 10 and 5 techniques from the first page</a>, and you should still <a href="#sqmath" class="jumpup">know the squares from 1-25 by heart</a>, as those are still quicker than the memory approach. This also helps minimize the amount of links needed.<br /><h2>Prerequisites:</h2><a href="http://gmmentalgym.blogspot.com/2010/10/memory-basics.html">Link System</a><br /><a href="http://gmmentalgym.blogspot.com/2010/10/memory-basics.html">Major System</a><br /><h2>Links</h2>With the exception of the multiples of 10 and 5, Jim Wilder put in some amazing work developing major system mnemonics for all the squares from 26 to 99 (Thanks again, Jim, for both your work and willingness to share it with us!):<br /><br /><table class="flexme"><thead><tr> <th width="120">Number</th> <th width="120">Square of Number</th> <th width="120">Number Mnemonic</th> <th width="120">Square Mnemonic</th></tr></thead> <tbody><tr> <td>26</td> <td>676</td> <td>iNCH</td> <td>SHaKiSH</td></tr><tr> <td>27</td> <td>729</td> <td>kNocK</td> <td>Key, NaP</td></tr><tr> <td>28</td> <td>784</td> <td>kNiFe</td> <td>CoVeR</td></tr><tr> <td>29</td> <td>841</td> <td>kNoB</td> <td>FoRT</td></tr><tr> <td>31</td> <td>961</td> <td>MaiD</td> <td>PuSHeD</td></tr><tr> <td>32</td> <td>1,024</td> <td>MooN</td> <td>DoSe NeaR</td></tr><tr> <td>33</td> <td>1,089</td> <td>MuM</td> <td>ToSS FiB</td></tr><tr> <td>34</td> <td>1,156</td> <td>MaRRy</td> <td>TighT LeaSH</td></tr><tr> <td>36</td> <td>1,296</td> <td>MaTCH</td> <td>DowN PuSH</td></tr><tr> <td>37</td> <td>1,369</td> <td>MoCHa</td> <td>DaMn, CHeaP</td></tr><tr> <td>38</td> <td>1,444</td> <td>huMVee</td> <td>TiRe RoaR</td></tr><tr> <td>39</td> <td>1,521</td> <td>MoP</td> <td>TaiL kNoT</td></tr><tr> <td>41</td> <td>1,681</td> <td>RaT</td> <td>TouCH, FiT!</td></tr><tr> <td>42</td> <td>1,764</td> <td>RuN</td> <td>TaKe SHaRe</td></tr><tr> <td>43</td> <td>1,849</td> <td>RaM</td> <td>TuFF RoPe</td></tr><tr> <td>44</td> <td>1,936</td> <td>RoaR</td> <td>TiP MatCH</td></tr><tr> <td>46</td> <td>2,116</td> <td>ReaCH</td> <td>NoT TouCH</td></tr><tr> <td>47</td> <td>2,209</td> <td>RoCK</td> <td>NoN SouP</td></tr><tr> <td>48</td> <td>2,304</td> <td>ReeF</td> <td>NaM, SiR!</td></tr><tr> <td>49</td> <td>2,401</td> <td>RiB</td> <td>uNRaiSeD</td></tr><tr> <td>61</td> <td>3,721</td> <td>SHaDow</td> <td>MaKe NighT</td></tr><tr> <td>62</td> <td>3,844</td> <td>CHaiN</td> <td>MoVe ReaR</td></tr><tr> <td>63</td> <td>3,969</td> <td>CHuM</td> <td>MoP SHiP</td></tr><tr> <td>64</td> <td>4,096</td> <td>CHaiR</td> <td>RiSe, PuSH</td></tr><tr> <td>66</td> <td>4,356</td> <td>CHeeCH</td> <td>RuM LuSH</td></tr><tr> <td>67</td> <td>4,489</td> <td>CHeCK</td> <td>RaRe FiB</td></tr><tr> <td>68</td> <td>4,624</td> <td>CHeF</td> <td>ReaCH NeaR</td></tr><tr> <td>69</td> <td>4,761</td> <td>CHiP</td> <td>RocK SHeeT</td></tr><tr> <td>71</td> <td>5,041</td> <td>KiT</td> <td>LooSe, RighT?</td></tr><tr> <td>72</td> <td>5,184</td> <td>CaN</td> <td>LeaD FeaR!</td></tr><tr> <td>73</td> <td>5,329</td> <td>GuM</td> <td>LiMe NuB</td></tr><tr> <td>74</td> <td>5,476</td> <td>CaR</td> <td>LuRe CaSH</td></tr><tr> <td>76</td> <td>5,776</td> <td>CoaCH</td> <td>LuCK, CoaCH</td></tr><tr> <td>77</td> <td>5,929</td> <td>CoKe</td> <td>LeaP, NaP</td></tr><tr> <td>78</td> <td>6,084</td> <td>CaVe</td> <td>CHooSe FiRe</td></tr><tr> <td>79</td> <td>6,241</td> <td>CaP</td> <td>SHiN, Right?</td></tr><tr> <td>81</td> <td>6,561</td> <td>FaT</td> <td>JeLLo JeT</td></tr><tr> <td>82</td> <td>6,724</td> <td>FiN</td> <td>CHiC NoiR</td></tr><tr> <td>83</td> <td>6,889</td> <td>FoaM</td> <td>CheF FiB</td></tr><tr> <td>84</td> <td>7,056</td> <td>FouR</td> <td>CaSe LatCH</td></tr><tr> <td>86</td> <td>7,396</td> <td>FiSH</td> <td>CoMb PuSH</td></tr><tr> <td>87</td> <td>7,569</td> <td>FaKe</td> <td>CoaL CHiP</td></tr><tr> <td>88</td> <td>7,744</td> <td>FiFe</td> <td>KicK ReaR</td></tr><tr> <td>89</td> <td>7,921</td> <td>FiB</td> <td>CaP NoD</td></tr><tr> <td>91</td> <td>8,281</td> <td>PaT</td> <td>FuN FighT</td></tr><tr> <td>92</td> <td>8,464</td> <td>PaN</td> <td>VeRy CHaR'd</td></tr><tr> <td>93</td> <td>8,649</td> <td>PaM</td> <td>FiSH RuB</td></tr><tr> <td>94</td> <td>8,836</td> <td>PouR</td> <td>ViVa MuCHo!</td></tr><tr> <td>96</td> <td>9,216</td> <td>PiTCH</td> <td>BaNNeD SHow</td></tr><tr> <td>97</td> <td>9,409</td> <td>PuCK</td> <td>PooR SOB</td></tr><tr> <td>98</td> <td>9,604</td> <td>PuFF</td> <td>PuSHeS aiR</td></tr><tr> <td>99</td> <td>9,801</td> <td>PaPa</td> <td>PuFFS iT</td></tr></tbody> </table><h2>Memorizing the 50s</h2>Like multiples of 10 and 5, the squares of numbers in the 50s have their own trick that is easy to remember.<br /><br /><table class="flexme"><thead><tr> <th width="252">Number</th> <th width="252">Square of Number</th></tr></thead> <tbody><tr> <td>51</td> <td>2,601</td></tr><tr> <td>52</td> <td>2,704</td></tr><tr> <td>53</td> <td>2,809</td></tr><tr> <td>54</td> <td>2,916</td></tr><tr> <td>56</td> <td>3,136</td></tr><tr> <td>57</td> <td>3,249</td></tr><tr> <td>58</td> <td>3,364</td></tr><tr> <td>59</td> <td>3,481</td></tr></tbody> </table><br />When given a number in the 50s, simply take the ones digit and add it to 25. Next, take the square of the digit in the ones place, and tack that on to the right of the previous answer.<br /><br />For an example, let's use 53. The ones digit is a 3, so we add 25 to get 28. 3 squared is 9, so we add 09 to the end of the other digit to get 2,809.<br /><br />57? 7 plus 25 is 32. 7 squared is 49. Therefore, 57 squared is 3,249. Once the pattern clicks, you'll find that these are quick and easy.<br /><br />To practice squaring numbers, <a href="http://gmmentalgym.blogspot.com/2011/01/squaring-2-digit-numbers-quiz.html">click here</a>. To learn an approach using mathematics for squaring the numbers from 1 to 125, <a href="#sqmath" class="jumpup">click here</a>.</span><br /></div></div>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com9tag:blogger.com,1999:blog-2800835365312821409.post-68231323764914127462010-11-22T20:56:00.000-08:002012-05-01T16:26:44.605-07:00Simon<style type='text/css'>#simontable { display:none; } </style><script type='text/javascript'>//<![CDATA[ $(window).load(function() { whr = location.href; if ((whr.indexOf("2010/11/simon.html")) != -1) { $('#simontable').css('display','inline'); }; }); if(document.images){yellow0=new Image();yellow0.src="http://lh3.ggpht.com/_zQQCfNroX3w/TOtFpD__KKI/AAAAAAAAAfg/WSNJ5bjvWDY/s0/yellow.png";yellow1=new Image();yellow1.src="http://lh3.ggpht.com/_zQQCfNroX3w/TOtFob9uIxI/AAAAAAAAAfc/UxsYRJ8KMtM/s0/yellow_d.png";green0=new Image();green0.src="http://lh6.ggpht.com/_zQQCfNroX3w/TOtFXWatofI/AAAAAAAAAfQ/fdXS0X40Dow/s0/green.png";green1=new Image();green1.src="http://lh4.ggpht.com/_zQQCfNroX3w/TOtFW5RZ-1I/AAAAAAAAAfM/Cc0icLtZwqc/s0/green_d.png";blue0=new Image();blue0.src="http://lh4.ggpht.com/_zQQCfNroX3w/TOtFWbQf50I/AAAAAAAAAfI/nIn1vPZOibI/s0/blue.png";blue1=new Image();blue1.src="http://lh6.ggpht.com/_zQQCfNroX3w/TOtFWcC9e_I/AAAAAAAAAfE/WkyDIXpbANI/s0/blue_d.png";red0=new Image();red0.src="http://lh4.ggpht.com/_zQQCfNroX3w/TOtFoCXcvtI/AAAAAAAAAfY/jtsWe8Lii1E/s0/red.png";red1=new Image();red1.src="http://lh3.ggpht.com/_zQQCfNroX3w/TOtFYTLqMFI/AAAAAAAAAfU/YisXqmpNEfg/s0/red_d.png"}function flash_quarter(n){if(n==1){colour="yellow"}if(n==2){colour="green"}if(n==3){colour="blue"}if(n==4){colour="red"}document.images[colour].src=eval(colour+"1.src");setTimeout('document.images[colour].src = eval(colour + "0.src")',80)}rnd.today=new Date();rnd.seed=rnd.today.getTime();function rnd(){rnd.seed=(rnd.seed*9301+49297)%233280;return rnd.seed/(233280)}function rand(){return Math.ceil(rnd()*4)}var count;var round_number;var difficulty;var rounds=new Array;var interval=500;var on;function set_up(){count=0;round_number=0;on=0;var index=document.diff.level.selectedIndex;difficulty=document.diff.level.options[index].value;for(var i=0;i<difficulty;i++){rounds[i]=rand()}}function start_round(){document.text.area.value="";count=0;on=1;for(var i=0;i<=round_number;i++){setTimeout("flash_quarter("+rounds[i]+")",i*interval)}}function user_play(button){if(on){flash_quarter(button);if(rounds[count]!=button){document.text.area.value="Sorry, you lose.";set_up()}else{if(count==round_number){round_number++;if(round_number==difficulty){document.text.area.value="Wahey, you win!";set_up()}else{setTimeout("start_round()",1000)}}}count++}else{document.text.area.value="Click START to play";setTimeout("document.text.area.value=''",400)}}; //]]></script><span style="font-weight:bold;">Object:</span> Repeat the same sequence of 5, 10, or 15 colors randomly generated by the computer.<br /><br /><span id="fullpost">When you click the <span style="font-style:italic;">Start Game</span> button, the computer will light up a single colored section of the board. Touch or click on the same color, and then the computer will give you a sequence of two colors, starting with the same color.<br /><br />Each time you are able to repeat the sequence given by the computer, it will repeat the previous sequence and add another color to it. You must then touch or click on that new sequence, as well.<br /><br />The game ends either when you win by repeating a full sequence of 5, 10, or 15 colors (depending on the chosen level), or lose by not entering the sequence correctly.</span><h3><span id="fullpost">Further Controls:</span></h3><span id="fullpost"><span style="font-weight:bold;">Start Game:</span> This button begins a new game at the chosen level. The first color will flash as soon as you press this button, so make sure you're looking at the board when you click it!<br /><br /><span style="font-weight:bold;">Easy/Medium/Hard Selector:</span> This selector lets you choose the difficulty. In the <span style="font-style:italic;">Easy</span> level, you work up to a sequence of up to 5 colors. In the <span style="font-style:italic;">Medium</span> level, you work up to a 10-color sequence, and in the <span style="font-style:italic;">Hard</span> level, you're challenged to complete up to a 15-color sequence.<br /><br /></span><div id="simontable"><table border="0" cellspacing="0" cellpadding="0" style="margin-left:100px;margin-right:100px;border-collapse:collapse;"><tr><td COLSPAN="2" ALIGN="right" VALIGN="bottom"><a onclick="user_play(1)" style="display:block;height:102px;"><img SRC="http://lh3.ggpht.com/_zQQCfNroX3w/TOtFpD__KKI/AAAAAAAAAfg/WSNJ5bjvWDY/s0/yellow.png" WIDTH="102" HEIGHT="102" BORDER="0" ALT="Yellow" NAME="yellow" /></A></TD><td COLSPAN="2" ALIGN="left" VALIGN="bottom"><a onclick="user_play(2)" style="display:block;height:102px;"><img SRC="http://lh6.ggpht.com/_zQQCfNroX3w/TOtFXWatofI/AAAAAAAAAfQ/fdXS0X40Dow/s0/green.png" WIDTH="102" HEIGHT="102" BORDER="0" ALT="Green" NAME="green" /></A></TD></TR><tr><td COLSPAN="2" ALIGN="right" VALIGN="top"><a onclick="user_play(4)" style="display:block;height:102px;"><img SRC="http://lh4.ggpht.com/_zQQCfNroX3w/TOtFoCXcvtI/AAAAAAAAAfY/jtsWe8Lii1E/s0/red.png" WIDTH="102" HEIGHT="102" BORDER="0" ALT="Red" NAME="red" /></A></TD><td COLSPAN="2" ALIGN="left" VALIGN="top"><a onclick="user_play(3)" style="display:block;height:102px;"><img SRC="http://lh4.ggpht.com/_zQQCfNroX3w/TOtFWbQf50I/AAAAAAAAAfI/nIn1vPZOibI/s0/blue.png" WIDTH="102" HEIGHT="102" BORDER="0" ALT="Blue" NAME="blue" /></A></TD> </TR><tr><td COLSPAN="4"> </TD></TR><tr><td ALIGN="right"><form><input TYPE="button" VALUE="Start Game" onClick="set_up(); start_round();"></FORM></TD><td ALIGN="center" COLSPAN="2"><form NAME="text"><input TYPE="text" NAME="area" SIZE="20"></FORM></TD><td ALIGN="left"><form NAME="diff"><select NAME="level" SIZE="1"><option VALUE="5">Easy<option VALUE="10">Medium<option VALUE="15">Hard<br /></SELECT></FORM></TD></TR><tr><td COLSPAN="4" ALIGN="center"> <br /></TD></TR></TABLE></div><span id="fullpost"><h3>Solutions:</h3><a href="http://headinside.blogspot.com/2006/01/remember-simon-you-will.html">How To Solve Simon</a><br /><h3>More Information:</h3><a href="http://www.irt.org/articles/js053/index.htm">Keith Drakard's “Simple Simon” page</a><br /><a href="http://en.wikipedia.org/wiki/Simon_(game)">Wikipedia: Simon (game)</a><br /></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com1tag:blogger.com,1999:blog-2800835365312821409.post-50464755632645445842010-11-22T14:57:00.000-08:002012-05-01T16:26:44.600-07:00Planarity<style type='text/css'>#PlanarityArea { border:solid 1px #000000; } </style><script type='text/javascript'>//<![CDATA[ $(window).load(function() { whr = location.href; if ((whr.indexOf("2010/11/planarity.html")) != -1) { JSPlanarity.init('PlanarityArea'); }; }); /*! * Raphael 1.5.0 - JavaScript Vector Library * * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com) * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. */ (function(){function aG(){if(aG.is(arguments[0],a4)){var b=arguments[0],d=D[bz](aG,b.splice(0,3+aG.is(b[0],aD))),R=d.set();for(var E=0,S=b[r];E<S;E++){var e=b[E]||{};bm[af](e.type)&&R[j](d[e.type]().attr(e))}return R}return D[bz](aG,arguments)}aG.version="1.5.0";var a=/[, ]+/,bm={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},bk=/\{(\d+)\}/g,bC="prototype",af="hasOwnProperty",Z=document,aN=window,q={was:Object[bC][af].call(aN,"Raphael"),is:aN.Raphael},bw=function(){this.customAttributes={}},aW,bh="appendChild",bz="apply",bt="concat",V="createTouch" in Z,aM="",aF=" ",bA=String,H="split",P="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[H](aF),bn={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},aT="join",r="length",bE=bA[bC].toLowerCase,an=Math,l=an.max,bf=an.min,bi=an.pow,aD="number",ae="string",a4="array",aX="toString",a1="fill",aQ=Object[bC][aX],bq={},j="push",bx=/^(?=[\da-f]$)/,h=/^url\(['"]?([^\)]+?)['"]?\)$/i,F=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%(?:\s*,\s*[\d\.]+%)?)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsb\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0)?\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hsl\(\s*([\d\.]+(?:deg|\xb0|%)\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i,ao=/^(NaN|-?Infinity)$/,c=/^cubic-bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,ac=an.round,C="setAttribute",ai=parseFloat,Q=parseInt,a2=" progid:DXImageTransform.Microsoft",bl=bA[bC].toUpperCase,p={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},al={along:"along",blur:aD,"clip-rect":"csv",cx:aD,cy:aD,fill:"colour","fill-opacity":aD,"font-size":aD,height:aD,opacity:aD,path:"path",r:aD,rotation:"csv",rx:aD,ry:aD,scale:"csv",stroke:"colour","stroke-opacity":aD,"stroke-width":aD,translation:"csv",width:aD,x:aD,y:aD},bp="replace",a7=/,?([achlmqrstvxz]),?/gi,ba=/\s*,\s*/,m={hs:1,rg:1},bc=/^(from|to|\d+%)$/,aO=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,aE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,bj=function(e,d){return e.key-d.key};aG.type=(aN.SVGAngle||Z.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML");if(aG.type=="VML"){var av=Z.createElement("div"),az;av.innerHTML='<v:shape adj="1"/>';az=av.firstChild;az.style.behavior="url(#default#VML)";if(!(az&&typeof az.adj=="object")){return(aG.type=null)}av=null}aG.svg=!(aG.vml=aG.type=="VML");bw[bC]=aG[bC];aW=bw[bC];aG._id=0;aG._oid=0;aG.fn={};aG.is=function(d,b){b=bE.call(b);if(b=="finite"){return !ao.test(+d)}return(b=="null"&&d===null)||(b==typeof d)||(b=="object"&&d===Object(d))||(b=="array"&&Array.isArray&&Array.isArray(d))||aQ.call(d).slice(8,-1).toLowerCase()==b};aG.angle=function(E,S,e,R,d,i){if(d==null){var b=E-e,bF=S-R;if(!b&&!bF){return 0}return((b<0)*180+an.atan(-bF/-b)*180/an.PI+360)%360}else{return aG.angle(E,S,d,i)-aG.angle(e,R,d,i)}};aG.snapTo=function(d,E,b){b=b||10;d=[][bt](d);var e=d.length;while(e--){if(an.abs(d[e]-E)<=b){return d[e]}}return E};aG.setWindow=function(b){aN=b;Z=aN.document};var a6=function(E){if(aG.vml){var b=/^\s+|\s+$/g;var S;try{var bF=new ActiveXObject("htmlfile");bF.write("<body>");bF.close();S=bF.body}catch(bG){S=createPopup().document.body}var d=S.createTextRange();a6=ay(function(i){try{S.style.color=bA(i)[bp](b,aM);var bH=d.queryCommandValue("ForeColor");bH=((bH&255)<<16)|(bH&65280)|((bH&16711680)>>>16);return"#"+("000000"+bH[aX](16)).slice(-6)}catch(bI){return"none"}})}else{var R=Z.createElement("i");R.title="Rapha\xebl Colour Picker";R.style.display="none";Z.body[bh](R);a6=ay(function(e){R.style.color=e;return Z.defaultView.getComputedStyle(R,aM).getPropertyValue("color")})}return a6(E)},aA=function(){return"hsb("+[this.h,this.s,this.b]+")"},L=function(){return"hsl("+[this.h,this.s,this.l]+")"},A=function(){return this.hex};aG.hsb2rgb=function(i,e,d){if(aG.is(i,"object")&&"h" in i&&"s" in i&&"b" in i){d=i.b;e=i.s;i=i.h}return aG.hsl2rgb(i,e,d/2)};aG.hsl2rgb=function(S,bM,e){if(aG.is(S,"object")&&"h" in S&&"s" in S&&"l" in S){e=S.l;bM=S.s;S=S.h}if(S>1||bM>1||e>1){S/=360;bM/=100;e/=100}var bJ={},bG=["r","g","b"],bF,bI,R,d,bH,bK;if(!bM){bJ={r:e,g:e,b:e}}else{if(e<0.5){bF=e*(1+bM)}else{bF=e+bM-e*bM}bI=2*e-bF;for(var E=0,bL=bG.length;E<bL;E++){R=S+1/3*-(E-1);R<0&&R++;R>1&&R--;if(R*6<1){bJ[bG[E]]=bI+(bF-bI)*6*R}else{if(R*2<1){bJ[bG[E]]=bF}else{if(R*3<2){bJ[bG[E]]=bI+(bF-bI)*(2/3-R)*6}else{bJ[bG[E]]=bI}}}}}bJ.r*=255;bJ.g*=255;bJ.b*=255;d=(~~bJ.r)[aX](16);bH=(~~bJ.g)[aX](16);bK=(~~bJ.b)[aX](16);d=d[bp](bx,"0");bH=bH[bp](bx,"0");bK=bK[bp](bx,"0");bJ.hex="#"+d+bH+bK;bJ.toString=A;return bJ};aG.rgb2hsb=function(b,d,bF){if(d==null&&aG.is(b,"object")&&"r" in b&&"g" in b&&"b" in b){bF=b.b;d=b.g;b=b.r}if(d==null&&aG.is(b,ae)){var bH=aG.getRGB(b);b=bH.r;d=bH.g;bF=bH.b}if(b>1||d>1||bF>1){b/=255;d/=255;bF/=255}var S=l(b,d,bF),e=bf(b,d,bF),E,i,R=S;if(e==S){return{h:0,s:0,b:S,toString:aA}}else{var bG=(S-e);i=bG/S;if(b==S){E=(d-bF)/bG}else{if(d==S){E=2+((bF-b)/bG)}else{E=4+((b-d)/bG)}}E/=6;E<0&&E++;E>1&&E--}return{h:E,s:i,b:R,toString:aA}};aG.rgb2hsl=function(d,e,S){if(e==null&&aG.is(d,"object")&&"r" in d&&"g" in d&&"b" in d){S=d.b;e=d.g;d=d.r}if(e==null&&aG.is(d,ae)){var bI=aG.getRGB(d);d=bI.r;e=bI.g;S=bI.b}if(d>1||e>1||S>1){d/=255;e/=255;S/=255}var R=l(d,e,S),i=bf(d,e,S),E,bH,b=(R+i)/2,bG;if(i==R){bG={h:0,s:0,l:b}}else{var bF=R-i;bH=b<0.5?bF/(R+i):bF/(2-R-i);if(d==R){E=(e-S)/bF}else{if(e==R){E=2+(S-d)/bF}else{E=4+(d-e)/bF}}E/=6;E<0&&E++;E>1&&E--;bG={h:E,s:bH,l:b}}bG.toString=L;return bG};aG._path2string=function(){return this.join(",")[bp](a7,"$1")};function ay(i,d,b){function e(){var E=Array[bC].slice.call(arguments,0),S=E[aT]("\u25ba"),R=e.cache=e.cache||{},bF=e.count=e.count||[];if(R[af](S)){return b?b(R[S]):R[S]}bF[r]>=1000&&delete R[bF.shift()];bF[j](S);R[S]=i[bz](d,E);return b?b(R[S]):R[S]}return e}aG.getRGB=ay(function(e){if(!e||!!((e=bA(e)).indexOf("-")+1)){return{r:-1,g:-1,b:-1,hex:"none",error:1}}if(e=="none"){return{r:-1,g:-1,b:-1,hex:"none"}}!(m[af](e.substring(0,2))||e.charAt()=="#")&&(e=a6(e));var bF,i,E,bI,S,bJ,bG=e.match(F);if(bG){if(bG[2]){bI=Q(bG[2].substring(5),16);E=Q(bG[2].substring(3,5),16);i=Q(bG[2].substring(1,3),16)}if(bG[3]){bI=Q((bJ=bG[3].charAt(3))+bJ,16);E=Q((bJ=bG[3].charAt(2))+bJ,16);i=Q((bJ=bG[3].charAt(1))+bJ,16)}if(bG[4]){bG=bG[4][H](ba);i=ai(bG[0]);E=ai(bG[1]);bI=ai(bG[2]);S=ai(bG[3])}if(bG[5]){bG=bG[5][H](ba);i=ai(bG[0])*2.55;E=ai(bG[1])*2.55;bI=ai(bG[2])*2.55;S=ai(bG[3])}if(bG[6]){bG=bG[6][H](ba);i=ai(bG[0]);E=ai(bG[1]);bI=ai(bG[2]);(bG[0].slice(-3)=="deg"||bG[0].slice(-1)=="\xb0")&&(i/=360);return aG.hsb2rgb(i,E,bI)}if(bG[7]){bG=bG[7][H](ba);i=ai(bG[0])*2.55;E=ai(bG[1])*2.55;bI=ai(bG[2])*2.55;(bG[0].slice(-3)=="deg"||bG[0].slice(-1)=="\xb0")&&(i/=360*2.55);return aG.hsb2rgb(i,E,bI)}if(bG[8]){bG=bG[8][H](ba);i=ai(bG[0]);E=ai(bG[1]);bI=ai(bG[2]);(bG[0].slice(-3)=="deg"||bG[0].slice(-1)=="\xb0")&&(i/=360);return aG.hsl2rgb(i,E,bI)}if(bG[9]){bG=bG[9][H](ba);i=ai(bG[0])*2.55;E=ai(bG[1])*2.55;bI=ai(bG[2])*2.55;(bG[0].slice(-3)=="deg"||bG[0].slice(-1)=="\xb0")&&(i/=360*2.55);return aG.hsl2rgb(i,E,bI)}bG={r:i,g:E,b:bI};var d=(~~i)[aX](16),R=(~~E)[aX](16),bH=(~~bI)[aX](16);d=d[bp](bx,"0");R=R[bp](bx,"0");bH=bH[bp](bx,"0");bG.hex="#"+d+R+bH;isFinite(ai(S))&&(bG.o=S);return bG}return{r:-1,g:-1,b:-1,hex:"none",error:1}},aG);aG.getColor=function(d){var e=this.getColor.start=this.getColor.start||{h:0,s:1,b:d||0.75},b=this.hsb2rgb(e.h,e.s,e.b);e.h+=0.075;if(e.h>1){e.h=0;e.s-=0.2;e.s<=0&&(this.getColor.start={h:0,s:1,b:e.b})}return b.hex};aG.getColor.reset=function(){delete this.start};aG.parsePathString=ay(function(b){if(!b){return null}var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},d=[];if(aG.is(b,a4)&&aG.is(b[0],a4)){d=aP(b)}if(!d[r]){bA(b)[bp](aO,function(E,i,bF){var S=[],R=bE.call(i);bF[bp](aE,function(bH,bG){bG&&S[j](+bG)});if(R=="m"&&S[r]>2){d[j]([i][bt](S.splice(0,2)));R="l";i=i=="m"?"l":"L"}while(S[r]>=e[R]){d[j]([i][bt](S.splice(0,e[R])));if(!e[R]){break}}})}d[aX]=aG._path2string;return d});aG.findDotsAtSegment=function(d,b,bS,bQ,S,E,bG,bF,bM){var bK=1-bM,bJ=bi(bK,3)*d+bi(bK,2)*3*bM*bS+bK*3*bM*bM*S+bi(bM,3)*bG,bH=bi(bK,3)*b+bi(bK,2)*3*bM*bQ+bK*3*bM*bM*E+bi(bM,3)*bF,bO=d+2*bM*(bS-d)+bM*bM*(S-2*bS+d),bN=b+2*bM*(bQ-b)+bM*bM*(E-2*bQ+b),bR=bS+2*bM*(S-bS)+bM*bM*(bG-2*S+bS),bP=bQ+2*bM*(E-bQ)+bM*bM*(bF-2*E+bQ),bL=(1-bM)*d+bM*bS,bI=(1-bM)*b+bM*bQ,i=(1-bM)*S+bM*bG,e=(1-bM)*E+bM*bF,R=(90-an.atan((bO-bR)/(bN-bP))*180/an.PI);(bO>bR||bN<bP)&&(R+=180);return{x:bJ,y:bH,m:{x:bO,y:bN},n:{x:bR,y:bP},start:{x:bL,y:bI},end:{x:i,y:e},alpha:R}};var ah=ay(function(bJ){if(!bJ){return{x:0,y:0,width:0,height:0}}bJ=U(bJ);var bG=0,bF=0,E=[],d=[],e;for(var R=0,bI=bJ[r];R<bI;R++){e=bJ[R];if(e[0]=="M"){bG=e[1];bF=e[2];E[j](bG);d[j](bF)}else{var S=a3(bG,bF,e[1],e[2],e[3],e[4],e[5],e[6]);E=E[bt](S.min.x,S.max.x);d=d[bt](S.min.y,S.max.y);bG=e[5];bF=e[6]}}var b=bf[bz](0,E),bH=bf[bz](0,d);return{x:b,y:bH,width:l[bz](0,E)-b,height:l[bz](0,d)-bH}}),aP=function(S){var e=[];if(!aG.is(S,a4)||!aG.is(S&&S[0],a4)){S=aG.parsePathString(S)}for(var d=0,E=S[r];d<E;d++){e[d]=[];for(var b=0,R=S[d][r];b<R;b++){e[d][b]=S[d][b]}}e[aX]=aG._path2string;return e},ar=ay(function(E){if(!aG.is(E,a4)||!aG.is(E&&E[0],a4)){E=aG.parsePathString(E)}var bI=[],bK=0,bJ=0,bN=0,bM=0,e=0;if(E[0][0]=="M"){bK=E[0][1];bJ=E[0][2];bN=bK;bM=bJ;e++;bI[j](["M",bK,bJ])}for(var bF=e,bO=E[r];bF<bO;bF++){var b=bI[bF]=[],bL=E[bF];if(bL[0]!=bE.call(bL[0])){b[0]=bE.call(bL[0]);switch(b[0]){case"a":b[1]=bL[1];b[2]=bL[2];b[3]=bL[3];b[4]=bL[4];b[5]=bL[5];b[6]=+(bL[6]-bK).toFixed(3);b[7]=+(bL[7]-bJ).toFixed(3);break;case"v":b[1]=+(bL[1]-bJ).toFixed(3);break;case"m":bN=bL[1];bM=bL[2];default:for(var S=1,bG=bL[r];S<bG;S++){b[S]=+(bL[S]-((S%2)?bK:bJ)).toFixed(3)}}}else{b=bI[bF]=[];if(bL[0]=="m"){bN=bL[1]+bK;bM=bL[2]+bJ}for(var R=0,d=bL[r];R<d;R++){bI[bF][R]=bL[R]}}var bH=bI[bF][r];switch(bI[bF][0]){case"z":bK=bN;bJ=bM;break;case"h":bK+=+bI[bF][bH-1];break;case"v":bJ+=+bI[bF][bH-1];break;default:bK+=+bI[bF][bH-2];bJ+=+bI[bF][bH-1]}}bI[aX]=aG._path2string;return bI},0,aP),x=ay(function(E){if(!aG.is(E,a4)||!aG.is(E&&E[0],a4)){E=aG.parsePathString(E)}var bH=[],bJ=0,bI=0,bM=0,bL=0,e=0;if(E[0][0]=="M"){bJ=+E[0][1];bI=+E[0][2];bM=bJ;bL=bI;e++;bH[0]=["M",bJ,bI]}for(var bF=e,bN=E[r];bF<bN;bF++){var b=bH[bF]=[],bK=E[bF];if(bK[0]!=bl.call(bK[0])){b[0]=bl.call(bK[0]);switch(b[0]){case"A":b[1]=bK[1];b[2]=bK[2];b[3]=bK[3];b[4]=bK[4];b[5]=bK[5];b[6]=+(bK[6]+bJ);b[7]=+(bK[7]+bI);break;case"V":b[1]=+bK[1]+bI;break;case"H":b[1]=+bK[1]+bJ;break;case"M":bM=+bK[1]+bJ;bL=+bK[2]+bI;default:for(var S=1,bG=bK[r];S<bG;S++){b[S]=+bK[S]+((S%2)?bJ:bI)}}}else{for(var R=0,d=bK[r];R<d;R++){bH[bF][R]=bK[R]}}switch(b[0]){case"Z":bJ=bM;bI=bL;break;case"H":bJ=b[1];break;case"V":bI=b[1];break;case"M":bM=bH[bF][bH[bF][r]-2];bL=bH[bF][bH[bF][r]-1];default:bJ=bH[bF][bH[bF][r]-2];bI=bH[bF][bH[bF][r]-1]}}bH[aX]=aG._path2string;return bH},null,aP),bB=function(d,i,b,e){return[d,i,b,e,b,e]},bg=function(d,i,S,E,b,e){var R=1/3,bF=2/3;return[R*d+bF*S,R*i+bF*E,R*b+bF*S,R*e+bF*E,b,e]},Y=function(bN,ci,bW,bU,bO,bI,R,bM,ch,bP){var E=an.PI,bT=E*120/180,b=E/180*(+bO||0),b0=[],bX,ce=ay(function(cj,cm,i){var cl=cj*an.cos(i)-cm*an.sin(i),ck=cj*an.sin(i)+cm*an.cos(i);return{x:cl,y:ck}});if(!bP){bX=ce(bN,ci,-b);bN=bX.x;ci=bX.y;bX=ce(bM,ch,-b);bM=bX.x;ch=bX.y;var d=an.cos(E/180*bO),bK=an.sin(E/180*bO),b2=(bN-bM)/2,b1=(ci-ch)/2;var cc=(b2*b2)/(bW*bW)+(b1*b1)/(bU*bU);if(cc>1){cc=an.sqrt(cc);bW=cc*bW;bU=cc*bU}var e=bW*bW,b5=bU*bU,b7=(bI==R?-1:1)*an.sqrt(an.abs((e*b5-e*b1*b1-b5*b2*b2)/(e*b1*b1+b5*b2*b2))),bR=b7*bW*b1/bU+(bN+bM)/2,bQ=b7*-bU*b2/bW+(ci+ch)/2,bH=an.asin(((ci-bQ)/bU).toFixed(9)),bG=an.asin(((ch-bQ)/bU).toFixed(9));bH=bN<bR?E-bH:bH;bG=bM<bR?E-bG:bG;bH<0&&(bH=E*2+bH);bG<0&&(bG=E*2+bG);if(R&&bH>bG){bH=bH-E*2}if(!R&&bG>bH){bG=bG-E*2}}else{bH=bP[0];bG=bP[1];bR=bP[2];bQ=bP[3]}var bL=bG-bH;if(an.abs(bL)>bT){var bS=bG,bV=bM,bJ=ch;bG=bH+bT*(R&&bG>bH?1:-1);bM=bR+bW*an.cos(bG);ch=bQ+bU*an.sin(bG);b0=Y(bM,ch,bW,bU,bO,0,R,bV,bJ,[bG,bS,bR,bQ])}bL=bG-bH;var bF=an.cos(bH),cg=an.sin(bH),S=an.cos(bG),cf=an.sin(bG),b3=an.tan(bL/4),b6=4/3*bW*b3,b4=4/3*bU*b3,cd=[bN,ci],cb=[bN+b6*cg,ci-b4*bF],ca=[bM+b6*cf,ch-b4*S],b8=[bM,ch];cb[0]=2*cd[0]-cb[0];cb[1]=2*cd[1]-cb[1];if(bP){return[cb,ca,b8][bt](b0)}else{b0=[cb,ca,b8][bt](b0)[aT]()[H](",");var bY=[];for(var b9=0,bZ=b0[r];b9<bZ;b9++){bY[b9]=b9%2?ce(b0[b9-1],b0[b9],b).y:ce(b0[b9],b0[b9+1],b).x}return bY}},ab=function(d,b,i,e,bG,bF,S,R,bH){var E=1-bH;return{x:bi(E,3)*d+bi(E,2)*3*bH*i+E*3*bH*bH*bG+bi(bH,3)*S,y:bi(E,3)*b+bi(E,2)*3*bH*e+E*3*bH*bH*bF+bi(bH,3)*R}},a3=ay(function(i,d,R,E,bO,bN,bK,bH){var bM=(bO-2*R+i)-(bK-2*bO+R),bJ=2*(R-i)-2*(bO-R),bG=i-R,bF=(-bJ+an.sqrt(bJ*bJ-4*bM*bG))/2/bM,S=(-bJ-an.sqrt(bJ*bJ-4*bM*bG))/2/bM,bI=[d,bH],bL=[i,bK],e;an.abs(bF)>"1e12"&&(bF=0.5);an.abs(S)>"1e12"&&(S=0.5);if(bF>0&&bF<1){e=ab(i,d,R,E,bO,bN,bK,bH,bF);bL[j](e.x);bI[j](e.y)}if(S>0&&S<1){e=ab(i,d,R,E,bO,bN,bK,bH,S);bL[j](e.x);bI[j](e.y)}bM=(bN-2*E+d)-(bH-2*bN+E);bJ=2*(E-d)-2*(bN-E);bG=d-E;bF=(-bJ+an.sqrt(bJ*bJ-4*bM*bG))/2/bM;S=(-bJ-an.sqrt(bJ*bJ-4*bM*bG))/2/bM;an.abs(bF)>"1e12"&&(bF=0.5);an.abs(S)>"1e12"&&(S=0.5);if(bF>0&&bF<1){e=ab(i,d,R,E,bO,bN,bK,bH,bF);bL[j](e.x);bI[j](e.y)}if(S>0&&S<1){e=ab(i,d,R,E,bO,bN,bK,bH,S);bL[j](e.x);bI[j](e.y)}return{min:{x:bf[bz](0,bL),y:bf[bz](0,bI)},max:{x:l[bz](0,bL),y:l[bz](0,bI)}}}),U=ay(function(bN,bI){var E=x(bN),bJ=bI&&x(bI),bK={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},b={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},S=function(bO,bP){var i,bQ;if(!bO){return["C",bP.x,bP.y,bP.x,bP.y,bP.x,bP.y]}!(bO[0] in {T:1,Q:1})&&(bP.qx=bP.qy=null);switch(bO[0]){case"M":bP.X=bO[1];bP.Y=bO[2];break;case"A":bO=["C"][bt](Y[bz](0,[bP.x,bP.y][bt](bO.slice(1))));break;case"S":i=bP.x+(bP.x-(bP.bx||bP.x));bQ=bP.y+(bP.y-(bP.by||bP.y));bO=["C",i,bQ][bt](bO.slice(1));break;case"T":bP.qx=bP.x+(bP.x-(bP.qx||bP.x));bP.qy=bP.y+(bP.y-(bP.qy||bP.y));bO=["C"][bt](bg(bP.x,bP.y,bP.qx,bP.qy,bO[1],bO[2]));break;case"Q":bP.qx=bO[1];bP.qy=bO[2];bO=["C"][bt](bg(bP.x,bP.y,bO[1],bO[2],bO[3],bO[4]));break;case"L":bO=["C"][bt](bB(bP.x,bP.y,bO[1],bO[2]));break;case"H":bO=["C"][bt](bB(bP.x,bP.y,bO[1],bP.y));break;case"V":bO=["C"][bt](bB(bP.x,bP.y,bP.x,bO[1]));break;case"Z":bO=["C"][bt](bB(bP.x,bP.y,bP.X,bP.Y));break}return bO},d=function(bO,bP){if(bO[bP][r]>7){bO[bP].shift();var bQ=bO[bP];while(bQ[r]){bO.splice(bP++,0,["C"][bt](bQ.splice(0,6)))}bO.splice(bP,1);bL=l(E[r],bJ&&bJ[r]||0)}},e=function(bS,bR,bP,bO,bQ){if(bS&&bR&&bS[bQ][0]=="M"&&bR[bQ][0]!="M"){bR.splice(bQ,0,["M",bO.x,bO.y]);bP.bx=0;bP.by=0;bP.x=bS[bQ][1];bP.y=bS[bQ][2];bL=l(E[r],bJ&&bJ[r]||0)}};for(var bG=0,bL=l(E[r],bJ&&bJ[r]||0);bG<bL;bG++){E[bG]=S(E[bG],bK);d(E,bG);bJ&&(bJ[bG]=S(bJ[bG],b));bJ&&d(bJ,bG);e(E,bJ,bK,b,bG);e(bJ,E,b,bK,bG);var bF=E[bG],bM=bJ&&bJ[bG],R=bF[r],bH=bJ&&bM[r];bK.x=bF[R-2];bK.y=bF[R-1];bK.bx=ai(bF[R-4])||bK.x;bK.by=ai(bF[R-3])||bK.y;b.bx=bJ&&(ai(bM[bH-4])||b.x);b.by=bJ&&(ai(bM[bH-3])||b.y);b.x=bJ&&bM[bH-2];b.y=bJ&&bM[bH-1]}return bJ?[E,bJ]:E},null,aP),v=ay(function(bI){var bH=[];for(var S=0,bJ=bI[r];S<bJ;S++){var b={},bG=bI[S].match(/^([^:]*):?([\d\.]*)/);b.color=aG.getRGB(bG[1]);if(b.color.error){return null}b.color=b.color.hex;bG[2]&&(b.offset=bG[2]+"%");bH[j](b)}for(S=1,bJ=bH[r]-1;S<bJ;S++){if(!bH[S].offset){var e=ai(bH[S-1].offset||0),E=0;for(var R=S+1;R<bJ;R++){if(bH[R].offset){E=bH[R].offset;break}}if(!E){E=100;R=bJ}E=ai(E);var bF=(E-e)/(R-S+1);for(;S<R;S++){e+=bF;bH[S].offset=e+"%"}}}return bH}),aH=function(b,E,e,i){var d;if(aG.is(b,ae)||aG.is(b,"object")){d=aG.is(b,ae)?Z.getElementById(b):b;if(d.tagName){if(E==null){return{container:d,width:d.style.pixelWidth||d.offsetWidth,height:d.style.pixelHeight||d.offsetHeight}}else{return{container:d,width:E,height:e}}}}else{return{container:1,x:b,y:E,width:e,height:i}}},bb=function(b,e){var d=this;for(var i in e){if(e[af](i)&&!(i in b)){switch(typeof e[i]){case"function":(function(E){b[i]=b===d?E:function(){return E[bz](d,arguments)}})(e[i]);break;case"object":b[i]=b[i]||{};bb.call(this,b[i],e[i]);break;default:b[i]=e[i];break}}}},aC=function(b,d){b==d.top&&(d.top=b.prev);b==d.bottom&&(d.bottom=b.next);b.next&&(b.next.prev=b.prev);b.prev&&(b.prev.next=b.next)},ak=function(b,d){if(d.top===b){return}aC(b,d);b.next=null;b.prev=d.top;d.top.next=b;d.top=b},o=function(b,d){if(d.bottom===b){return}aC(b,d);b.next=d.bottom;b.prev=null;d.bottom.prev=b;d.bottom=b},I=function(d,b,e){aC(d,e);b==e.top&&(e.top=d);b.next&&(b.next.prev=d);d.next=b.next;d.prev=b;b.next=d},aJ=function(d,b,e){aC(d,e);b==e.bottom&&(e.bottom=d);b.prev&&(b.prev.next=d);d.prev=b.prev;b.prev=d;d.next=b},y=function(b){return function(){throw new Error("Rapha\xebl: you are calling to method \u201c"+b+"\u201d of removed object")}},aL=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;aG.pathToRelative=ar;if(aG.svg){aW.svgns="http://www.w3.org/2000/svg";aW.xlink="http://www.w3.org/1999/xlink";ac=function(b){return +b+(~~b===b)*0.5};var be=function(e,b){if(b){for(var d in b){if(b[af](d)){e[C](d,bA(b[d]))}}}else{e=Z.createElementNS(aW.svgns,e);e.style.webkitTapHighlightColor="rgba(0,0,0,0)";return e}};aG[aX]=function(){return"Your browser supports SVG.\nYou are running Rapha\xebl "+this.version};var w=function(b,i){var d=be("path");i.canvas&&i.canvas[bh](d);var e=new aR(d,i);e.type="path";am(e,{fill:"none",stroke:"#000",path:b});return e};var g=function(E,bM,b){var bJ="linear",bG=0.5,S=0.5,bO=E.style;bM=bA(bM)[bp](aL,function(bQ,i,bR){bJ="radial";if(i&&bR){bG=ai(i);S=ai(bR);var bP=((S>0.5)*2-1);bi(bG-0.5,2)+bi(S-0.5,2)>0.25&&(S=an.sqrt(0.25-bi(bG-0.5,2))*bP+0.5)&&S!=0.5&&(S=S.toFixed(5)-0.00001*bP)}return aM});bM=bM[H](/\s*\-\s*/);if(bJ=="linear"){var bF=bM.shift();bF=-ai(bF);if(isNaN(bF)){return null}var R=[0,0,an.cos(bF*an.PI/180),an.sin(bF*an.PI/180)],bL=1/(l(an.abs(R[2]),an.abs(R[3]))||1);R[2]*=bL;R[3]*=bL;if(R[2]<0){R[0]=-R[2];R[2]=0}if(R[3]<0){R[1]=-R[3];R[3]=0}}var bI=v(bM);if(!bI){return null}var d=E.getAttribute(a1);d=d.match(/^url\(#(.*)\)$/);d&&b.defs.removeChild(Z.getElementById(d[1]));var e=be(bJ+"Gradient");e.id="r"+(aG._id++)[aX](36);be(e,bJ=="radial"?{fx:bG,fy:S}:{x1:R[0],y1:R[1],x2:R[2],y2:R[3]});b.defs[bh](e);for(var bH=0,bN=bI[r];bH<bN;bH++){var bK=be("stop");be(bK,{offset:bI[bH].offset?bI[bH].offset:!bH?"0%":"100%","stop-color":bI[bH].color||"#fff"});e[bh](bK)}be(E,{fill:"url(#"+e.id+")",opacity:1,"fill-opacity":1});bO.fill=aM;bO.opacity=1;bO.fillOpacity=1;return 1};var aa=function(d){var b=d.getBBox();be(d.pattern,{patternTransform:aG.format("translate({0},{1})",b.x,b.y)})};var am=function(bL,bU){var bO={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},bQ=bL.node,bM=bL.attrs,bI=bL.rotate(),S=function(b1,b0){b0=bO[bE.call(b0)];if(b0){var bY=b1.attrs["stroke-width"]||"1",bW={round:bY,square:bY,butt:0}[b1.attrs["stroke-linecap"]||bU["stroke-linecap"]]||0,bZ=[];var bX=b0[r];while(bX--){bZ[bX]=b0[bX]*bY+((bX%2)?1:-1)*bW}be(bQ,{"stroke-dasharray":bZ[aT](",")})}};bU[af]("rotation")&&(bI=bU.rotation);var bH=bA(bI)[H](a);if(!(bH.length-1)){bH=null}else{bH[1]=+bH[1];bH[2]=+bH[2]}ai(bI)&&bL.rotate(0,true);for(var bP in bU){if(bU[af](bP)){if(!p[af](bP)){continue}var bN=bU[bP];bM[bP]=bN;switch(bP){case"blur":bL.blur(bN);break;case"rotation":bL.rotate(bN,true);break;case"href":case"title":case"target":var bS=bQ.parentNode;if(bE.call(bS.tagName)!="a"){var E=be("a");bS.insertBefore(E,bQ);E[bh](bQ);bS=E}if(bP=="target"&&bN=="blank"){bS.setAttributeNS(bL.paper.xlink,"show","new")}else{bS.setAttributeNS(bL.paper.xlink,bP,bN)}break;case"cursor":bQ.style.cursor=bN;break;case"clip-rect":var d=bA(bN)[H](a);if(d[r]==4){bL.clip&&bL.clip.parentNode.parentNode.removeChild(bL.clip.parentNode);var e=be("clipPath"),bR=be("rect");e.id="r"+(aG._id++)[aX](36);be(bR,{x:d[0],y:d[1],width:d[2],height:d[3]});e[bh](bR);bL.paper.defs[bh](e);be(bQ,{"clip-path":"url(#"+e.id+")"});bL.clip=bR}if(!bN){var bT=Z.getElementById(bQ.getAttribute("clip-path")[bp](/(^url\(#|\)$)/g,aM));bT&&bT.parentNode.removeChild(bT);be(bQ,{"clip-path":aM});delete bL.clip}break;case"path":if(bL.type=="path"){be(bQ,{d:bN?bM.path=x(bN):"M0,0"})}break;case"width":bQ[C](bP,bN);if(bM.fx){bP="x";bN=bM.x}else{break}case"x":if(bM.fx){bN=-bM.x-(bM.width||0)}case"rx":if(bP=="rx"&&bL.type=="rect"){break}case"cx":bH&&(bP=="x"||bP=="cx")&&(bH[1]+=bN-bM[bP]);bQ[C](bP,bN);bL.pattern&&aa(bL);break;case"height":bQ[C](bP,bN);if(bM.fy){bP="y";bN=bM.y}else{break}case"y":if(bM.fy){bN=-bM.y-(bM.height||0)}case"ry":if(bP=="ry"&&bL.type=="rect"){break}case"cy":bH&&(bP=="y"||bP=="cy")&&(bH[2]+=bN-bM[bP]);bQ[C](bP,bN);bL.pattern&&aa(bL);break;case"r":if(bL.type=="rect"){be(bQ,{rx:bN,ry:bN})}else{bQ[C](bP,bN)}break;case"src":if(bL.type=="image"){bQ.setAttributeNS(bL.paper.xlink,"href",bN)}break;case"stroke-width":bQ.style.strokeWidth=bN;bQ[C](bP,bN);if(bM["stroke-dasharray"]){S(bL,bM["stroke-dasharray"])}break;case"stroke-dasharray":S(bL,bN);break;case"translation":var bF=bA(bN)[H](a);bF[0]=+bF[0]||0;bF[1]=+bF[1]||0;if(bH){bH[1]+=bF[0];bH[2]+=bF[1]}z.call(bL,bF[0],bF[1]);break;case"scale":bF=bA(bN)[H](a);bL.scale(+bF[0]||1,+bF[1]||+bF[0]||1,isNaN(ai(bF[2]))?null:+bF[2],isNaN(ai(bF[3]))?null:+bF[3]);break;case a1:var R=bA(bN).match(h);if(R){e=be("pattern");var bK=be("image");e.id="r"+(aG._id++)[aX](36);be(e,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});be(bK,{x:0,y:0});bK.setAttributeNS(bL.paper.xlink,"href",R[1]);e[bh](bK);var bV=Z.createElement("img");bV.style.cssText="position:absolute;left:-9999em;top-9999em";bV.onload=function(){be(e,{width:this.offsetWidth,height:this.offsetHeight});be(bK,{width:this.offsetWidth,height:this.offsetHeight});Z.body.removeChild(this);bL.paper.safari()};Z.body[bh](bV);bV.src=R[1];bL.paper.defs[bh](e);bQ.style.fill="url(#"+e.id+")";be(bQ,{fill:"url(#"+e.id+")"});bL.pattern=e;bL.pattern&&aa(bL);break}var i=aG.getRGB(bN);if(!i.error){delete bU.gradient;delete bM.gradient;!aG.is(bM.opacity,"undefined")&&aG.is(bU.opacity,"undefined")&&be(bQ,{opacity:bM.opacity});!aG.is(bM["fill-opacity"],"undefined")&&aG.is(bU["fill-opacity"],"undefined")&&be(bQ,{"fill-opacity":bM["fill-opacity"]})}else{if((({circle:1,ellipse:1})[af](bL.type)||bA(bN).charAt()!="r")&&g(bQ,bN,bL.paper)){bM.gradient=bN;bM.fill="none";break}}i[af]("o")&&be(bQ,{"fill-opacity":i.o>1?i.o/100:i.o});case"stroke":i=aG.getRGB(bN);bQ[C](bP,i.hex);bP=="stroke"&&i[af]("o")&&be(bQ,{"stroke-opacity":i.o>1?i.o/100:i.o});break;case"gradient":(({circle:1,ellipse:1})[af](bL.type)||bA(bN).charAt()!="r")&&g(bQ,bN,bL.paper);break;case"opacity":case"fill-opacity":if(bM.gradient){var b=Z.getElementById(bQ.getAttribute(a1)[bp](/^url\(#|\)$/g,aM));if(b){var bG=b.getElementsByTagName("stop");bG[bG[r]-1][C]("stop-opacity",bN)}break}default:bP=="font-size"&&(bN=Q(bN,10)+"px");var bJ=bP[bp](/(\-.)/g,function(bW){return bl.call(bW.substring(1))});bQ.style[bJ]=bN;bQ[C](bP,bN);break}}}O(bL,bU);if(bH){bL.rotate(bH.join(aF))}else{ai(bI)&&bL.rotate(bI,true)}};var n=1.2,O=function(b,E){if(b.type!="text"||!(E[af]("text")||E[af]("font")||E[af]("font-size")||E[af]("x")||E[af]("y"))){return}var bH=b.attrs,d=b.node,bJ=d.firstChild?Q(Z.defaultView.getComputedStyle(d.firstChild,aM).getPropertyValue("font-size"),10):10;if(E[af]("text")){bH.text=E.text;while(d.firstChild){d.removeChild(d.firstChild)}var e=bA(E.text)[H]("\n");for(var R=0,bI=e[r];R<bI;R++){if(e[R]){var bF=be("tspan");R&&be(bF,{dy:bJ*n,x:bH.x});bF[bh](Z.createTextNode(e[R]));d[bh](bF)}}}else{e=d.getElementsByTagName("tspan");for(R=0,bI=e[r];R<bI;R++){R&&be(e[R],{dy:bJ*n,x:bH.x})}}be(d,{y:bH.y});var S=b.getBBox(),bG=bH.y-(S.y+S.height/2);bG&&isFinite(bG)&&be(d,{y:bH.y+bG})},aR=function(d,b){var i=0,e=0;this[0]=d;this.id=aG._oid++;this.node=d;d.raphael=this;this.paper=b;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!b.bottom&&(b.bottom=this);this.prev=b.top;b.top&&(b.top.next=this);b.top=this;this.next=null};var a9=aR[bC];aR[bC].rotate=function(d,b,i){if(this.removed){return this}if(d==null){if(this._.rt.cx){return[this._.rt.deg,this._.rt.cx,this._.rt.cy][aT](aF)}return this._.rt.deg}var e=this.getBBox();d=bA(d)[H](a);if(d[r]-1){b=ai(d[1]);i=ai(d[2])}d=ai(d[0]);if(b!=null&&b!==false){this._.rt.deg=d}else{this._.rt.deg+=d}(i==null)&&(b=null);this._.rt.cx=b;this._.rt.cy=i;b=b==null?e.x+e.width/2:b;i=i==null?e.y+e.height/2:i;if(this._.rt.deg){this.transformations[0]=aG.format("rotate({0} {1} {2})",this._.rt.deg,b,i);this.clip&&be(this.clip,{transform:aG.format("rotate({0} {1} {2})",-this._.rt.deg,b,i)})}else{this.transformations[0]=aM;this.clip&&be(this.clip,{transform:aM})}be(this.node,{transform:this.transformations[aT](aF)});return this};aR[bC].hide=function(){!this.removed&&(this.node.style.display="none");return this};aR[bC].show=function(){!this.removed&&(this.node.style.display="");return this};aR[bC].remove=function(){if(this.removed){return}aC(this,this.paper);this.node.parentNode.removeChild(this.node);for(var b in this){delete this[b]}this.removed=true};aR[bC].getBBox=function(){if(this.removed){return this}if(this.type=="path"){return ah(this.attrs.path)}if(this.node.style.display=="none"){this.show();var d=true}var bF={};try{bF=this.node.getBBox()}catch(R){}finally{bF=bF||{}}if(this.type=="text"){bF={x:bF.x,y:Infinity,width:0,height:0};for(var b=0,E=this.node.getNumberOfChars();b<E;b++){var S=this.node.getExtentOfChar(b);(S.y<bF.y)&&(bF.y=S.y);(S.y+S.height-bF.y>bF.height)&&(bF.height=S.y+S.height-bF.y);(S.x+S.width-bF.x>bF.width)&&(bF.width=S.x+S.width-bF.x)}}d&&this.hide();return bF};aR[bC].attr=function(b,bH){if(this.removed){return this}if(b==null){var bG={};for(var R in this.attrs){if(this.attrs[af](R)){bG[R]=this.attrs[R]}}this._.rt.deg&&(bG.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(bG.scale=this.scale());bG.gradient&&bG.fill=="none"&&(bG.fill=bG.gradient)&&delete bG.gradient;return bG}if(bH==null&&aG.is(b,ae)){if(b=="translation"){return z.call(this)}if(b=="rotation"){return this.rotate()}if(b=="scale"){return this.scale()}if(b==a1&&this.attrs.fill=="none"&&this.attrs.gradient){return this.attrs.gradient}return this.attrs[b]}if(bH==null&&aG.is(b,a4)){var bJ={};for(var E=0,S=b.length;E<S;E++){bJ[b[E]]=this.attr(b[E])}return bJ}if(bH!=null){var d={};d[b]=bH}else{if(b!=null&&aG.is(b,"object")){d=b}}for(var bI in this.paper.customAttributes){if(this.paper.customAttributes[af](bI)&&d[af](bI)&&aG.is(this.paper.customAttributes[bI],"function")){var bF=this.paper.customAttributes[bI].apply(this,[][bt](d[bI]));this.attrs[bI]=d[bI];for(var e in bF){if(bF[af](e)){d[e]=bF[e]}}}}am(this,d);return this};aR[bC].toFront=function(){if(this.removed){return this}this.node.parentNode[bh](this.node);var b=this.paper;b.top!=this&&ak(this,b);return this};aR[bC].toBack=function(){if(this.removed){return this}if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);o(this,this.paper);var b=this.paper}return this};aR[bC].insertAfter=function(b){if(this.removed){return this}var d=b.node||b[b.length-1].node;if(d.nextSibling){d.parentNode.insertBefore(this.node,d.nextSibling)}else{d.parentNode[bh](this.node)}I(this,b,this.paper);return this};aR[bC].insertBefore=function(b){if(this.removed){return this}var d=b.node||b[0].node;d.parentNode.insertBefore(this.node,d);aJ(this,b,this.paper);return this};aR[bC].blur=function(d){var b=this;if(+d!==0){var e=be("filter"),i=be("feGaussianBlur");b.attrs.blur=d;e.id="r"+(aG._id++)[aX](36);be(i,{stdDeviation:+d||1.5});e.appendChild(i);b.paper.defs.appendChild(e);b._blur=e;be(b.node,{filter:"url(#"+e.id+")"})}else{if(b._blur){b._blur.parentNode.removeChild(b._blur);delete b._blur;delete b.attrs.blur}b.node.removeAttribute("filter")}};var ad=function(d,b,R,E){var i=be("circle");d.canvas&&d.canvas[bh](i);var e=new aR(i,d);e.attrs={cx:b,cy:R,r:E,fill:"none",stroke:"#000"};e.type="circle";be(i,e.attrs);return e},a8=function(e,b,bF,d,R,S){var E=be("rect");e.canvas&&e.canvas[bh](E);var i=new aR(E,e);i.attrs={x:b,y:bF,width:d,height:R,r:S||0,rx:S||0,ry:S||0,fill:"none",stroke:"#000"};i.type="rect";be(E,i.attrs);return i},ax=function(d,b,S,R,E){var i=be("ellipse");d.canvas&&d.canvas[bh](i);var e=new aR(i,d);e.attrs={cx:b,cy:S,rx:R,ry:E,fill:"none",stroke:"#000"};e.type="ellipse";be(i,e.attrs);return e},u=function(e,S,b,bF,d,R){var E=be("image");be(E,{x:b,y:bF,width:d,height:R,preserveAspectRatio:"none"});E.setAttributeNS(e.xlink,"href",S);e.canvas&&e.canvas[bh](E);var i=new aR(E,e);i.attrs={x:b,y:bF,width:d,height:R,src:S};i.type="image";return i},aj=function(d,b,R,E){var i=be("text");be(i,{x:b,y:R,"text-anchor":"middle"});d.canvas&&d.canvas[bh](i);var e=new aR(i,d);e.attrs={x:b,y:R,"text-anchor":"middle",text:E,font:p.font,stroke:"none",fill:"#000"};e.type="text";am(e,e.attrs);return e},by=function(d,b){this.width=d||this.width;this.height=b||this.height;this.canvas[C]("width",this.width);this.canvas[C]("height",this.height);return this},D=function(){var i=aH[bz](0,arguments),e=i&&i.container,d=i.x,S=i.y,E=i.width,b=i.height;if(!e){throw new Error("SVG container not found.")}var R=be("svg");d=d||0;S=S||0;E=E||512;b=b||342;be(R,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:E,height:b});if(e==1){R.style.cssText="position:absolute;left:"+d+"px;top:"+S+"px";Z.body[bh](R)}else{if(e.firstChild){e.insertBefore(R,e.firstChild)}else{e[bh](R)}}e=new bw;e.width=E;e.height=b;e.canvas=R;bb.call(e,e,aG.fn);e.clear();return e};aW.clear=function(){var b=this.canvas;while(b.firstChild){b.removeChild(b.firstChild)}this.bottom=this.top=null;(this.desc=be("desc"))[bh](Z.createTextNode("Created with Rapha\xebl"));b[bh](this.desc);b[bh](this.defs=be("defs"))};aW.remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var b in this){this[b]=y(b)}}}if(aG.vml){var M={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},aK=/([clmz]),?([^clmz]*)/gi,bu=/ progid:\S+Blur\([^\)]+\)/g,bD=/-?[^,\s-]+/g,aU=1000+aF+1000,t=10,s={path:1,rect:1},bd=function(bJ){var bG=/[ahqstv]/ig,e=x;bA(bJ).match(bG)&&(e=U);bG=/[clmz]/g;if(e==x&&!bA(bJ).match(bG)){var bF=bA(bJ)[bp](aK,function(bM,bO,bK){var bN=[],i=bE.call(bO)=="m",bL=M[bO];bK[bp](bD,function(bP){if(i&&bN[r]==2){bL+=bN+M[bO=="m"?"l":"L"];bN=[]}bN[j](ac(bP*t))});return bL+bN});return bF}var bH=e(bJ),d,b;bF=[];for(var R=0,bI=bH[r];R<bI;R++){d=bH[R];b=bE.call(bH[R][0]);b=="z"&&(b="x");for(var E=1,S=d[r];E<S;E++){b+=ac(d[E]*t)+(E!=S-1?",":aM)}bF[j](b)}return bF[aT](aF)};aG[aX]=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl "+this.version};w=function(e,d){var R=aw("group");R.style.cssText="position:absolute;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px";R.coordsize=d.coordsize;R.coordorigin=d.coordorigin;var E=aw("shape"),i=E.style;i.width=d.width+"px";i.height=d.height+"px";E.coordsize=aU;E.coordorigin=d.coordorigin;R[bh](E);var S=new aR(E,R,d),b={fill:"none",stroke:"#000"};e&&(b.path=e);S.type="path";S.path=[];S.Path=aM;am(S,b);d.canvas[bh](R);return S};am=function(bH,bO){bH.attrs=bH.attrs||{};var bL=bH.node,bP=bH.attrs,S=bL.style,i,bN=(bO.x!=bP.x||bO.y!=bP.y||bO.width!=bP.width||bO.height!=bP.height||bO.r!=bP.r)&&bH.type=="rect",bT=bH;for(var bF in bO){if(bO[af](bF)){bP[bF]=bO[bF]}}if(bN){bP.path=aq(bP.x,bP.y,bP.width,bP.height,bP.r);bH.X=bP.x;bH.Y=bP.y;bH.W=bP.width;bH.H=bP.height}bO.href&&(bL.href=bO.href);bO.title&&(bL.title=bO.title);bO.target&&(bL.target=bO.target);bO.cursor&&(S.cursor=bO.cursor);"blur" in bO&&bH.blur(bO.blur);if(bO.path&&bH.type=="path"||bN){bL.path=bd(bP.path)}if(bO.rotation!=null){bH.rotate(bO.rotation,true)}if(bO.translation){i=bA(bO.translation)[H](a);z.call(bH,i[0],i[1]);if(bH._.rt.cx!=null){bH._.rt.cx+=+i[0];bH._.rt.cy+=+i[1];bH.setBox(bH.attrs,i[0],i[1])}}if(bO.scale){i=bA(bO.scale)[H](a);bH.scale(+i[0]||1,+i[1]||+i[0]||1,+i[2]||null,+i[3]||null)}if("clip-rect" in bO){var b=bA(bO["clip-rect"])[H](a);if(b[r]==4){b[2]=+b[2]+(+b[0]);b[3]=+b[3]+(+b[1]);var bG=bL.clipRect||Z.createElement("div"),bS=bG.style,R=bL.parentNode;bS.clip=aG.format("rect({1}px {2}px {3}px {0}px)",b);if(!bL.clipRect){bS.position="absolute";bS.top=0;bS.left=0;bS.width=bH.paper.width+"px";bS.height=bH.paper.height+"px";R.parentNode.insertBefore(bG,R);bG[bh](R);bL.clipRect=bG}}if(!bO["clip-rect"]){bL.clipRect&&(bL.clipRect.style.clip=aM)}}if(bH.type=="image"&&bO.src){bL.src=bO.src}if(bH.type=="image"&&bO.opacity){bL.filterOpacity=a2+".Alpha(opacity="+(bO.opacity*100)+")";S.filter=(bL.filterMatrix||aM)+(bL.filterOpacity||aM)}bO.font&&(S.font=bO.font);bO["font-family"]&&(S.fontFamily='"'+bO["font-family"][H](",")[0][bp](/^['"]+|['"]+$/g,aM)+'"');bO["font-size"]&&(S.fontSize=bO["font-size"]);bO["font-weight"]&&(S.fontWeight=bO["font-weight"]);bO["font-style"]&&(S.fontStyle=bO["font-style"]);if(bO.opacity!=null||bO["stroke-width"]!=null||bO.fill!=null||bO.stroke!=null||bO["stroke-width"]!=null||bO["stroke-opacity"]!=null||bO["fill-opacity"]!=null||bO["stroke-dasharray"]!=null||bO["stroke-miterlimit"]!=null||bO["stroke-linejoin"]!=null||bO["stroke-linecap"]!=null){bL=bH.shape||bL;var bM=(bL.getElementsByTagName(a1)&&bL.getElementsByTagName(a1)[0]),bQ=false;!bM&&(bQ=bM=aw(a1));if("fill-opacity" in bO||"opacity" in bO){var d=((+bP["fill-opacity"]+1||2)-1)*((+bP.opacity+1||2)-1)*((+aG.getRGB(bO.fill).o+1||2)-1);d=bf(l(d,0),1);bM.opacity=d}bO.fill&&(bM.on=true);if(bM.on==null||bO.fill=="none"){bM.on=false}if(bM.on&&bO.fill){var e=bO.fill.match(h);if(e){bM.src=e[1];bM.type="tile"}else{bM.color=aG.getRGB(bO.fill).hex;bM.src=aM;bM.type="solid";if(aG.getRGB(bO.fill).error&&(bT.type in {circle:1,ellipse:1}||bA(bO.fill).charAt()!="r")&&g(bT,bO.fill)){bP.fill="none";bP.gradient=bO.fill}}}bQ&&bL[bh](bM);var E=(bL.getElementsByTagName("stroke")&&bL.getElementsByTagName("stroke")[0]),bR=false;!E&&(bR=E=aw("stroke"));if((bO.stroke&&bO.stroke!="none")||bO["stroke-width"]||bO["stroke-opacity"]!=null||bO["stroke-dasharray"]||bO["stroke-miterlimit"]||bO["stroke-linejoin"]||bO["stroke-linecap"]){E.on=true}(bO.stroke=="none"||E.on==null||bO.stroke==0||bO["stroke-width"]==0)&&(E.on=false);var bK=aG.getRGB(bO.stroke);E.on&&bO.stroke&&(E.color=bK.hex);d=((+bP["stroke-opacity"]+1||2)-1)*((+bP.opacity+1||2)-1)*((+bK.o+1||2)-1);var bI=(ai(bO["stroke-width"])||1)*0.75;d=bf(l(d,0),1);bO["stroke-width"]==null&&(bI=bP["stroke-width"]);bO["stroke-width"]&&(E.weight=bI);bI&&bI<1&&(d*=bI)&&(E.weight=1);E.opacity=d;bO["stroke-linejoin"]&&(E.joinstyle=bO["stroke-linejoin"]||"miter");E.miterlimit=bO["stroke-miterlimit"]||8;bO["stroke-linecap"]&&(E.endcap=bO["stroke-linecap"]=="butt"?"flat":bO["stroke-linecap"]=="square"?"square":"round");if(bO["stroke-dasharray"]){var bJ={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};E.dashstyle=bJ[af](bO["stroke-dasharray"])?bJ[bO["stroke-dasharray"]]:aM}bR&&bL[bh](E)}if(bT.type=="text"){S=bT.paper.span.style;bP.font&&(S.font=bP.font);bP["font-family"]&&(S.fontFamily=bP["font-family"]);bP["font-size"]&&(S.fontSize=bP["font-size"]);bP["font-weight"]&&(S.fontWeight=bP["font-weight"]);bP["font-style"]&&(S.fontStyle=bP["font-style"]);bT.node.string&&(bT.paper.span.innerHTML=bA(bT.node.string)[bp](/</g,"<")[bp](/&/g,"&")[bp](/\n/g,"<br>"));bT.W=bP.w=bT.paper.span.offsetWidth;bT.H=bP.h=bT.paper.span.offsetHeight;bT.X=bP.x;bT.Y=bP.y+ac(bT.H/2);switch(bP["text-anchor"]){case"start":bT.node.style["v-text-align"]="left";bT.bbx=ac(bT.W/2);break;case"end":bT.node.style["v-text-align"]="right";bT.bbx=-ac(bT.W/2);break;default:bT.node.style["v-text-align"]="center";break}}};g=function(b,bF){b.attrs=b.attrs||{};var bG=b.attrs,bI,R="linear",S=".5 .5";b.attrs.gradient=bF;bF=bA(bF)[bp](aL,function(bK,bL,i){R="radial";if(bL&&i){bL=ai(bL);i=ai(i);bi(bL-0.5,2)+bi(i-0.5,2)>0.25&&(i=an.sqrt(0.25-bi(bL-0.5,2))*((i>0.5)*2-1)+0.5);S=bL+aF+i}return aM});bF=bF[H](/\s*\-\s*/);if(R=="linear"){var d=bF.shift();d=-ai(d);if(isNaN(d)){return null}}var E=v(bF);if(!E){return null}b=b.shape||b.node;bI=b.getElementsByTagName(a1)[0]||aw(a1);!bI.parentNode&&b.appendChild(bI);if(E[r]){bI.on=true;bI.method="none";bI.color=E[0].color;bI.color2=E[E[r]-1].color;var bJ=[];for(var e=0,bH=E[r];e<bH;e++){E[e].offset&&bJ[j](E[e].offset+aF+E[e].color)}bI.colors&&(bI.colors.value=bJ[r]?bJ[aT]():"0% "+bI.color);if(R=="radial"){bI.type="gradientradial";bI.focus="100%";bI.focussize=S;bI.focusposition=S}else{bI.type="gradient";bI.angle=(270-d)%360}}return 1};aR=function(E,S,b){var R=0,e=0,d=0,i=1;this[0]=E;this.id=aG._oid++;this.node=E;E.raphael=this;this.X=0;this.Y=0;this.attrs={};this.Group=S;this.paper=b;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!b.bottom&&(b.bottom=this);this.prev=b.top;b.top&&(b.top.next=this);b.top=this;this.next=null};a9=aR[bC];a9.rotate=function(d,b,e){if(this.removed){return this}if(d==null){if(this._.rt.cx){return[this._.rt.deg,this._.rt.cx,this._.rt.cy][aT](aF)}return this._.rt.deg}d=bA(d)[H](a);if(d[r]-1){b=ai(d[1]);e=ai(d[2])}d=ai(d[0]);if(b!=null){this._.rt.deg=d}else{this._.rt.deg+=d}e==null&&(b=null);this._.rt.cx=b;this._.rt.cy=e;this.setBox(this.attrs,b,e);this.Group.style.rotation=this._.rt.deg;return this};a9.setBox=function(E,R,e){if(this.removed){return this}var b=this.Group.style,S=(this.shape&&this.shape.style)||this.node.style;E=E||{};for(var bF in E){if(E[af](bF)){this.attrs[bF]=E[bF]}}R=R||this._.rt.cx;e=e||this._.rt.cy;var bI=this.attrs,bL,bK,bM,bH;switch(this.type){case"circle":bL=bI.cx-bI.r;bK=bI.cy-bI.r;bM=bH=bI.r*2;break;case"ellipse":bL=bI.cx-bI.rx;bK=bI.cy-bI.ry;bM=bI.rx*2;bH=bI.ry*2;break;case"image":bL=+bI.x;bK=+bI.y;bM=bI.width||0;bH=bI.height||0;break;case"text":this.textpath.v=["m",ac(bI.x),", ",ac(bI.y-2),"l",ac(bI.x)+1,", ",ac(bI.y-2)][aT](aM);bL=bI.x-ac(this.W/2);bK=bI.y-this.H/2;bM=this.W;bH=this.H;break;case"rect":case"path":if(!this.attrs.path){bL=0;bK=0;bM=this.paper.width;bH=this.paper.height}else{var bG=ah(this.attrs.path);bL=bG.x;bK=bG.y;bM=bG.width;bH=bG.height}break;default:bL=0;bK=0;bM=this.paper.width;bH=this.paper.height;break}R=(R==null)?bL+bM/2:R;e=(e==null)?bK+bH/2:e;var d=R-this.paper.width/2,bJ=e-this.paper.height/2,bN;b.left!=(bN=d+"px")&&(b.left=bN);b.top!=(bN=bJ+"px")&&(b.top=bN);this.X=s[af](this.type)?-d:bL;this.Y=s[af](this.type)?-bJ:bK;this.W=bM;this.H=bH;if(s[af](this.type)){S.left!=(bN=-d*t+"px")&&(S.left=bN);S.top!=(bN=-bJ*t+"px")&&(S.top=bN)}else{if(this.type=="text"){S.left!=(bN=-d+"px")&&(S.left=bN);S.top!=(bN=-bJ+"px")&&(S.top=bN)}else{b.width!=(bN=this.paper.width+"px")&&(b.width=bN);b.height!=(bN=this.paper.height+"px")&&(b.height=bN);S.left!=(bN=bL-d+"px")&&(S.left=bN);S.top!=(bN=bK-bJ+"px")&&(S.top=bN);S.width!=(bN=bM+"px")&&(S.width=bN);S.height!=(bN=bH+"px")&&(S.height=bN)}}};a9.hide=function(){!this.removed&&(this.Group.style.display="none");return this};a9.show=function(){!this.removed&&(this.Group.style.display="block");return this};a9.getBBox=function(){if(this.removed){return this}if(s[af](this.type)){return ah(this.attrs.path)}return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}};a9.remove=function(){if(this.removed){return}aC(this,this.paper);this.node.parentNode.removeChild(this.node);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);for(var b in this){delete this[b]}this.removed=true};a9.attr=function(b,bF){if(this.removed){return this}if(b==null){var S={};for(var E in this.attrs){if(this.attrs[af](E)){S[E]=this.attrs[E]}}this._.rt.deg&&(S.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(S.scale=this.scale());S.gradient&&S.fill=="none"&&(S.fill=S.gradient)&&delete S.gradient;return S}if(bF==null&&aG.is(b,"string")){if(b=="translation"){return z.call(this)}if(b=="rotation"){return this.rotate()}if(b=="scale"){return this.scale()}if(b==a1&&this.attrs.fill=="none"&&this.attrs.gradient){return this.attrs.gradient}return this.attrs[b]}if(this.attrs&&bF==null&&aG.is(b,a4)){var bI,bH={};for(E=0,bI=b[r];E<bI;E++){bH[b[E]]=this.attr(b[E])}return bH}var d;if(bF!=null){d={};d[b]=bF}bF==null&&aG.is(b,"object")&&(d=b);if(d){for(var bG in this.paper.customAttributes){if(this.paper.customAttributes[af](bG)&&d[af](bG)&&aG.is(this.paper.customAttributes[bG],"function")){var R=this.paper.customAttributes[bG].apply(this,[][bt](d[bG]));this.attrs[bG]=d[bG];for(var e in R){if(R[af](e)){d[e]=R[e]}}}}if(d.text&&this.type=="text"){this.node.string=d.text}am(this,d);if(d.gradient&&(({circle:1,ellipse:1})[af](this.type)||bA(d.gradient).charAt()!="r")){g(this,d.gradient)}(!s[af](this.type)||this._.rt.deg)&&this.setBox(this.attrs)}return this};a9.toFront=function(){!this.removed&&this.Group.parentNode[bh](this.Group);this.paper.top!=this&&ak(this,this.paper);return this};a9.toBack=function(){if(this.removed){return this}if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);o(this,this.paper)}return this};a9.insertAfter=function(b){if(this.removed){return this}if(b.constructor==ag){b=b[b.length-1]}if(b.Group.nextSibling){b.Group.parentNode.insertBefore(this.Group,b.Group.nextSibling)}else{b.Group.parentNode[bh](this.Group)}I(this,b,this.paper);return this};a9.insertBefore=function(b){if(this.removed){return this}if(b.constructor==ag){b=b[0]}b.Group.parentNode.insertBefore(this.Group,b.Group);aJ(this,b,this.paper);return this};a9.blur=function(b){var d=this.node.runtimeStyle,e=d.filter;e=e.replace(bu,aM);if(+b!==0){this.attrs.blur=b;d.filter=e+aF+a2+".Blur(pixelradius="+(+b||1.5)+")";d.margin=aG.format("-{0}px 0 0 -{0}px",ac(+b||1.5))}else{d.filter=e;d.margin=0;delete this.attrs.blur}};ad=function(d,b,bF,R){var E=aw("group"),S=aw("oval"),e=S.style;E.style.cssText="position:absolute;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px";E.coordsize=aU;E.coordorigin=d.coordorigin;E[bh](S);var i=new aR(S,E,d);i.type="circle";am(i,{stroke:"#000",fill:"none"});i.attrs.cx=b;i.attrs.cy=bF;i.attrs.r=R;i.setBox({x:b-R,y:bF-R,width:R*2,height:R*2});d.canvas[bh](E);return i};function aq(b,E,d,e,i){if(i){return aG.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",b+i,E,d-i*2,i,-i,e-i*2,i*2-d,i*2-e)}else{return aG.format("M{0},{1}l{2},0,0,{3},{4},0z",b,E,d,e,-d)}}a8=function(d,S,E,bF,e,b){var bG=aq(S,E,bF,e,b),i=d.path(bG),R=i.attrs;i.X=R.x=S;i.Y=R.y=E;i.W=R.width=bF;i.H=R.height=e;R.r=b;R.path=bG;i.type="rect";return i};ax=function(b,bG,bF,e,d){var E=aw("group"),i=aw("oval"),S=i.style;E.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";E.coordsize=aU;E.coordorigin=b.coordorigin;E[bh](i);var R=new aR(i,E,b);R.type="ellipse";am(R,{stroke:"#000"});R.attrs.cx=bG;R.attrs.cy=bF;R.attrs.rx=e;R.attrs.ry=d;R.setBox({x:bG-e,y:bF-d,width:e*2,height:d*2});b.canvas[bh](E);return R};u=function(d,b,bF,S,bG,i){var E=aw("group"),e=aw("image");E.style.cssText="position:absolute;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px";E.coordsize=aU;E.coordorigin=d.coordorigin;e.src=b;E[bh](e);var R=new aR(e,E,d);R.type="image";R.attrs.src=b;R.attrs.x=bF;R.attrs.y=S;R.attrs.w=bG;R.attrs.h=i;R.setBox({x:bF,y:S,width:bG,height:i});d.canvas[bh](E);return R};aj=function(d,bG,bF,bH){var E=aw("group"),i=aw("shape"),S=i.style,bI=aw("path"),b=bI.style,e=aw("textpath");E.style.cssText="position:absolute;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px";E.coordsize=aU;E.coordorigin=d.coordorigin;bI.v=aG.format("m{0},{1}l{2},{1}",ac(bG*10),ac(bF*10),ac(bG*10)+1);bI.textpathok=true;S.width=d.width;S.height=d.height;e.string=bA(bH);e.on=true;i[bh](e);i[bh](bI);E[bh](i);var R=new aR(e,E,d);R.shape=i;R.textpath=bI;R.type="text";R.attrs.text=bH;R.attrs.x=bG;R.attrs.y=bF;R.attrs.w=1;R.attrs.h=1;am(R,{font:p.font,stroke:"none",fill:"#000"});R.setBox();d.canvas[bh](E);return R};by=function(e,b){var d=this.canvas.style;e==+e&&(e+="px");b==+b&&(b+="px");d.width=e;d.height=b;d.clip="rect(0 "+e+" "+b+" 0)";return this};var aw;Z.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!Z.namespaces.rvml&&Z.namespaces.add("rvml","urn:schemas-microsoft-com:vml");aw=function(b){return Z.createElement("<rvml:"+b+' class="rvml">')}}catch(au){aw=function(b){return Z.createElement("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}D=function(){var e=aH[bz](0,arguments),b=e.container,bG=e.height,bH,d=e.width,bF=e.x,S=e.y;if(!b){throw new Error("VML container not found.")}var E=new bw,R=E.canvas=Z.createElement("div"),i=R.style;bF=bF||0;S=S||0;d=d||512;bG=bG||342;d==+d&&(d+="px");bG==+bG&&(bG+="px");E.width=1000;E.height=1000;E.coordsize=t*1000+aF+t*1000;E.coordorigin="0 0";E.span=Z.createElement("span");E.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";R[bh](E.span);i.cssText=aG.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",d,bG);if(b==1){Z.body[bh](R);i.left=bF+"px";i.top=S+"px";i.position="absolute"}else{if(b.firstChild){b.insertBefore(R,b.firstChild)}else{b[bh](R)}}bb.call(E,E,aG.fn);return E};aW.clear=function(){this.canvas.innerHTML=aM;this.span=Z.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[bh](this.span);this.bottom=this.top=null};aW.remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var b in this){this[b]=y(b)}return true}}var T=navigator.userAgent.match(/Version\/(.*?)\s/);if((navigator.vendor=="Apple Computer, Inc.")&&(T&&T[1]<4||navigator.platform.slice(0,2)=="iP")){aW.safari=function(){var b=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});aN.setTimeout(function(){b.remove()})}}else{aW.safari=function(){}}var N=function(){this.returnValue=false},bs=function(){return this.originalEvent.preventDefault()},a0=function(){this.cancelBubble=true},aB=function(){return this.originalEvent.stopPropagation()},at=(function(){if(Z.addEventListener){return function(R,i,e,d){var b=V&&bn[i]?bn[i]:i;var E=function(bH){if(V&&bn[af](i)){for(var bF=0,bG=bH.targetTouches&&bH.targetTouches.length;bF<bG;bF++){if(bH.targetTouches[bF].target==R){var S=bH;bH=bH.targetTouches[bF];bH.originalEvent=S;bH.preventDefault=bs;bH.stopPropagation=aB;break}}}return e.call(d,bH)};R.addEventListener(b,E,false);return function(){R.removeEventListener(b,E,false);return true}}}else{if(Z.attachEvent){return function(R,i,e,d){var E=function(S){S=S||aN.event;S.preventDefault=S.preventDefault||N;S.stopPropagation=S.stopPropagation||a0;return e.call(d,S)};R.attachEvent("on"+i,E);var b=function(){R.detachEvent("on"+i,E);return true};return b}}}})(),a5=[],bo=function(S){var bG=S.clientX,bF=S.clientY,bH=Z.documentElement.scrollTop||Z.body.scrollTop,bI=Z.documentElement.scrollLeft||Z.body.scrollLeft,b,d=a5.length;while(d--){b=a5[d];if(V){var R=S.touches.length,E;while(R--){E=S.touches[R];if(E.identifier==b.el._drag.id){bG=E.clientX;bF=E.clientY;(S.originalEvent?S.originalEvent:S).preventDefault();break}}}else{S.preventDefault()}bG+=bI;bF+=bH;b.move&&b.move.call(b.el,bG-b.el._drag.x,bF-b.el._drag.y,bG,bF)}},f=function(){aG.unmousemove(bo).unmouseup(f);var d=a5.length,b;while(d--){b=a5[d];b.el._drag={};b.end&&b.end.call(b.el)}a5=[]};for(var ap=P[r];ap--;){(function(b){aG[b]=aR[bC][b]=function(d){if(aG.is(d,"function")){this.events=this.events||[];this.events.push({name:b,f:d,unbind:at(this.shape||this.node||Z,b,d,this)})}return this};aG["un"+b]=aR[bC]["un"+b]=function(i){var e=this.events,d=e[r];while(d--){if(e[d].name==b&&e[d].f==i){e[d].unbind();e.splice(d,1);!e.length&&delete this.events;return this}}return this}})(P[ap])}a9.hover=function(d,b){return this.mouseover(d).mouseout(b)};a9.unhover=function(d,b){return this.unmouseover(d).unmouseout(b)};a9.drag=function(b,e,d){this._drag={};this.mousedown(function(E){(E.originalEvent||E).preventDefault();var i=Z.documentElement.scrollTop||Z.body.scrollTop,R=Z.documentElement.scrollLeft||Z.body.scrollLeft;this._drag.x=E.clientX+R;this._drag.y=E.clientY+i;this._drag.id=E.identifier;e&&e.call(this,E.clientX+R,E.clientY+i);!a5.length&&aG.mousemove(bo).mouseup(f);a5.push({el:this,move:b,end:d})});return this};a9.undrag=function(b,E,e){var d=a5.length;while(d--){a5[d].el==this&&(a5[d].move==b&&a5[d].end==e)&&a5.splice(d,1);!a5.length&&aG.unmousemove(bo).unmouseup(f)}};aW.circle=function(b,e,d){return ad(this,b||0,e||0,d||0)};aW.rect=function(b,E,d,e,i){return a8(this,b||0,E||0,d||0,e||0,i||0)};aW.ellipse=function(b,i,e,d){return ax(this,b||0,i||0,e||0,d||0)};aW.path=function(b){b&&!aG.is(b,ae)&&!aG.is(b[0],a4)&&(b+=aM);return w(aG.format[bz](aG,arguments),this)};aW.image=function(i,b,E,d,e){return u(this,i||"about:blank",b||0,E||0,d||0,e||0)};aW.text=function(b,e,d){return aj(this,b||0,e||0,bA(d))};aW.set=function(b){arguments[r]>1&&(b=Array[bC].splice.call(arguments,0,arguments[r]));return new ag(b)};aW.setSize=by;aW.top=aW.bottom=null;aW.raphael=aG;function B(){return this.x+aF+this.y}a9.resetScale=function(){if(this.removed){return this}this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};a9.scale=function(bK,bJ,e,d){if(this.removed){return this}if(bK==null&&bJ==null){return{x:this._.sx,y:this._.sy,toString:B}}bJ=bJ||bK;!+bJ&&(bJ=bK);var bO,bM,bN,bL,b0=this.attrs;if(bK!=0){var bI=this.getBBox(),bF=bI.x+bI.width/2,E=bI.y+bI.height/2,bZ=bK/this._.sx,bY=bJ/this._.sy;e=(+e||e==0)?e:bF;d=(+d||d==0)?d:E;var bH=~~(bK/an.abs(bK)),S=~~(bJ/an.abs(bJ)),bR=this.node.style,b2=e+(bF-e)*bZ,b1=d+(E-d)*bY;switch(this.type){case"rect":case"image":var bG=b0.width*bH*bZ,bQ=b0.height*S*bY;this.attr({height:bQ,r:b0.r*bf(bH*bZ,S*bY),width:bG,x:b2-bG/2,y:b1-bQ/2});break;case"circle":case"ellipse":this.attr({rx:b0.rx*bH*bZ,ry:b0.ry*S*bY,r:b0.r*bf(bH*bZ,S*bY),cx:b2,cy:b1});break;case"text":this.attr({x:b2,y:b1});break;case"path":var bT=ar(b0.path),bU=true;for(var bW=0,bP=bT[r];bW<bP;bW++){var bS=bT[bW],R=bl.call(bS[0]);if(R=="M"&&bU){continue}else{bU=false}if(R=="A"){bS[bT[bW][r]-2]*=bZ;bS[bT[bW][r]-1]*=bY;bS[1]*=bH*bZ;bS[2]*=S*bY;bS[5]=+!(bH+S?!+bS[5]:+bS[5])}else{if(R=="H"){for(var bV=1,bX=bS[r];bV<bX;bV++){bS[bV]*=bZ}}else{if(R=="V"){for(bV=1,bX=bS[r];bV<bX;bV++){bS[bV]*=bY}}else{for(bV=1,bX=bS[r];bV<bX;bV++){bS[bV]*=(bV%2)?bZ:bY}}}}}var b=ah(bT);bO=b2-b.x-b.width/2;bM=b1-b.y-b.height/2;bT[0][1]+=bO;bT[0][2]+=bM;this.attr({path:bT});break}if(this.type in {text:1,image:1}&&(bH!=1||S!=1)){if(this.transformations){this.transformations[2]="scale("[bt](bH,",",S,")");this.node[C]("transform",this.transformations[aT](aF));bO=(bH==-1)?-b0.x-(bG||0):b0.x;bM=(S==-1)?-b0.y-(bQ||0):b0.y;this.attr({x:bO,y:bM});b0.fx=bH-1;b0.fy=S-1}else{this.node.filterMatrix=a2+".Matrix(M11="[bt](bH,", M12=0, M21=0, M22=",S,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");bR.filter=(this.node.filterMatrix||aM)+(this.node.filterOpacity||aM)}}else{if(this.transformations){this.transformations[2]=aM;this.node[C]("transform",this.transformations[aT](aF));b0.fx=0;b0.fy=0}else{this.node.filterMatrix=aM;bR.filter=(this.node.filterMatrix||aM)+(this.node.filterOpacity||aM)}}b0.scale=[bK,bJ,e,d][aT](aF);this._.sx=bK;this._.sy=bJ}return this};a9.clone=function(){if(this.removed){return null}var b=this.attr();delete b.scale;delete b.translation;return this.paper[this.type]().attr(b)};var aZ={},k=function(R,d,bH,bG,bN,bM,bL,bK,S){var bJ=0,E=[R,d,bH,bG,bN,bM,bL,bK].join(),b=aZ[E],bF,e;!b&&(aZ[E]=b={data:[]});b.timer&&clearTimeout(b.timer);b.timer=setTimeout(function(){delete aZ[E]},2000);for(var bI=0;bI<101;bI++){if(b.data[S]>bI){e=b.data[bI*100]}else{e=aG.findDotsAtSegment(R,d,bH,bG,bN,bM,bL,bK,bI/100);b.data[bI]=e}bI&&(bJ+=bi(bi(bF.x-e.x,2)+bi(bF.y-e.y,2),0.5));if(S!=null&&bJ>=S){return e}bF=e}if(S==null){return bJ}},aY=function(b,d){return function(bN,R,S){bN=U(bN);var bJ,bI,e,bF,E="",bM={},bK,bH=0;for(var bG=0,bL=bN.length;bG<bL;bG++){e=bN[bG];if(e[0]=="M"){bJ=+e[1];bI=+e[2]}else{bF=k(bJ,bI,e[1],e[2],e[3],e[4],e[5],e[6]);if(bH+bF>R){if(d&&!bM.start){bK=k(bJ,bI,e[1],e[2],e[3],e[4],e[5],e[6],R-bH);E+=["C",bK.start.x,bK.start.y,bK.m.x,bK.m.y,bK.x,bK.y];if(S){return E}bM.start=E;E=["M",bK.x,bK.y+"C",bK.n.x,bK.n.y,bK.end.x,bK.end.y,e[5],e[6]][aT]();bH+=bF;bJ=+e[5];bI=+e[6];continue}if(!b&&!d){bK=k(bJ,bI,e[1],e[2],e[3],e[4],e[5],e[6],R-bH);return{x:bK.x,y:bK.y,alpha:bK.alpha}}}bH+=bF;bJ=+e[5];bI=+e[6]}E+=e}bM.end=E;bK=b?bH:d?bM:aG.findDotsAtSegment(bJ,bI,e[1],e[2],e[3],e[4],e[5],e[6],1);bK.alpha&&(bK={x:bK.x,y:bK.y,alpha:bK.alpha});return bK}};var aI=aY(1),K=aY(),X=aY(0,1);a9.getTotalLength=function(){if(this.type!="path"){return}if(this.node.getTotalLength){return this.node.getTotalLength()}return aI(this.attrs.path)};a9.getPointAtLength=function(b){if(this.type!="path"){return}if(this.node.getPointAtLength){return this.node.getPointAtLength(b)}return K(this.attrs.path,b)};a9.getSubpath=function(e,d){if(this.type!="path"){return}if(an.abs(this.getTotalLength()-d)<"1e-6"){return X(this.attrs.path,e).end}var b=X(this.attrs.path,d,1);return e?X(b,e).end:b};aG.easing_formulas={linear:function(b){return b},"<":function(b){return bi(b,3)},">":function(b){return bi(b-1,3)+1},"<>":function(b){b=b*2;if(b<1){return bi(b,3)/2}b-=2;return(bi(b,3)+2)/2},backIn:function(d){var b=1.70158;return d*d*((b+1)*d-b)},backOut:function(d){d=d-1;var b=1.70158;return d*d*((b+1)*d+b)+1},elastic:function(e){if(e==0||e==1){return e}var d=0.3,b=d/4;return bi(2,-10*e)*an.sin((e-b)*(2*an.PI)/d)+1},bounce:function(i){var d=7.5625,e=2.75,b;if(i<(1/e)){b=d*i*i}else{if(i<(2/e)){i-=(1.5/e);b=d*i*i+0.75}else{if(i<(2.5/e)){i-=(2.25/e);b=d*i*i+0.9375}else{i-=(2.625/e);b=d*i*i+0.984375}}}return b}};var W=[],br=function(){var bG=+new Date;for(var bR=0;bR<W[r];bR++){var bW=W[bR];if(bW.stop||bW.el.removed){continue}var R=bG-bW.start,bO=bW.ms,bN=bW.easing,bS=bW.from,bL=bW.diff,d=bW.to,bK=bW.t,bF=bW.el,bM={},b;if(R<bO){var E=bN(R/bO);for(var bP in bS){if(bS[af](bP)){switch(al[bP]){case"along":b=E*bO*bL[bP];d.back&&(b=d.len-b);var bQ=K(d[bP],b);bF.translate(bL.sx-bL.x||0,bL.sy-bL.y||0);bL.x=bQ.x;bL.y=bQ.y;bF.translate(bQ.x-bL.sx,bQ.y-bL.sy);d.rot&&bF.rotate(bL.r+bQ.alpha,bQ.x,bQ.y);break;case aD:b=+bS[bP]+E*bO*bL[bP];break;case"colour":b="rgb("+[J(ac(bS[bP].r+E*bO*bL[bP].r)),J(ac(bS[bP].g+E*bO*bL[bP].g)),J(ac(bS[bP].b+E*bO*bL[bP].b))][aT](",")+")";break;case"path":b=[];for(var bU=0,bJ=bS[bP][r];bU<bJ;bU++){b[bU]=[bS[bP][bU][0]];for(var bT=1,bV=bS[bP][bU][r];bT<bV;bT++){b[bU][bT]=+bS[bP][bU][bT]+E*bO*bL[bP][bU][bT]}b[bU]=b[bU][aT](aF)}b=b[aT](aF);break;case"csv":switch(bP){case"translation":var bI=E*bO*bL[bP][0]-bK.x,bH=E*bO*bL[bP][1]-bK.y;bK.x+=bI;bK.y+=bH;b=bI+aF+bH;break;case"rotation":b=+bS[bP][0]+E*bO*bL[bP][0];bS[bP][1]&&(b+=","+bS[bP][1]+","+bS[bP][2]);break;case"scale":b=[+bS[bP][0]+E*bO*bL[bP][0],+bS[bP][1]+E*bO*bL[bP][1],(2 in d[bP]?d[bP][2]:aM),(3 in d[bP]?d[bP][3]:aM)][aT](aF);break;case"clip-rect":b=[];bU=4;while(bU--){b[bU]=+bS[bP][bU]+E*bO*bL[bP][bU]}break}break;default:var S=[].concat(bS[bP]);b=[];bU=bF.paper.customAttributes[bP].length;while(bU--){b[bU]=+S[bU]+E*bO*bL[bP][bU]}break}bM[bP]=b}}bF.attr(bM);bF._run&&bF._run.call(bF)}else{if(d.along){bQ=K(d.along,d.len*!d.back);bF.translate(bL.sx-(bL.x||0)+bQ.x-bL.sx,bL.sy-(bL.y||0)+bQ.y-bL.sy);d.rot&&bF.rotate(bL.r+bQ.alpha,bQ.x,bQ.y)}(bK.x||bK.y)&&bF.translate(-bK.x,-bK.y);d.scale&&(d.scale+=aM);bF.attr(d);W.splice(bR--,1)}}aG.svg&&bF&&bF.paper&&bF.paper.safari();W[r]&&setTimeout(br)},bv=function(b,e,R,E,i){var d=R-E;e.timeouts.push(setTimeout(function(){aG.is(i,"function")&&i.call(e);e.animate(b,d,b.easing)},E))},J=function(b){return l(bf(b,255),0)},z=function(b,e){if(b==null){return{x:this._.tx,y:this._.ty,toString:B}}this._.tx+=+b;this._.ty+=+e;switch(this.type){case"circle":case"ellipse":this.attr({cx:+b+this.attrs.cx,cy:+e+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+b+this.attrs.x,y:+e+this.attrs.y});break;case"path":var d=ar(this.attrs.path);d[0][1]+=+b;d[0][2]+=+e;this.attr({path:d});break}return this};a9.animateWith=function(e,R,b,bF,S){for(var d=0,E=W.length;d<E;d++){if(W[d].el.id==e.id){R.start=W[d].start}}return this.animate(R,b,bF,S)};a9.animateAlong=aS();a9.animateAlongBack=aS(1);function aS(b){return function(i,e,d,R){var E={back:b};aG.is(d,"function")?(R=d):(E.rot=d);i&&i.constructor==aR&&(i=i.attrs.path);i&&(E.along=i);return this.animate(E,e,R)}}function aV(bL,i,d,bK,bJ,bF){var bG=3*i,bI=3*(bK-i)-bG,b=1-bG-bI,S=3*d,bH=3*(bJ-d)-S,bM=1-S-bH;function R(bN){return((b*bN+bI)*bN+bG)*bN}function e(bN,bP){var bO=E(bN,bP);return((bM*bO+bH)*bO+S)*bO}function E(bN,bU){var bT,bS,bQ,bO,bR,bP;for(bQ=bN,bP=0;bP<8;bP++){bO=R(bQ)-bN;if(an.abs(bO)<bU){return bQ}bR=(3*b*bQ+2*bI)*bQ+bG;if(an.abs(bR)<0.000001){break}bQ=bQ-bO/bR}bT=0;bS=1;bQ=bN;if(bQ<bT){return bT}if(bQ>bS){return bS}while(bT<bS){bO=R(bQ);if(an.abs(bO-bN)<bU){return bQ}if(bN>bO){bT=bQ}else{bS=bQ}bQ=(bS-bT)/2+bT}return bQ}return e(bL,1/(200*bF))}a9.onAnimation=function(b){this._run=b||0;return this};a9.animate=function(bY,bO,bN,R){var d=this;d.timeouts=d.timeouts||[];if(aG.is(bN,"function")||!bN){R=bN||null}if(d.removed){R&&R.call(d);return d}var bS={},e={},S=false,bJ={};for(var bP in bY){if(bY[af](bP)){if(al[af](bP)||d.paper.customAttributes[af](bP)){S=true;bS[bP]=d.attr(bP);(bS[bP]==null)&&(bS[bP]=p[bP]);e[bP]=bY[bP];switch(al[bP]){case"along":var bW=aI(bY[bP]);var bQ=K(bY[bP],bW*!!bY.back);var bF=d.getBBox();bJ[bP]=bW/bO;bJ.tx=bF.x;bJ.ty=bF.y;bJ.sx=bQ.x;bJ.sy=bQ.y;e.rot=bY.rot;e.back=bY.back;e.len=bW;bY.rot&&(bJ.r=ai(d.rotate())||0);break;case aD:bJ[bP]=(e[bP]-bS[bP])/bO;break;case"colour":bS[bP]=aG.getRGB(bS[bP]);var bR=aG.getRGB(e[bP]);bJ[bP]={r:(bR.r-bS[bP].r)/bO,g:(bR.g-bS[bP].g)/bO,b:(bR.b-bS[bP].b)/bO};break;case"path":var bG=U(bS[bP],e[bP]);bS[bP]=bG[0];var bL=bG[1];bJ[bP]=[];for(var bV=0,bI=bS[bP][r];bV<bI;bV++){bJ[bP][bV]=[0];for(var bU=1,bX=bS[bP][bV][r];bU<bX;bU++){bJ[bP][bV][bU]=(bL[bV][bU]-bS[bP][bV][bU])/bO}}break;case"csv":var b=bA(bY[bP])[H](a),bH=bA(bS[bP])[H](a);switch(bP){case"translation":bS[bP]=[0,0];bJ[bP]=[b[0]/bO,b[1]/bO];break;case"rotation":bS[bP]=(bH[1]==b[1]&&bH[2]==b[2])?bH:[0,b[1],b[2]];bJ[bP]=[(b[0]-bS[bP][0])/bO,0,0];break;case"scale":bY[bP]=b;bS[bP]=bA(bS[bP])[H](a);bJ[bP]=[(b[0]-bS[bP][0])/bO,(b[1]-bS[bP][1])/bO,0,0];break;case"clip-rect":bS[bP]=bA(bS[bP])[H](a);bJ[bP]=[];bV=4;while(bV--){bJ[bP][bV]=(b[bV]-bS[bP][bV])/bO}break}e[bP]=b;break;default:b=[].concat(bY[bP]);bH=[].concat(bS[bP]);bJ[bP]=[];bV=d.paper.customAttributes[bP][r];while(bV--){bJ[bP][bV]=((b[bV]||0)-(bH[bV]||0))/bO}break}}}}if(!S){var bM=[],E;for(var bZ in bY){if(bY[af](bZ)&&bc.test(bZ)){bP={value:bY[bZ]};bZ=="from"&&(bZ=0);bZ=="to"&&(bZ=100);bP.key=Q(bZ,10);bM.push(bP)}}bM.sort(bj);if(bM[0].key){bM.unshift({key:0,value:d.attrs})}for(bV=0,bI=bM[r];bV<bI;bV++){bv(bM[bV].value,d,bO/100*bM[bV].key,bO/100*(bM[bV-1]&&bM[bV-1].key||0),bM[bV-1]&&bM[bV-1].value.callback)}E=bM[bM[r]-1].value.callback;if(E){d.timeouts.push(setTimeout(function(){E.call(d)},bO))}}else{var bT=aG.easing_formulas[bN];if(!bT){bT=bA(bN).match(c);if(bT&&bT[r]==5){var bK=bT;bT=function(i){return aV(i,+bK[1],+bK[2],+bK[3],+bK[4],bO)}}else{bT=function(i){return i}}}W.push({start:bY.start||+new Date,ms:bO,easing:bT,from:bS,diff:bJ,to:e,el:d,t:{x:0,y:0}});aG.is(R,"function")&&(d._ac=setTimeout(function(){R.call(d)},bO));W[r]==1&&setTimeout(br)}return this};a9.stop=function(){for(var b=0;b<W.length;b++){W[b].el.id==this.id&&W.splice(b--,1)}for(b=0,ii=this.timeouts&&this.timeouts.length;b<ii;b++){clearTimeout(this.timeouts[b])}this.timeouts=[];clearTimeout(this._ac);delete this._ac;return this};a9.translate=function(b,d){return this.attr({translation:b+" "+d})};a9[aX]=function(){return"Rapha\xebl\u2019s object"};aG.ae=W;var ag=function(b){this.items=[];this[r]=0;this.type="set";if(b){for(var d=0,e=b[r];d<e;d++){if(b[d]&&(b[d].constructor==aR||b[d].constructor==ag)){this[this.items[r]]=this.items[this.items[r]]=b[d];this[r]++}}}};ag[bC][j]=function(){var E,b;for(var d=0,e=arguments[r];d<e;d++){E=arguments[d];if(E&&(E.constructor==aR||E.constructor==ag)){b=this.items[r];this[b]=this.items[b]=E;this[r]++}}return this};ag[bC].pop=function(){delete this[this[r]--];return this.items.pop()};for(var G in a9){if(a9[af](G)){ag[bC][G]=(function(b){return function(){for(var d=0,e=this.items[r];d<e;d++){this.items[d][b][bz](this.items[d],arguments)}return this}})(G)}}ag[bC].attr=function(d,S){if(d&&aG.is(d,a4)&&aG.is(d[0],"object")){for(var b=0,R=d[r];b<R;b++){this.items[b].attr(d[b])}}else{for(var e=0,E=this.items[r];e<E;e++){this.items[e].attr(d,S)}}return this};ag[bC].animate=function(d,b,S,bG){(aG.is(S,"function")||!S)&&(bG=S||null);var R=this.items[r],e=R,bH,bF=this,E;bG&&(E=function(){!--R&&bG.call(bF)});S=aG.is(S,ae)?S:E;bH=this.items[--e].animate(d,b,S,E);while(e--){this.items[e]&&!this.items[e].removed&&this.items[e].animateWith(bH,d,b,S,E)}return this};ag[bC].insertAfter=function(d){var b=this.items[r];while(b--){this.items[b].insertAfter(d)}return this};ag[bC].getBBox=function(){var b=[],S=[],d=[],E=[];for(var e=this.items[r];e--;){var R=this.items[e].getBBox();b[j](R.x);S[j](R.y);d[j](R.x+R.width);E[j](R.y+R.height)}b=bf[bz](0,b);S=bf[bz](0,S);return{x:b,y:S,width:l[bz](0,d)-b,height:l[bz](0,E)-S}};ag[bC].clone=function(e){e=new ag;for(var b=0,d=this.items[r];b<d;b++){e[j](this.items[b].clone())}return e};aG.registerFont=function(d){if(!d.face){return d}this.fonts=this.fonts||{};var i={w:d.w,face:{},glyphs:{}},e=d.face["font-family"];for(var S in d.face){if(d.face[af](S)){i.face[S]=d.face[S]}}if(this.fonts[e]){this.fonts[e][j](i)}else{this.fonts[e]=[i]}if(!d.svg){i.face["units-per-em"]=Q(d.face["units-per-em"],10);for(var E in d.glyphs){if(d.glyphs[af](E)){var R=d.glyphs[E];i.glyphs[E]={w:R.w,k:{},d:R.d&&"M"+R.d[bp](/[mlcxtrv]/g,function(bF){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[bF]||"M"})+"z"};if(R.k){for(var b in R.k){if(R[af](b)){i.glyphs[E].k[b]=R.k[b]}}}}}}return d};aW.getFont=function(bG,bH,d,E){E=E||"normal";d=d||"normal";bH=+bH||{normal:400,bold:700,lighter:300,bolder:800}[bH]||400;if(!aG.fonts){return}var R=aG.fonts[bG];if(!R){var e=new RegExp("(^|\\s)"+bG[bp](/[^\w\d\s+!~.:_-]/g,aM)+"(\\s|$)","i");for(var b in aG.fonts){if(aG.fonts[af](b)){if(e.test(b)){R=aG.fonts[b];break}}}}var S;if(R){for(var bF=0,bI=R[r];bF<bI;bF++){S=R[bF];if(S.face["font-weight"]==bH&&(S.face["font-style"]==d||!S.face["font-style"])&&S.face["font-stretch"]==E){break}}}return S};aW.print=function(R,E,b,bG,bH,bQ,d){bQ=bQ||"middle";d=l(bf(d||0,1),-1);var bM=this.set(),bP=bA(b)[H](aM),bN=0,bK=aM,bR;aG.is(bG,b)&&(bG=this.getFont(bG));if(bG){bR=(bH||16)/bG.face["units-per-em"];var e=bG.face.bbox.split(a),bF=+e[0],bI=+e[1]+(bQ=="baseline"?e[3]-e[1]+(+bG.face.descent):(e[3]-e[1])/2);for(var bL=0,S=bP[r];bL<S;bL++){var bJ=bL&&bG.glyphs[bP[bL-1]]||{},bO=bG.glyphs[bP[bL]];bN+=bL?(bJ.w||bG.w)+(bJ.k&&bJ.k[bP[bL]]||0)+(bG.w*d):0;bO&&bO.d&&bM[j](this.path(bO.d).attr({fill:"#000",stroke:"none",translation:[bN,0]}))}bM.scale(bR,bR,bF,bI).translate(R-bF,E-bI)}return bM};aG.format=function(d,e){var b=aG.is(e,a4)?[0][bt](e):arguments;d&&aG.is(d,ae)&&b[r]-1&&(d=d[bp](bk,function(R,E){return b[++E]==null?aM:b[E]}));return d||aM};aG.ninja=function(){q.was?(aN.Raphael=q.is):delete Raphael;return aG};aG.el=a9;aG.st=ag[bC];q.was?(aN.Raphael=aG):(Raphael=aG)})(); var JSPlanarity=(function(Raphael){var configuration={xSize:"530",ySize:"530",vertexRadius:7,inactiveVertexColor:"#00F",activeVertexColor:"#0F0",edgeStrokeWidth:"2",inactiveEdgeColor:"#000",activeEdgeColor:"#FFF",intersectionEdgeColor:"#F00",randomMinValue:0,randomMaxValue:20,startupAnimationTimeMs:700,difficulty:4};var raphaelPaper={};var factories={};var vertexArray=[];var edgeArray=[];function createFactories(raphaelPaper){function createVertex(xpos,ypos){var vertexEdges=[];var vertexVisualisation=raphaelPaper.circle(xpos||configuration.xSize/2,ypos||configuration.ySize/2,configuration.vertexRadius).attr({fill:configuration.inactiveVertexColor}).onAnimation(updateEdges);function toFront(){vertexVisualisation.toFront()}function updateEdges(){vertexEdges.map(function(item){item.updateVisualisation()})}function setPosition(x,y,animationTimeMs){var newX=Math.max(0,x);newX=Math.min(newX,configuration.xSize);var newY=Math.max(0,y);newY=Math.min(newY,configuration.ySize);var newAnimationTimeMs=animationTimeMs||0;newAnimationTimeMs=Math.max(newAnimationTimeMs,0);vertexVisualisation.animate({cx:newX,cy:newY},newAnimationTimeMs,"bounce",updateEdges)}function addEdge(newEdge){vertexEdges.push(newEdge)}function getPositionString(){return""+vertexVisualisation.attr("cx")+" "+vertexVisualisation.attr("cy")}function x(){return vertexVisualisation.attr("cx")}function y(){return vertexVisualisation.attr("cy")}function startDrag(){vertexVisualisation.ox=vertexVisualisation.attr("cx");vertexVisualisation.oy=vertexVisualisation.attr("cy");vertexEdges.map(function(item){item.activate()})}function dragging(dx,dy){var newX=vertexVisualisation.ox+dx;var newY=vertexVisualisation.oy+dy;setPosition(newX,newY)}function endDrag(){vertexEdges.map(function(item){item.deactivate()})}vertexVisualisation.drag(dragging,startDrag,endDrag);function activate(){vertexVisualisation.attr({fill:configuration.activeVertexColor})}function deactivate(){vertexVisualisation.attr({fill:configuration.inactiveVertexColor})}var vertex={toFront:toFront,setPosition:setPosition,addEdge:addEdge,x:x,y:y,getPositionString:getPositionString,activate:activate,deactivate:deactivate};return vertex}function createEdgeBetween(vertex1,vertex2){var startVertex=vertex1;var endVertex=vertex2;var edgeVisualisation=raphaelPaper.path().attr({"stroke-width":configuration.edgeStrokeWidth});updateVisualisation();function getPathString(){var pathString="M "+startVertex.getPositionString()+" L "+endVertex.getPositionString();return pathString}function updateVisualisation(){var pathString=getPathString();edgeVisualisation.attr({path:pathString})}function getEdgeFunction(){var A=endVertex.y()-startVertex.y();var B=startVertex.x()-endVertex.x();var C=A*startVertex.x()+B*startVertex.y();return createLineRepresentation(A,B,C)}function belongsToEdge(point){var threshold=0.001;if(threshold<(point.x-Math.min(startVertex.x(),endVertex.x()))&&threshold<(Math.max(startVertex.x(),endVertex.x())-point.x)){return true}else{if(threshold<(point.y-Math.min(startVertex.y(),endVertex.y()))&&threshold<(Math.max(startVertex.y(),endVertex.y())-point.y)){return true}else{return false}}}function intersectWith(secondEdge){var edgeFunction=getEdgeFunction();var intersection=edgeFunction.intersect(secondEdge.getEdgeFunction());if(!intersection){return false}return(belongsToEdge(intersection)&&secondEdge.belongsToEdge(intersection))}function activate(){edgeVisualisation.attr({stroke:configuration.activeEdgeColor});startVertex.activate();endVertex.activate()}function deactivate(){edgeVisualisation.attr({stroke:configuration.inactiveEdgeColor});startVertex.deactivate();endVertex.deactivate()}var edge={activate:activate,deactivate:deactivate,updateVisualisation:updateVisualisation,getEdgeFunction:getEdgeFunction,intersectWith:intersectWith,belongsToEdge:belongsToEdge};startVertex.addEdge(edge);endVertex.addEdge(edge);edgeArray.push(edge);return edge}function createLineRepresentation(A,B,C){function intersect(otherLine){var A2=otherLine.A;var B2=otherLine.B;var C2=otherLine.C;var determinant=A*B2-B*A2;if(0===determinant){return null}else{var x=(B2*C-B*C2)/determinant;var y=(A*C2-A2*C)/determinant;return{x:x,y:y}}}return{A:A,B:B,C:C,intersect:intersect}}function getRandomInt(){return Math.floor(Math.random()*(configuration.randomMaxValue-configuration.randomMinValue+1))+configuration.randomMinValue}return{createVertex:createVertex,createEdgeBetween:createEdgeBetween,createLineRepresentation:createLineRepresentation,getRandomInt:getRandomInt}}function init(divName){var divElement=document.getElementById(divName);divElement.style.width=configuration.xSize+"px";divElement.style.height=configuration.ySize+"px";raphaelPaper=Raphael(divName,configuration.xSize,configuration.ySize);delete divElement;factories=createFactories(raphaelPaper);createNewGraph(configuration.difficulty)}function createNewGraph(difficultyLevel){raphaelPaper.clear();delete vertexArray;vertexArray=[];delete edgeArray;edgeArray=[];generatePlanarGraph(difficultyLevel);arrangeVerticesInCircle()}function generatePlanarGraph(numberOfLines){function generateLines(){var lineRepresentations=[];var rand=factories.getRandomInt;for(var i=0;i<numberOfLines;i++){lineRepresentations.push(factories.createLineRepresentation(rand(),rand(),rand()))}lineRepresentations.map(function(line,index){line.index=index+1});var intersections=[];var linesCopy=lineRepresentations.slice();while(1<linesCopy.length){var currentLine=linesCopy.pop();intersections.push.apply(intersections,linesCopy.map(function(line){return line.intersect(currentLine)}))}if(intersections.some(function(element){return(null===element)})){return null}return lineRepresentations}function pairIndex(lineIndex1,lineIndex2,numberOfLines){if(lineIndex1>=lineIndex2){return pairIndex(lineIndex2,lineIndex1,numberOfLines)}var index=(lineIndex1*(2*numberOfLines-lineIndex1-1)/2)+lineIndex1-lineIndex2;return index}var lineRepresentations;do{lineRepresentations=generateLines()}while(null===lineRepresentations);var vertexCount=numberOfLines*(numberOfLines-1)/2;for(var j=0;j<vertexCount;j++){vertexArray.push(factories.createVertex())}for(var lineIndex=0;lineIndex<lineRepresentations.length;lineIndex++){var currentLine=lineRepresentations[lineIndex];var M=lineRepresentations.filter(function(line,index){return(index!=lineIndex)});M.sort(function(line1,line2){var intersection1=currentLine.intersect(line1);var intersection2=currentLine.intersect(line2);return(intersection2.x-intersection1.x)});for(var edgeIndex=0;edgeIndex<M.length-1;edgeIndex++){var u=pairIndex(currentLine.index,M[edgeIndex].index,numberOfLines);var v=pairIndex(currentLine.index,M[edgeIndex+1].index,numberOfLines);factories.createEdgeBetween(vertexArray[u],vertexArray[v])}}vertexArray.map(function(vertex){vertex.toFront()})}function arrangeVerticesInCircle(){var arrayLength=vertexArray.length;var angleDelta=2*Math.PI/arrayLength;var hypothenuse=Math.min(configuration.xSize,configuration.ySize)/2-10;for(var vertexIndex=0;vertexIndex<arrayLength;vertexIndex++){var currentVertex=vertexArray[vertexIndex];var currentAngle=vertexIndex*angleDelta;var newX=Math.cos(currentAngle)*hypothenuse+configuration.xSize/2;var newY=Math.sin(currentAngle)*hypothenuse+configuration.ySize/2;currentVertex.setPosition(newX,newY,configuration.startupAnimationTimeMs)}}function checkEdgeIntersection(){var edges=edgeArray.slice();var intersections=[];while(1<edges.length){var currentEdge=edges.pop();intersections.push.apply(intersections,edges.filter(function(edge){return edge.intersectWith(currentEdge)}))}if(0<intersections.length){alert("There are "+intersections.length+" intersections left to clean up.")}else{alert("Congratulations: You WON Stage "+(configuration.difficulty-3));configuration.difficulty++;createNewGraph(configuration.difficulty)}}return{init:init,checkSolution:checkEdgeIntersection,createNewGraph:createNewGraph}}(Raphael)); //]]></script><span style="font-weight:bold;">Object:</span> Arrange the dots so that no lines cross.<br /><br /><span id="fullpost">Simply click and hold a dot with your mouse, or touch and hold a dot with your finger, in order to move it.<br /><br />If you're using a touch device and find you're having trouble moving a particular dot, zoom in and try moving it again.<br /><br />Also, try and avoid placing the dots too close to the edge, as this may make them hard to move later.</span><h3><span id="fullpost">Further Controls:</span></h3><span id="fullpost"><span style="font-weight:bold;">Check Now!:</span> If 1 or more lines are crossed, clicking this button will tell you how many intersections remain. If no lines are crossed, this button will verify this and advance you to the next level.<br /><br /><button id="CheckButton" onclick="JSPlanarity.checkSolution()">Check Now!</button><br /><div id="PlanarityArea" style="background:#f2f2f2"></div><br /><h3>Solutions:</h3><a href="http://jayisgames.com/archives/2005/07/planarity.php">Planarity strategy 1</a><br /><a href="http://web.archive.org/web/20060818151404/http://jillie-geek42.livejournal.com/95888.html?thread=175504">Planarity strategy 2</a><br /><h3>More Information:</h3><a href="http://www.planarity.net/">Planarity home page</a><br /><a href="http://mkroehnert.github.com/JSPlanarity/">JSPlanarity home page</a><br /><a href="http://en.wikipedia.org/wiki/Planar_graph">Planar graph definition</a><br /></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com2tag:blogger.com,1999:blog-2800835365312821409.post-88053979000437364352010-11-20T13:33:00.000-08:002010-11-20T15:10:33.037-08:00Triangular Peg Solitaire<style type='text/css'>.offsite { border-style: solid; border-width: 2px; border-color: black; display: block; margin-left: auto; margin-right: auto; } </style><script type='text/javascript'>//<![CDATA[ function playtps() { msg = String.fromCharCode(60) + "iframe class='offsite' src='http://home.comcast.net/~gibell/pegsolitaire/Tools/Triangular/Triang.htm' width='530' height='639' scrolling='no'" + String.fromCharCode(62,60) + "/iframe" + String.fromCharCode(62,60) + "div style='text-align:center;'" + String.fromCharCode(62) + "(" + String.fromCharCode(60) + "a href='http://home.comcast.net/~gibell/pegsolitaire/Tools/Triangular/Triang.htm'" + String.fromCharCode(62) + "Iframe source" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + " courtesy of " + String.fromCharCode(60) + "a href='http://home.comcast.net/~gibell/'" + String.fromCharCode(62) + "George Bell" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + ")" + String.fromCharCode(60) + "/div" + String.fromCharCode(62); $("#gametps").html(msg); }; //]]></script><span id="fullpost">To begin, click the <span style="font-style:italic;">Play Triangular Peg Solitaire</span> button below.<br /><br /></span><span style="font-weight:bold;">Object:</span> The goal is to finish with one peg.<br /><br />Jump one peg over another into an empty spot, removing the jumped peg from the board. You can jump along any of the three directions parallel to the outside edges of the board. Just click on a peg and if there's a jump available, the peg will jump. If there's more than one jump available, you'll need to click on a destination.<br /><br /><span id="fullpost">When the same peg jumps over one or more pegs, it is counted as one move. A move that captures a lot of pegs is called a sweep. After you have solved a puzzle down to one peg, you can try to find a solution with the smallest number of moves, or view the computer's solution to the problem.</span><h3><span id="fullpost">Further Controls:</span></h3><span id="fullpost"><span style="font-weight:bold;">Restart:</span> Resets the game to the starting position with one peg missing.<br /><br /><span style="font-weight:bold;">Set Start:</span> Fills the entire board with pegs. Click on one of them to set the starting vacancy (peg missing at the start). Then begin play as usual, or hit Solve.<br /><br /><span style="font-weight:bold;">Back:</span> Take back the last jump (all the way back the start if you like). Very useful if you reach a dead end. You can also back up after pausing a demo or after the demo is finished.<br /><br /><span style="font-weight:bold;">Solve:</span> Solve the puzzle down to one peg (play a demo). You do not have to Restart the game before hitting Solve, it will reset automatically.. When you play a demo, this button changes to Pause, and if you click it the demo will pause, and the button changes to Continue. You can use these controls to halt the solution at any intermediate point. You can even start playing from an intermediate point — however if you play a move manually you cannot continue the demo.<br /><br /><span style="font-weight:bold;">Current Board Menu:</span> Use this to change the size of the board to a triangle with 4 to 24 pegs on a side (10 to 300 holes). If the larger boards do not fit on your screen, set the Board Scale to <span style="font-style:italic;">Small</span>.<br /><br /><span style="font-weight:bold;">Board Scale Menu:</span> For playing the game yourself this is best set to <span style="font-style:italic;">Normal</span>. However to display the larger demos you may want to set it to <span style="font-style:italic;">Small</span>, which shrinks the board by 50% in both directions.<br /><br /><span style="font-weight:bold;">Demo Speed Menu:</span> This sets the time delay between jumps when playing a demo. You can even change this control while a demo is playing, to speed it up or slow it down. <span style="font-style:italic;">Slow</span>, <span style="font-style:italic;">Normal</span>, <span style="font-style:italic;">Fast</span>, <span style="font-style:italic;">Faster</span> and <span style="font-style:italic;">Fastest</span> correspond to delays of 2, 1, 1/2, 1/10 and 0 seconds between jumps. Note that the Fastest delay of zero may not update correctly in all browsers.<br /><br /><div id="gametps"><a class="gmButton" onClick="playtps()">Play Triangular Peg Solitaire</a></div><h3>Solutions:</h3><a href="http://arxiv.org/pdf/math/0703865" target="_blank">How To Solve Triangular Peg Solitaire</a> (PDF, opens in new window)<br /><a href="http://home.comcast.net/~gibell/pegsolitaire/tindex.html">Theory of Triangular Peg Solitaire</a><br /></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com0tag:blogger.com,1999:blog-2800835365312821409.post-26792994709584739162010-11-19T12:18:00.000-08:002012-05-01T16:26:44.594-07:00Mastermind<style type='text/css'>.offsite { border-style: solid; border-width: 2px; border-color: black; display: block; margin-left: auto; margin-right: auto; } </style><script type='text/javascript'>//<![CDATA[ function playmm() { msg = String.fromCharCode(60) + "iframe class='offsite' src='http://www.gamesforthebrain.com/gadgetized/game/guesscolors/' width='530' height='600' scrolling='no'" + String.fromCharCode(62,60) + "/iframe" + String.fromCharCode(62,60) + "div style='text-align:center;'" + String.fromCharCode(62) + "(" + String.fromCharCode(60) + "a href='http://www.gamesforthebrain.com/gadgetized/game/guesscolors/'" + String.fromCharCode(62) + "Iframe source" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + " courtesy of " + String.fromCharCode(60) + "a href='http://www.gamesforthebrain.com/'" + String.fromCharCode(62) + "Games for the Brain" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + ")" + String.fromCharCode(60) + "/div" + String.fromCharCode(62); $("#gamemm").html(msg); }; //]]></script><span id="fullpost">To begin, click the <span style="font-style:italic;">Play Mastermind</span> button below.<br /><br /></span><span style="font-weight:bold;">Object:</span> The object of Mastermind is to try and discover the computer's secret arrangement of 4 colors. On each turn, you guess the color code, and the computer will tell you, via a response in black and white pegs, how close you are the secret arrangement.<br /><br />You win if you correctly guess the code in 9 tries or less.<br /><br /><span id="fullpost">You enter your guess from left to right by clicking on one of the 6 colors next to the board.<br /><br />The response is given in the form of black and white pegs. For every black peg, there is a correct color in the correct position. For every white peg, there is a correct color in an incorrect position. The response pegs do not, however, indicate to which colors and positions they refer.</span><h3><span id="fullpost">Further Controls:</span></h3><span id="fullpost"><span style="font-weight:bold;">Restart:</span> Begins a new game with a new secret 4-color arrangement.<br /><br /><div id="gamemm"><a class="gmButton" onClick="playmm()">Play Mastermind</a></div><h3>Solutions:</h3><a href="http://www.tnelson.demon.co.uk/mastermind/index.html">Mastermind solution</a><br /><a href="http://www.tnelson.demon.co.uk/mastermind/table.html">Mastermind strategy table</a><br /></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com0tag:blogger.com,1999:blog-2800835365312821409.post-85903447050384435452010-11-17T23:53:00.000-08:002012-05-01T16:26:44.611-07:00Sudoku<style type='text/css'>.offsite { border-style: solid; border-width: 2px; border-color: black; display: block; margin-left: auto; margin-right: auto; } </style><script type='text/javascript'>//<![CDATA[ function playsu() { msg = String.fromCharCode(60) + "iframe class='offsite' src='http://www.gamesforthebrain.com/gadgetized/game/sudoku/' width='530' height='575' scrolling='no'" + String.fromCharCode(62,60) + "/iframe" + String.fromCharCode(62,60) + "div style='text-align:center;'" + String.fromCharCode(62) + "(" + String.fromCharCode(60) + "a href='http://www.gamesforthebrain.com/gadgetized/game/sudoku/'" + String.fromCharCode(62) + "Iframe source" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + " courtesy of " + String.fromCharCode(60) + "a href='http://www.gamesforthebrain.com/'" + String.fromCharCode(62) + "Games for the Brain" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + ")" + String.fromCharCode(60) + "/div" + String.fromCharCode(62); $("#gamesu").html(msg); }; //]]></script><span id="fullpost">To begin, click the <span style="font-style:italic;">Play Sudoku</span> button below.<br /><br /></span><span style="font-weight:bold;">Object:</span> The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 sub-grids that compose the grid (also called "boxes", "blocks", "regions", or "sub-squares") contains all of the digits from 1 to 9.<br /><br /><span id="fullpost">To generate a new puzzle, use your browser to reload the page.</span><h3><span id="fullpost">Further Controls:</span></h3><span id="fullpost"><span style="font-weight:bold;">Continue:</span> Click this button to verify your solution and end play. Clicking this same button from the verification screen will take you to a completely new puzzle.<br /><br /><div id="gamesu"><a class="gmButton" onClick="playsu()">Play Sudoku</a></div><h3>Solutions:</h3><a href="http://www.angusj.com/sudoku/hints.php">How To Solve Sudoku Puzzles</a><br /><a href="http://headinside.blogspot.com/2006/04/review-how-to-solve-every-sudoku.html">eBook Recommendation for Solving Sudoku Puzzles</a><br /><h3>More Information:</h3><a href="http://en.wikipedia.org/wiki/Sudoku">Wikipedia: Sudoku</a><br /></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com0tag:blogger.com,1999:blog-2800835365312821409.post-39467518273701582702010-11-16T21:03:00.000-08:002010-11-20T15:16:43.097-08:00Towers of Hanoi<style type='text/css'>.offsite { border-style: solid; border-width: 2px; border-color: black; display: block; margin-left: auto; margin-right: auto; } </style><script type='text/javascript'>//<![CDATA[ function playth() { msg = String.fromCharCode(60) + "iframe class='offsite' src='http://www.jaapsch.net/puzzles/javascript/hanoij.htm' width='330' height='250'" + String.fromCharCode(62,60) + "/iframe" + String.fromCharCode(62,60) + "div style='text-align:center;'" + String.fromCharCode(62) + "(" + String.fromCharCode(60) + "a href='http://www.jaapsch.net/puzzles/javascript/hanoij.htm'" + String.fromCharCode(62) + "Iframe source" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + " courtesy of " + String.fromCharCode(60) + "a href='http://www.jaapsch.net/puzzles/'" + String.fromCharCode(62) + "Jaap's Puzzle Page" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + ")" + String.fromCharCode(60) + "/div" + String.fromCharCode(62); $("#gameth").html(msg); }; //]]></script><span id="fullpost">To begin, click the <span style="font-style:italic;">Play Towers of Hanoi</span> button below.<br /><br /></span><span style="font-weight:bold;">Object:</span> The aim is to pile the disks up on the third peg, with the disks arranged in order, the largest at the bottom.<br /><br />You may only move one disk at a time, and only place it on an empty peg or on a larger disk.<br /><br />To move a disk, just click on the peg it is on and then click on the peg you want to move it to.<br /><h3><span id="fullpost">Further controls:</span></h3><span id="fullpost"><span style="font-weight:bold;">Up/Down:</span> These buttons change the size of the puzzle.<br /><br /><span style="font-weight:bold;">Mix:</span> This button randomly mixes the puzzle up.<br /><br /><span style="font-weight:bold;">Reset:</span> Resets the puzzle to the initial position.<br /><br /><span style="font-weight:bold;">Edit:</span> Allows you to set up any position. The disks are cleared, and then you have to specify on which peg each of the pieces is, starting with the largest.<br /><br /><span style="font-weight:bold;">Play/Back:</span> Solves the puzzle. Each time you click the play button, one move is performed until the puzzle is solved. The backwards play button does the same, but brings. the puzzle closer to the start position.<br /><br /><span style="font-weight:bold;">Forward/Rewind:</span> This is like the play/back buttons, except that the moves will be continuously performed till the end or beginning. Clicking the button more than once speeds it up. To stop, press one of the other buttons.<br /><br /><span style="font-weight:bold;">Help:</span> Shows a help screen with these same instructions.<br /><br /><div id="gameth"><a class="gmButton" onClick="playth()">Play Towers of Hanoi</a></div><h3>Solutions:</h3><a href="http://www.jaapsch.net/puzzles/hanoi.htm">Towers of Hanoi strategy</a><br /><h3>More Information:</h3><a href="http://www.jaapsch.net/puzzles/hanoi.htm">Jaap's Puzzle Page: Tower of Hanoi</a></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com0tag:blogger.com,1999:blog-2800835365312821409.post-2334488501244031812010-11-16T20:27:00.000-08:002010-11-20T14:39:44.942-08:00Lights Out<style type='text/css'>.offsite { border-style: solid; border-width: 2px; border-color: black; display: block; margin-left: auto; margin-right: auto; } </style><script type='text/javascript'>//<![CDATA[ function playlo() { msg = String.fromCharCode(60) + "iframe class='offsite' src='http://www.jaapsch.net/puzzles/javascript/lightjcl.htm' width='270' height='240'" + String.fromCharCode(62,60) + "/iframe" + String.fromCharCode(62,60) + "div style='text-align:center;'" + String.fromCharCode(62) + "(" + String.fromCharCode(60) + "a href='http://www.jaapsch.net/puzzles/javascript/lightjcl.htm'" + String.fromCharCode(62) + "Iframe source" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + " courtesy of " + String.fromCharCode(60) + "a href='http://www.jaapsch.net/puzzles/'" + String.fromCharCode(62) + "Jaap's Puzzle Page" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + ")" + String.fromCharCode(60) + "/div" + String.fromCharCode(62); $("#gamelo").html(msg); }; //]]></script><span id="fullpost">To begin, click the <span style="font-style:italic;">Play Lights Out</span> button below.<br /><br /></span><span style="font-weight:bold;">Object:</span> Click any light to change the state of itself and its non-diagonally adjacent lights. Your goal is to turn all the lights off.<br /><h3><span id="fullpost">Further controls:</span></h3><span id="fullpost"><span style="font-weight:bold;">Mix:</span> Randomly mix up the board.<br /><br /><span style="font-weight:bold;">Edit:</span> Go to edit mode. Allows you to set up a position to solve. Press Edit again when finished.<br /><br /><span style="font-weight:bold;">Solve:</span> Show shortest solution.<br /><br /><span style="font-weight:bold;">Reset:</span> Clear the board.<br /><br /><span style="font-weight:bold;">Puzzle:</span> Select one of the 50 built-in puzzles.<br /><br /><span style="font-weight:bold;">Help:</span> Shows a help screen with these same instructions.<br /><br /><div id="gamelo"><a class="gmButton" onClick="playlo()">Play Lights Out</a></div><h3>Solution:</h3><a href="http://www.jaapsch.net/puzzles/lights.htm#solution">Lights Out strategy</a><br /><h3>More Information:</h3><a href="http://www.jaapsch.net/puzzles/lights.htm">Jaap's Puzzle Page: Lights Out Page</a></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com0tag:blogger.com,1999:blog-2800835365312821409.post-73069666461237602722010-11-16T19:42:00.000-08:002010-11-22T23:43:18.856-08:00Instant Insanity<style type='text/css'>.offsite { border-style: solid; border-width: 2px; border-color: black; display: block; margin-left: auto; margin-right: auto; } </style><script type='text/javascript'>//<![CDATA[ function playii() { msg = String.fromCharCode(60) + "iframe class='offsite' src='http://www.jaapsch.net/puzzles/javascript/insanitj.htm' width='314' height='166'" + String.fromCharCode(62,60) + "/iframe" + String.fromCharCode(62,60) + "div style='text-align:center;'" + String.fromCharCode(62) + "(" + String.fromCharCode(60) + "a href='http://www.jaapsch.net/puzzles/javascript/insanitj.htm'" + String.fromCharCode(62) + "Iframe source" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + " courtesy of " + String.fromCharCode(60) + "a href='http://www.jaapsch.net/puzzles/'" + String.fromCharCode(62) + "Jaap's Puzzle Page" + String.fromCharCode(60) + "/a" + String.fromCharCode(62) + ")" + String.fromCharCode(60) + "/div" + String.fromCharCode(62); $("#gameii").html(msg); }; //]]></script><span id="fullpost">To begin, click the <span style="font-style:italic;">Play Instant Insanity</span> button below.<br /><br /></span><span style="font-weight:bold;">Object:</span> The aim of this puzzle is to arrange the cubes in a row so that each of the four sides show all four different colours.<br /><br /><span id="fullpost">Click on a face of a cube to turn it in that direction.</span><h3><span id="fullpost">Further controls:</span></h3><span id="fullpost"><span style="font-weight:bold;">Mix:</span> This button sets the cubes in a random position.<br /><br /><span style="font-weight:bold;">Edit:</span>Allows you to edit the cubes. Clicking any face of a cube will change its colour. Keep clicking each face until it is the colour you want. Click the edit button again when you are finished.<br /><br /><span style="font-weight:bold;">Solve:</span> Solves the puzzle. It tries all combinations to find a solution. Clicking it again will try find a different solution if there is one, so by repeatedly clicking the button all solutions will be shown.<br /><br /><span style="font-weight:bold;">Reset:</span> Resets to the original puzzle in the solved position.<br /><br /><span style="font-weight:bold;">Help:</span> Shows a help screen with these same instructions.<br /><br /><div id="gameii"><a class="gmButton" onClick="playii()">Play Instant Insanity</a></div><h3>Solutions:</h3><a href="http://www.maa.org/mathland/mathtrek_8_9_99.html">Instant Insanity solution 1</a><br /><a href="http://www.jaapsch.net/puzzles/insanity.htm">Instant Insanity solution 2</a><br /><h3>More Information:</h3><a href="http://headinside.blogspot.com/2010/08/frank-armbrusters-instant-insanity.html">Frank Armbruster's Instant Insanity</a><br /><a href="http://www.jaapsch.net/puzzles/insanity.htm">Jaap's Puzzle Page: Instant Insanity / Buvos Golyok / Drive Ya Crazy</a></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com0tag:blogger.com,1999:blog-2800835365312821409.post-74004440484349552972010-11-07T12:00:00.001-08:002010-11-16T17:52:15.644-08:00Timed Quiz Generator<style type='text/css'>#code { width: 520px; height: 60px; } </style><script type='text/javascript'>//<![CDATA[ $(function(){ $('#code').autoResizable({ maxHeight: 1000 }); $("input#vidtutbutton").bind("click", function(e) { $("#vidtutorial").toggle(); }); $(window).load(function() { qzslv = new Array(); stp = 0; em = 0; loc = 0; contnts = ""; }); }); function addToList() { textFieldValue = document.getElementById("alt0"); textFieldValue = textFieldValue.value; if (textFieldValue != "") { qzslv[stp] = new Array(); for (i=0;i<=6;i++) { others = document.getElementById("alt"+i); qzslv[stp][i] = others.value; } textAreaToChange = document.getElementById("anslist"); contnts = contnts + qzslv[stp][0] + ": "; for (i=1;i<=6;i++) { if (qzslv[stp][i] != "") { contnts = contnts + "[" + qzslv[stp][i] + "] " } } contnts = contnts + "\r"; textAreaToChange.value = contnts; stp = stp + 1; if (stp == 1) { btns = document.getElementById("edtng"); btns.disabled = false; } if (stp >= 2) { btns = document.getElementById("primsg"); btns.disabled = false; btns = document.getElementById("pritxt"); btns.readOnly = false; btns = document.getElementById("prilnk"); btns.readOnly = false; btns = document.getElementById("primenu"); btns.disabled = false; btns.length = stp + 1; for (i=0;i<=stp;i++) { btns.options[i].text=i; } btns.selectedIndex = 0; actSec(); } clrAns(); } else { alert("Please enter a primary answer."); } } function clrAns() { for (i=0;i<=6;i++) { others = document.getElementById("alt"+i); others.value = ""; } textAreaToChange = document.getElementById("code"); textAreaToChange.value = ""; } function emptyList() { if (stp > 0) { ms = confirm("Are you sure you want to delete all your answers?"); if (ms == true) { contnts = ""; stp = stp - 1; for (i=0;i<=stp;i++) { for (j=0;j<=6;j++) { qzslv[i][j] = ""; } } stp = 0; textAreaToChange = document.getElementById("anslist"); textAreaToChange.value = contnts; em = 0; btns = document.getElementById("edtng"); btns.checked = false; btns.disabled = true; btns = document.getElementById("clrlist"); btns.disabled = true; btns = document.getElementById("ArUp"); btns.disabled = true; btns = document.getElementById("ArDn"); btns.disabled = true; btns = document.getElementById("EdAr"); btns.disabled = true; btns = document.getElementById("snip"); btns.disabled = true; btns = document.getElementById("addans"); btns.disabled = false; btns = document.getElementById("clrans"); btns.disabled = false; btns = document.getElementById("primsg"); btns.checked = false; btns.disabled = true; btns = document.getElementById("primenu"); btns.length = 1; btns.options[0].text=0; btns.selectedIndex = 0; btns.disabled = true; btns = document.getElementById("pritxt"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("prilnk"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("secmsg"); btns.checked = false; btns.disabled = true; btns = document.getElementById("sectxt"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("seclnk"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("nwwn"); btns.checked = false; btns.disabled = true; clrAns(); } } } function edtmode() { if (em == 0) { em = 1; btns = document.getElementById("clrlist"); btns.disabled = false; btns = document.getElementById("ArUp"); btns.disabled = true; if (stp == 1) { btns = document.getElementById("ArDn"); btns.disabled = true; } else { btns = document.getElementById("ArDn"); btns.disabled = false; } btns = document.getElementById("EdAr"); btns.disabled = false; btns = document.getElementById("snip"); btns.disabled = false; btns = document.getElementById("addans"); btns.disabled = true; btns = document.getElementById("clrans"); btns.disabled = true; clrAns(); mkArwLst(); } else { em = 0; btns = document.getElementById("clrlist"); btns.disabled = true; btns = document.getElementById("ArUp"); btns.disabled = true; btns = document.getElementById("ArDn"); btns.disabled = true; btns = document.getElementById("EdAr"); btns.disabled = true; btns = document.getElementById("snip"); btns.disabled = true; btns = document.getElementById("addans"); btns.disabled = false; btns = document.getElementById("clrans"); btns.disabled = false; btns = document.getElementById("rtnans"); btns.disabled = true; btns = document.getElementById("cncledt"); btns.disabled = true; clrAns(); rstrLst(); } } function rstrLst() { textAreaToChange = document.getElementById("anslist"); textAreaToChange.value = contnts; } function mkArwLst() { arrw = 0; loc = 0; arwedt = ""; q = stp - 1; for (i=0;i<=q;i++) { if (i == 0) { arwedt = "--" + String.fromCharCode(62); } arwedt = arwedt + qzslv[i][0] + ": "; for (j=1;j<=6;j++) { if (qzslv[i][j] != "") { arwedt = arwedt + "[" + qzslv[i][j] + "] "; } } arwedt = arwedt + "\r"; } btns = document.getElementById("ArUp"); btns.disabled = true; if (stp == 1) { btns = document.getElementById("ArDn"); btns.disabled = true; } textAreaToChange = document.getElementById("anslist"); textAreaToChange.value = arwedt; } function arwDn() { loc = loc + 1; if (loc == (stp - 1)) { btns = document.getElementById("ArDn"); btns.disabled = true; } if (loc != 0) { btns = document.getElementById("ArUp"); btns.disabled = false; } arwedt = ""; q = stp - 1; for (i=0;i<=q;i++) { if (i == loc) { arwedt = arwedt + "--" + String.fromCharCode(62); } arwedt = arwedt + qzslv[i][0] + ": "; for (j=1;j<=6;j++) { if (qzslv[i][j] != "") { arwedt = arwedt + "[" + qzslv[i][j] + "] "; } } arwedt = arwedt + "\r"; } textAreaToChange = document.getElementById("anslist"); textAreaToChange.value = arwedt; } function arwUp() { loc = loc - 1; if (loc == 0) { btns = document.getElementById("ArUp"); btns.disabled = true; } if (loc < (stp - 1)) { btns = document.getElementById("ArDn"); btns.disabled = false; } arwedt = ""; q = stp - 1; for (i=0;i<=q;i++) { if (i == loc) { arwedt = arwedt + "--" + String.fromCharCode(62); } arwedt = arwedt + qzslv[i][0] + ": "; for (j=1;j<=6;j++) { if (qzslv[i][j] != "") { arwedt = arwedt + "[" + qzslv[i][j] + "] "; } } arwedt = arwedt + "\r"; } textAreaToChange = document.getElementById("anslist"); textAreaToChange.value = arwedt; } function dltitm() { ms = confirm("Are you sure you want to delete this answer and its alternatives?"); if (ms == true) { for (i=0;i<=6;i++) { qzslv[loc][i] = ""; } if (loc != (stp - 1)) { for (i=loc;i<=(stp - 2);i++) { for (j=0;j<=6;j++) { qzslv[i][j] = qzslv[i+1][j]; qzslv[i+1][j] = ""; } } } stp = stp - 1; loc = 0; contnts = ""; arwedt = ""; for (i=0;i<=(stp - 1);i++) { contnts = contnts + qzslv[i][0] + ": "; if (i == loc) { arwedt = arwedt + "--" + String.fromCharCode(62) ; } arwedt = arwedt + qzslv[i][0] + ": "; for (j=1;j<=6;j++) { if (qzslv[i][j] != "") { contnts = contnts + "[" + qzslv[i][j] + "] "; arwedt = arwedt + "[" + qzslv[i][j] + "] "; } } contnts = contnts + "\r"; arwedt = arwedt + "\r"; } textAreaToChange = document.getElementById("anslist"); textAreaToChange.value = arwedt; btns = document.getElementById("ArUp"); btns.disabled = true; btns = document.getElementById("primenu"); btns.length = stp + 1; for (i=0;i<=stp;i++) { btns.options[i].text=i; } btns.selectedIndex = 0; if (stp > 1) { btns = document.getElementById("ArDn"); btns.disabled = false; } else { btns = document.getElementById("ArDn"); btns.disabled = true; } if (stp < 2) { btns = document.getElementById("primsg"); btns.checked = false; btns.disabled = true; btns = document.getElementById("primenu"); btns.length = 1; btns.options[0].text=0; btns.selectedIndex = 0; btns.disabled = true; btns = document.getElementById("pritxt"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("prilnk"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("secmsg"); btns.checked = false; btns.disabled = true; btns = document.getElementById("sectxt"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("seclnk"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("nwwn"); btns.checked = false; btns.disabled = true; } if (stp == 0) { em = 0; btns = document.getElementById("edtng"); btns.checked = false; btns.disabled = true; btns = document.getElementById("clrlist"); btns.disabled = true; btns = document.getElementById("ArUp"); btns.disabled = true; btns = document.getElementById("ArDn"); btns.disabled = true; btns = document.getElementById("EdAr"); btns.disabled = true; btns = document.getElementById("snip"); btns.disabled = true; btns = document.getElementById("addans"); btns.disabled = false; btns = document.getElementById("clrans"); btns.disabled = false; btns = document.getElementById("primsg"); btns.checked = false; btns.disabled = true; btns = document.getElementById("primenu"); btns.length = 1; btns.options[0].text=0; btns.selectedIndex = 0; btns.disabled = true; btns = document.getElementById("pritxt"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("prilnk"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("secmsg"); btns.checked = false; btns.disabled = true; btns = document.getElementById("sectxt"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("seclnk"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("nwwn"); btns.checked = false; btns.disabled = true; clrAns(); } } } function edtAns() { btns = document.getElementById("EdAr"); btns.disabled = true; btns = document.getElementById("snip"); btns.disabled = true; btns = document.getElementById("clrlist"); btns.disabled = true; btns = document.getElementById("ArUp"); btns.disabled = true; btns = document.getElementById("ArDn"); btns.disabled = true; btns = document.getElementById("rtnans"); btns.disabled = false; btns = document.getElementById("cncledt"); btns.disabled = false; for (i=0;i<=6;i++) { others = document.getElementById("alt"+i); others.value = qzslv[loc][i]; } arwedt = ""; q = stp - 1; for (i=0;i<=q;i++) { if (i == loc) { arwedt = arwedt + "--" + String.fromCharCode(62) + "**editing**"; } else { arwedt = arwedt + qzslv[i][0] + ": "; for (j=1;j<=6;j++) { if (qzslv[i][j] != "") { arwedt = arwedt + "[" + qzslv[i][j] + "] "; } } } arwedt = arwedt + "\r"; } textAreaToChange = document.getElementById("anslist"); textAreaToChange.value = arwedt; } function retToList() { textFieldValue = document.getElementById("alt0"); textFieldValue = textFieldValue.value; if (textFieldValue != "") { for (i=0;i<=6;i++) { others = document.getElementById("alt"+i); qzslv[loc][i] = others.value; } contnts = ""; arwedt = ""; for (i=0;i<=(stp - 1);i++) { contnts = contnts + qzslv[i][0] + ": "; if (i == loc) { arwedt = arwedt + "--" + String.fromCharCode(62) ; } arwedt = arwedt + qzslv[i][0] + ": "; for (j=1;j<=6;j++) { if (qzslv[i][j] != "") { contnts = contnts + "[" + qzslv[i][j] + "] "; arwedt = arwedt + "[" + qzslv[i][j] + "] "; } } contnts = contnts + "\r"; arwedt = arwedt + "\r"; } textAreaToChange = document.getElementById("anslist"); textAreaToChange.value = arwedt; clrAns(); btns = document.getElementById("EdAr"); btns.disabled = false; btns = document.getElementById("snip"); btns.disabled = false; btns = document.getElementById("clrlist"); btns.disabled = false; btns = document.getElementById("ArUp"); btns.disabled = false; btns = document.getElementById("ArDn"); btns.disabled = false; if (loc == 0) { btns = document.getElementById("ArUp"); btns.disabled = true; } if (loc == (stp-1)) { btns = document.getElementById("ArDn"); btns.disabled = true; } btns = document.getElementById("rtnans"); btns.disabled = true; btns = document.getElementById("cncledt"); btns.disabled = true; } else { alert("Please enter a primary answer."); } } function cnclEdit() { arwedt = ""; for (i=0;i<=(stp - 1);i++) { if (i == loc) { arwedt = arwedt + "--" + String.fromCharCode(62); } arwedt = arwedt + qzslv[i][0] + ": "; for (j=1;j<=6;j++) { if (qzslv[i][j] != "") { arwedt = arwedt + "[" + qzslv[i][j] + "] "; } } arwedt = arwedt + "\r"; } textAreaToChange = document.getElementById("anslist"); textAreaToChange.value = arwedt; clrAns(); btns = document.getElementById("EdAr"); btns.disabled = false; btns = document.getElementById("snip"); btns.disabled = false; btns = document.getElementById("clrlist"); btns.disabled = false; btns = document.getElementById("ArUp"); btns.disabled = false; btns = document.getElementById("ArDn"); btns.disabled = false; if (loc == 0) { btns = document.getElementById("ArUp"); btns.disabled = true; } if (loc == (stp-1)) { btns = document.getElementById("ArDn"); btns.disabled = true; } btns = document.getElementById("rtnans"); btns.disabled = true; btns = document.getElementById("cncledt"); btns.disabled = true; } function actSec() { btns = document.getElementById("primenu"); if (btns.selectedIndex != 0) { btns = document.getElementById("secmsg"); btns.checked = false; btns.disabled = false; btns = document.getElementById("sectxt"); btns.readOnly = false; btns = document.getElementById("seclnk"); btns.readOnly = false; } else { btns = document.getElementById("secmsg"); btns.checked = false; btns.disabled = true; btns = document.getElementById("sectxt"); btns.value = ""; btns.readOnly = true; btns = document.getElementById("seclnk"); btns.value = ""; btns.readOnly = true; } } function priClk() { btns = document.getElementById("primsg"); fld = document.getElementById("primenu"); if (btns.checked == false) { cng = document.getElementById("nwwn"); cng.checked = false; cng.disabled = true; } else { cng = document.getElementById("nwwn"); cng.disabled = false; } if ((btns.checked == false) && (fld.selectedIndex != 0)) { cng = document.getElementById("secmsg"); cng.checked = false; } } function secClk() { btns = document.getElementById("secmsg"); if (btns.checked == true) { cng = document.getElementById("primsg"); cng.checked = true; } } function makeCode() { hlt = 0; clrAns(); tpc = document.getElementById("topic"); tpc = tpc.value; tps = document.getElementById("topicone"); tps = tps.value; if ((tpc == "") || (tps == "")) { alert("Please enter both a plural and singular quiz topic."); hlt = 1; } mns = document.getElementById("minmenu"); mns = mns.options[mns.selectedIndex].text; scs = document.getElementById("secmenu"); scs = scs.options[scs.selectedIndex].text; if ((mns == "minutes...") || (scs == "seconds...")) { alert("Please specify a time."); hlt = 1; } if (stp < 2) { alert("Please enter at least two answers."); hlt = 1; } if (hlt == 0) { pgcd = ""; pgcd = String.fromCharCode(60) + "head" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,60) + "title" + String.fromCharCode(62) + tpc + " Quiz" + String.fromCharCode(60) + "/title" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,60) + "meta content='trivia timed quiz " + tpc.toLowerCase() + "' name='keywords'/" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,60) + "style type='text/css'" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9) + "#tmr {" + "\r"; pgcd+=String.fromCharCode(9,9) + "border:none;" + "\r"; pgcd+=String.fromCharCode(9,9) + "text-align:center;" + "\r"; pgcd+=String.fromCharCode(9,9) + "font-family:verdana;" + "\r"; pgcd+=String.fromCharCode(9,9) + "font-size:50pt;" + "\r"; pgcd+=String.fromCharCode(9,9) + "font-weight:bold;" + "\r"; pgcd+=String.fromCharCode(9,9) + "border-right-color:#FFFFFF;" + "\r"; pgcd+=String.fromCharCode(9,9) + "width:100%;" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r"; pgcd+=String.fromCharCode(9,60) + "/style" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(60) + "/head" + String.fromCharCode(62) + "\r" + "\r"; pgcd+=String.fromCharCode(60) + "body" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,60) + "script type=" + String.fromCharCode(34) + "text/javascript" + String.fromCharCode(34,62) + "\r"; pgcd+=String.fromCharCode(9,60) + "!--" + "\r"; pgcd+=String.fromCharCode(9) + "var mins;" + "\r" + String.fromCharCode(9) + "var secs;" + "\r" + String.fromCharCode(9) + "var max;" + "\r" + String.fromCharCode(9) + "var begclo;" + "\r" + "\r"; mnt = document.getElementById("minmenu"); mnt = mnt.selectedIndex; pgcd+=String.fromCharCode(9) + "function cd() {" + "\r" + String.fromCharCode(9,9) + "begclo = 0;" + "\r" + String.fromCharCode(9,9) + "mins = 1 * m(" + String.fromCharCode(34) + mnt + String.fromCharCode(34) + ");" + "\r"; scd = document.getElementById("secmenu"); scd = scd.selectedIndex; scd = ((scd - 1) * 15) + 1; pgcd+=String.fromCharCode(9,9) + "secs = 0 + s(" + String.fromCharCode(34) + ":"; if (scd == 1) { pgcd+="0"; } pgcd+=scd + String.fromCharCode(34) + ");" + "\r"; pgcd+=String.fromCharCode(9,9) + "max = " + stp + ";" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r" + "\r"; pgcd+=String.fromCharCode(9) + "function m(obj) {" + "\r"; pgcd+=String.fromCharCode(9,9) + "for (var i = 0; i < obj.length; i++) {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "if (obj.substring(i, i + 1) == " + String.fromCharCode(34) + ":" + String.fromCharCode(34) + ") {" + "\r"; pgcd+=String.fromCharCode(9,9,9,9) + "break;" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "return(obj.substring(0, i));" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r" + "\r"; pgcd+=String.fromCharCode(9) + "function s(obj) {" + "\r"; pgcd+=String.fromCharCode(9,9) + "for (var i = 0; i < obj.length; i++) {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "if (obj.substring(i, i + 1) == " + String.fromCharCode(34) + ":" + String.fromCharCode(34) + ") {" + "\r"; pgcd+=String.fromCharCode(9,9,9,9) + "break;" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "return(obj.substring(i + 1, obj.length));" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r" + "\r"; pgcd+=String.fromCharCode(9) + "function dis(mins,secs) {" + "\r"; pgcd+=String.fromCharCode(9,9) + "var disp;" + "\r"; pgcd+=String.fromCharCode(9,9) + "if (mins <= 9) {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "disp = " + String.fromCharCode(34) + " 0" + String.fromCharCode(34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "else {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "disp = " + String.fromCharCode(34) + " " + String.fromCharCode(34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "disp+= mins + " + String.fromCharCode(34) + ":" + String.fromCharCode(34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9) + "if (secs <= 9) {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "disp+= " + String.fromCharCode(34) + "0" + String.fromCharCode(34) + " + secs;" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "else {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "disp+= secs;" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "return(disp);" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r" + "\r"; pgcd+=String.fromCharCode(9) + "function timeIsUp() {" + "\r"; pgcd+=String.fromCharCode(9,9) + "mins = 0;" + "\r"; pgcd+=String.fromCharCode(9,9) + "secs = 1;" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r" + "\r"; pgcd+=String.fromCharCode(9) + "function redo() {" + "\r"; pgcd+=String.fromCharCode(9,9) + "if (count == max) return;" + "\r"; pgcd+=String.fromCharCode(9,9) + "secs--;" + "\r"; pgcd+=String.fromCharCode(9,9) + "if (secs == -1) {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "secs = 59;" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "mins--;" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "document.cd.disp.value = dis(mins,secs);" + "\r"; pgcd+=String.fromCharCode(9,9) + "if ((mins == 0) && (secs == 0)) {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "window.alert(" + String.fromCharCode(34) + "Time's up! Let's see how you did." + String.fromCharCode(34) + ");" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "showMissed();" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "else {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "cd = setTimeout(" + String.fromCharCode(34) + "redo()" + String.fromCharCode(34) + ",1000);" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r" + "\r"; pgcd+=String.fromCharCode(9) + "function init() {" + "\r"; pgcd+=String.fromCharCode(9,9) + "cd();" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r" + String.fromCharCode(9) + "window.onload = init;" + "\r" + "\r"; pgcd+=String.fromCharCode(9) + "var count=0;" + "\r" + String.fromCharCode(9) + "var found=new Array();" + "\r"; pgcd+=String.fromCharCode(9) + "var hxcd=new Array("; for (i=0;i<=(stp - 1);i++) { rq = obsSt(qzslv[i][0]); pgcd+=String.fromCharCode(34) + rq + String.fromCharCode(34); if (i < (stp - 1)) { pgcd+=","; } } pgcd+=");" + "\r" + "\r"; pgcd+=String.fromCharCode(9) + "function checkAnsrs(fld) {" + "\r"; pgcd+=String.fromCharCode(9,9) + "if (begclo==0) {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "begclo = 1;" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "document.getElementById(" + String.fromCharCode(34) + "remain" + String.fromCharCode(34) + ").innerHTML=" + String.fromCharCode(34,60) + "B" + String.fromCharCode(62) + stp + " " + tpc + " to go" + String.fromCharCode(60) + "/B" + String.fromCharCode(62,34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "redo();" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "if (fld.value.length > 1) {" + "\r"; for (i=0;i<stp;i++) { for (j=1;j<=6;j++) { if (qzslv[i][j] != "") { rq = obsSt(qzslv[i][j].toLowerCase()); pgcd+=String.fromCharCode(9,9,9) + "if (fld.value.toLowerCase()==" + String.fromCharCode(34) + rq + String.fromCharCode(34) + ") {" + "\r"; rq = obsSt(qzslv[i][0]); pgcd+=String.fromCharCode(9,9,9,9) + "fld.value=" + String.fromCharCode(34) + rq + String.fromCharCode(34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "}" + "\r"; } } } pgcd+=String.fromCharCode(9,9,9) + "for (var i=0;i<hxcd.length;i++) {" + "\r"; pgcd+=String.fromCharCode(9,9,9,9) + "if (fld.value.toLowerCase()==hxcd[i].toLowerCase()) {" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "found[found.length]=hxcd[i];" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "found.sort();" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "hxcd.splice(i,1);" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "fld.value=" + String.fromCharCode(34,34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "count++;" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "msg=" + String.fromCharCode(34,34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "for (var x=0;x<found.length;x++) {" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9,9) + "msg+=found[x]+" + String.fromCharCode(34) + ", " + String.fromCharCode(34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9,9) + "if ((x+1)%5 == 0) msg+=" + String.fromCharCode(34,60) + "BR" + String.fromCharCode(62,34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "document.getElementById(" + String.fromCharCode(34) + "found" + String.fromCharCode(34) + ").innerHTML=msg;" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "remainmsg=" + String.fromCharCode(34) + " " + tpc + " to go" + String.fromCharCode(34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "if (count == (max-1)) remainmsg=" + String.fromCharCode(34) + " " + tps + " to go" + String.fromCharCode(34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "document.getElementById(" + String.fromCharCode(34) + "remain" + String.fromCharCode(34) + ").innerHTML=" + String.fromCharCode(34,60) + "B" + String.fromCharCode(62,34) + "+(max-count)+remainmsg+" + String.fromCharCode(34,60) + "/B" + String.fromCharCode(62,34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9) + "if (count == max) {" + "\r"; pgcd+=String.fromCharCode(9,9,9,9,9,9) + "window.alert(" + String.fromCharCode(34) + "You did it!" + String.fromCharCode(34) + ");" + "\r"; btns = document.getElementById("primsg"); cng = document.getElementById("pritxt"); if ((btns.checked == true) && (cng.value != "")) { pgcd+=String.fromCharCode(9,9,9,9,9,9) + "resultmessage();" + "\r"; } pgcd+=String.fromCharCode(9,9,9,9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9,9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "else {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "if (fld.value == " + String.fromCharCode(34) + " " + String.fromCharCode(34) + ") fld.value=" + String.fromCharCode(34,34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r" + "\r"; pgcd+=String.fromCharCode(9) + "function showMissed() {" + "\r"; pgcd+=String.fromCharCode(9,9) + "msg=" + String.fromCharCode(34,34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9) + "msg+='" + String.fromCharCode(60) + "BR" + String.fromCharCode(62,60) + "FONT COLOR=RED" + String.fromCharCode(62,60) + "B" + String.fromCharCode(62) + "You forgot: " + String.fromCharCode(60) + "/B" + String.fromCharCode(62) + "';" + "\r"; pgcd+=String.fromCharCode(9,9) + "for (x=0;x<hxcd.length;x++) {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "msg+=hxcd[x]+" + String.fromCharCode(34) + ", " + String.fromCharCode(34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "if ((x+1)%5 == 0) msg+=" + String.fromCharCode(34,60) + "BR" + String.fromCharCode(62,34) + ";" + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pgcd+=String.fromCharCode(9,9) + "msg+='" + String.fromCharCode(60) + "/FONT" + String.fromCharCode(62,60) + "BR" + String.fromCharCode(62) + "';" + "\r"; pgcd+=String.fromCharCode(9,9) + "document.getElementById(" + String.fromCharCode(34) + "missing" + String.fromCharCode(34) + ").innerHTML=msg;" + "\r"; btns = document.getElementById("primsg"); cng = document.getElementById("pritxt"); if ((btns.checked == true) && (cng.value != "")) { pgcd+=String.fromCharCode(9,9) + "resultmessage();" + "\r"; } pgcd+=String.fromCharCode(9) + "}" + "\r" + "\r"; btns = document.getElementById("primsg"); cng = document.getElementById("pritxt"); if ((btns.checked == true) && (cng.value != "")) { pgcd+=String.fromCharCode(9) + "function resultmessage() {" + "\r"; pst = document.getElementById("primenu"); pgcd+=String.fromCharCode(9,9) + "msg = " + String.fromCharCode(34,34,59) + "\r"; pgcd+=String.fromCharCode(9,9) + "if (count >= " + pst.selectedIndex + ") {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "msg = " + String.fromCharCode(34,60) + "FONT COLOR=BLACK" + String.fromCharCode(62); pst = document.getElementById("prilnk"); if (pst.value != "") { opnl = document.getElementById("nwwn"); pgcd+=String.fromCharCode(60) + "A HREF=" + String.fromCharCode(34) + " + String.fromCharCode(34) + " + String.fromCharCode(34) + pst.value + String.fromCharCode(34) + " + String.fromCharCode(34) + " + String.fromCharCode(34); if (opnl.checked == true) { pgcd+=" TARGET=" + String.fromCharCode(34) + " + String.fromCharCode(34) + " + String.fromCharCode(34,95) + "blank" + String.fromCharCode(34) + " + String.fromCharCode(34) + " + String.fromCharCode(34); } pgcd+=String.fromCharCode(62); } pgcd+=cng.value; if (pst.value != "") { pgcd+=String.fromCharCode(60) + "/A" + String.fromCharCode(62); } pgcd+=String.fromCharCode(60) + "/FONT" + String.fromCharCode(62,34,59) + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; pst = document.getElementById("secmsg"); tps = document.getElementById("sectxt"); if ((pst.checked == true) && (tps.value != "")) { pgcd+=String.fromCharCode(9,9) + "else {" + "\r"; pgcd+=String.fromCharCode(9,9,9) + "msg = " + String.fromCharCode(34,60) + "FONT COLOR=BLACK" + String.fromCharCode(62); tsp = document.getElementById("seclnk"); if (tsp.value != "") { pgcd+=String.fromCharCode(60) + "A HREF=" + String.fromCharCode(34) + " + String.fromCharCode(34) + " + String.fromCharCode(34) + tsp.value + String.fromCharCode(34) + " + String.fromCharCode(34) + " + String.fromCharCode(34); if (opnl.checked == true) { pgcd+=" TARGET=" + String.fromCharCode(34) + " + String.fromCharCode(34) + " + String.fromCharCode(34,95) + "blank" + String.fromCharCode(34) + " + String.fromCharCode(34) + " + String.fromCharCode(34); } pgcd+=String.fromCharCode(62); } pgcd+=tps.value; if (tsp.value != "") { pgcd+=String.fromCharCode(60) + "/A" + String.fromCharCode(62); } pgcd+=String.fromCharCode(60) + "/FONT" + String.fromCharCode(62,34,59) + "\r"; pgcd+=String.fromCharCode(9,9) + "}" + "\r"; } pgcd+=String.fromCharCode(9,9) + "document.getElementById(" + String.fromCharCode(34) + "rsltmsg" + String.fromCharCode(34) + ").innerHTML=msg;" + "\r"; pgcd+=String.fromCharCode(9) + "}" + "\r"; } pgcd+=String.fromCharCode(9) + "//--" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,60) + "/script" + String.fromCharCode(62) + "\r" + "\r"; pgcd+=String.fromCharCode(9,60) + "P" + String.fromCharCode(62,60) + "H1" + String.fromCharCode(62,60) + "center" + String.fromCharCode(62) + "How many of the " + tpc + " can you name in " + mnt; scd = document.getElementById("secmenu"); scd = scd.selectedIndex; if (scd > 1) { scd = (scd - 1) * 25 if (scd == 50) { scd = 5; } pgcd+="." + scd; } pgcd+=" minutes?" + String.fromCharCode(60) + "/center" + String.fromCharCode(62,60) + "/H1" + String.fromCharCode(62,60) + "/P" + String.fromCharCode(62) + "\r" + "\r"; pgcd+=String.fromCharCode(9,60) + "form name=" + String.fromCharCode(34) + "cd" + String.fromCharCode(34,62) + "\r"; pgcd+=String.fromCharCode(9,9,60) + "input id=" + String.fromCharCode(34) + "tmr" + String.fromCharCode(34) + " readonly=" + String.fromCharCode(34) + "true" + String.fromCharCode(34) + " type=" + String.fromCharCode(34) + "text" + String.fromCharCode(34) + " value=" + String.fromCharCode(34); scd = document.getElementById("secmenu"); scd = scd.selectedIndex; scd = (scd - 1) * 15 if (mnt < 10) { pgcd+="0"; } pgcd+=mnt + ":"; if (scd == 0) { pgcd+="00"; } else { pgcd+=scd; } pgcd+=String.fromCharCode(34) + " border=" + String.fromCharCode(34) + "0" + String.fromCharCode(34) + " name=" + String.fromCharCode(34) + "disp" + String.fromCharCode(34,62) + "\r"; pgcd+=String.fromCharCode(9,60) + "/form" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,60) + "center" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,60) + "table" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,60) + "tr" + String.fromCharCode(62,60) + "td align=" + String.fromCharCode(34) + "center" + String.fromCharCode(34,62) + "\r"; pgcd+=String.fromCharCode(9,9,9,60) + "div id=" + String.fromCharCode(34) + "remain" + String.fromCharCode(34,62,60) + "B" + String.fromCharCode(62) + "To start the clock, begin typing in the box below." + String.fromCharCode(60) + "/B" + String.fromCharCode(62,60) + "/div" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,9,60) + "input type=" + String.fromCharCode(34) + "text" + String.fromCharCode(34) + " onKeyUp=" + String.fromCharCode(34) + "checkAnsrs(this);" + String.fromCharCode(34) + " name=" + String.fromCharCode(34) + "inpt" + String.fromCharCode(34,62,60) + "BR" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,9,60) + "input type=" + String.fromCharCode(34) + "button" + String.fromCharCode(34) + " value=" + String.fromCharCode(34) + "Give up?" + String.fromCharCode(34) + " onclick=" + String.fromCharCode(34) + "timeIsUp()" + String.fromCharCode(34) + " name=" + String.fromCharCode(34) + "giveup" + String.fromCharCode(34,62,60) + "BR" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,60) + "/td" + String.fromCharCode(62,60) + "/tr" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,60) + "tr" + String.fromCharCode(62,60) + "td align=" + String.fromCharCode(34) + "center" + String.fromCharCode(34,62) + "\r"; pgcd+=String.fromCharCode(9,9,9,60) + "B" + String.fromCharCode(62) + "Named so far:" + String.fromCharCode(60) + "/B" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,9,60) + "div id=" + String.fromCharCode(34) + "found" + String.fromCharCode(34,62) + "None" + String.fromCharCode(60) + "/div" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,9,60) + "P" + String.fromCharCode(62,38) + "nbsp;" + String.fromCharCode(60) + "/P" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,9,60) + "P" + String.fromCharCode(62,60) + "div id=" + String.fromCharCode(34) + "missing" + String.fromCharCode(34,62,38) + "nbsp;" + String.fromCharCode(60) + "/div" + String.fromCharCode(62,60) + "/P" + String.fromCharCode(62) + "\r"; btns = document.getElementById("primsg"); cng = document.getElementById("pritxt"); if ((btns.checked == true) && (cng.value != "")) { pgcd+=String.fromCharCode(9,9,9,60) + "P" + String.fromCharCode(62,38) + "nbsp;" + String.fromCharCode(60) + "/P" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,9,60) + "P" + String.fromCharCode(62,38) + "nbsp;" + String.fromCharCode(60) + "/P" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,9,9,60) + "P" + String.fromCharCode(62,60) + "div id=" + String.fromCharCode(34) + "rsltmsg" + String.fromCharCode(34,62,38) + "nbsp;" + String.fromCharCode(60) + "/div" + String.fromCharCode(62,60) + "/P" + String.fromCharCode(62) + "\r"; } pgcd+=String.fromCharCode(9,9,60) + "/td" + String.fromCharCode(62,60) + "/tr" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,60) + "/table" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(9,60) + "/center" + String.fromCharCode(62) + "\r"; pgcd+=String.fromCharCode(60) + "/body" + String.fromCharCode(62); textAreaToChange = document.getElementById("code"); textAreaToChange.value = pgcd; $('#code').focus(); } } function obsSt(lts) { trv = ""; for (k=0;k<(lts.length);k++) { trv = trv + String.fromCharCode(92) + "x" + toHex(lts.charCodeAt(k)); } return(trv); } function enHex(dgt) { return("0123456789ABCDEF".substring(dgt,dgt+1)); } function toHex(nmb) { return (enHex((0x0000f0 & nmb) >> 4) + enHex((0x00000f & nmb) >> 0)); } function exdata() { goinout = ""; goinout = String.fromCharCode(208); dat = document.getElementById("topic"); dat = dat.value; goinout+=dat + String.fromCharCode(208); dat = document.getElementById("topicone"); dat = dat.value; goinout+=dat + String.fromCharCode(208); textAreaToChange = document.getElementById("code"); textAreaToChange.value = goinout; } //]]></script><h2>Make Your Own Timed Quiz</h2>Have you ever wanted to make your own custom <span style="font-style:italic;"><a href="http://headinside.blogspot.com/2008/03/how-many-xs-can-you-name-in-y-minutes.html">How Many Xs Can You Name In Y Minutes?</a></span>-style quiz for your website, but didn't know how? Using this timed quiz creator it's easy!<br /><br /><span id="fullpost">To learn how to use this timed quiz generator, there are three tutorials available:<br /><br /><a href="http://headinside.blogspot.com/2008/08/make-your-own-timed-quizzes.html">TEXT: Timed Quiz Generator Tutorial</a> (excluding Final Message Options)<br /><br /><a href="http://headinside.blogspot.com/2008/08/timed-quiz-generator-final-message.html">TEXT: Final Message Options Tutorial</a><br /><br /><a href="http://headinside.blogspot.com/2009/06/timed-quiz-generator-video-tutorial.html">VIDEO: Full Tutorial</a> (Also accessible via the video tutorial button below)<br /> <br />Simply enter the topic of the quiz, in both plural and singular form (e.g., <span style="font-style:italic;">Simpsons</span> and <span style="font-style:italic;">Simpson</span>), and select a time in minutes and seconds. Enter a main answer (e.g., <span style="font-style:italic;">Grandpa Simpson</span>), and, optionally, up to 6 acceptable alternatives (e.g., <span style="font-style:italic;">Abe</span>, <span style="font-style:italic;">Abraham Simpson</span>), then click the <span style="font-style:italic;">Add answer/alternatives to list</span> button. You may add as many answers and alternatives as needed this way, but <span style="font-style:italic;"><span style="font-weight:bold;">you must have at least two main answers, and all your answers and alternatives must be at least two letters long</span></span> (otherwise your quiz won't function correctly). When you're finished adding answers and alternatives, click the <span style="font-style:italic;">Generate quiz code</span> button to get the HTML/CSS/Javascript code (all in one file!) for your quiz. Copy and paste this into your favorite code or text editor, save it with the extension <span style="font-style:italic;">.html</span>, upload it to your site, and you have your own custom timed quiz!<br /> <br />Make a mistake? Thought of a new alternative? Click on the <span style="font-style:italic;">Edit Mode</span> checkbox, move the arrow up and down to select the answer you wish to edit, click <span style="font-style:italic;">Edit answer next to arrow</span> button, and that answer will be brought back into the <span style="font-style:italic;">Main Answer</span> and <span style="font-style:italic;">alternative</span> boxes so you can edit them. When done, click <span style="font-style:italic;">Return edited answer/alternatives to list</span>, and your edited answers will now appear. Uncheck <span style="font-style:italic;">Edit Mode</span> to keep adding new answers, or generate the code with the new answers. You can also delete the selected answer, or even clear the entire list while in edit mode.<br /> <br />This is a great way to attract and entertain visitors to your site, and the more you know about CSS, HTML, and Javascript, the better able you'll be to edit and customize your quiz to better fit in with your site. Worried about people using their browser's <span style="font-style:italic;">View Source</span> feature to see the answers? Don't be, as the answers and their respective alternatives are <a href="http://en.wikipedia.org/wiki/Obfuscated_code">obfuscated</a> in the generated code. If you need inspiration for quiz topics, look <a href="http://headinside.blogspot.com/2008/03/how-many-xs-can-you-name-in-y-minutes.html">here</a> and <a href="http://www.mentalfloss.com/blogs/archives/12311">here</a>.<br /> <br /><span style="font-weight:bold;">Note:</span> I take no responsibility for the consequences of using any quiz or quizzes you create with this tool in any manner, nor do I make any guarantees concerning any such quiz or quizzes.<br /><br /><form action=""><input type="button" value="Click to toggle video tutorial" id="vidtutbutton"></form><div id="vidtutorial" style="display:none;"><object width="530" height="323"><param name="movie" value="http://www.youtube.com/v/Q_loll_oqVw?fs=1&hl=en_US&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Q_loll_oqVw?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="530" height="323"></embed></object><br /></div> <br /><br /><span style="font-weight:bold;">Basic Information</span><br />Quiz Topic (plural): <input type="text" id="topic" size="20"><br /><br />Quiz Topic (singular): <input type="text" id="topicone" size="20"><br /><br />Time Limit: <select onchange="" id="minmenu"><br /> <option selected value="minutes..."/>minutes...<br /> <option/>1 min.<br /> <option/>2 mins.<br /> <option/>3 mins.<br /> <option/>4 mins.<br /> <option/>5 mins.<br /> <option/>6 mins.<br /> <option/>7 mins.<br /> <option/>8 mins.<br /> <option/>9 mins.<br /> <option/>10 mins.<br /> <option/>11 min.<br /> <option/>12 mins.<br /> <option/>13 mins.<br /> <option/>14 mins.<br /> <option/>15 mins.<br /> <option/>16 mins.<br /> <option/>17 mins.<br /> <option/>18 mins.<br /> <option/>19 mins.<br /> <option/>20 mins.<br /></select> : <select onchange="" id="secmenu"><br /> <option selected value="http://gmvlog.blogspot.com/"/>seconds...<br /> <option/>00 secs.<br /> <option/>15 secs.<br /> <option/>30 secs.<br /> <option/>45 secs.<br /></select><br /><br /><br /><span style="font-weight:bold;">Answer and acceptable alternatives</span><br />Main Answer: <input type="text" id="alt0" size="30"><br /> alternative: <input type="text" id="alt1" size="30"><br /> alternative: <input type="text" id="alt2" size="30"><br /> alternative: <input type="text" id="alt3" size="30"><br /> alternative: <input type="text" id="alt4" size="30"><br /> alternative: <input type="text" id="alt5" size="30"><br /> alternative: <input type="text" id="alt6" size="30"><br /><br /> <input type="button" value="Add answer/alternatives to list" onclick="addToList()" id="addans"><input type="button" value="Clear" onclick="clrAns()" id="clrans"><br /><br /> <input type="button" value="Return edited answer/alternatives to list" onclick="retToList()" id="rtnans" disabled="true"><input type="button" value="Cancel" onclick="cnclEdit()" id="cncledt" disabled="true"><br /><br /><span style="font-weight:bold;">Answers/Alternatives List:</span><br /><textarea rows="10" cols="40" readonly="true" id="anslist"></textarea><br /><input type="checkbox" onclick="edtmode()" id="edtng" disabled="true">Edit Mode <input type="button" value="Clear List" onclick="emptyList()" id="clrlist" disabled="true"><br /><br /> <input type="button" value="Move arrow up" onclick="arwUp()" id="ArUp" disabled="true"> <input type="button" value="Delete answer next to arrow" onclick="dltitm()" id="snip" disabled="true"><br /><input type="button" value="Move arrow down" onclick="arwDn()" id="ArDn" disabled="true"><br /><input type="button" value="Edit answer next to arrow" onclick="edtAns()" id="EdAr" disabled="true"><br /><br /><br /><span style="font-weight:bold;">Final Message Options:</span><br /><br /> <input type="checkbox" id="primsg" onclick="priClk()" disabled="true">Show primary message if <select id="primenu" name="priopt" disabled="true" onchange="actSec()"><option selected value="http://headinside.blogspot.com/2008/03/how-many-xs-can-you-name-in-y-minutes.html"/>0</select> or more correct answers are given<br /><br /> Primary Message: <input type="text" id="pritxt" size="40" readonly="true"><br /><br /> Primary Link (optional): <input type="text" id="prilnk" size="40" readonly="true"><br /><br /> <input type="checkbox" onclick="secClk()" id="secmsg" disabled="true">Show secondary message if fewer correct answers are given<br /><br /> Secondary Message: <input type="text" id="sectxt" size="40" readonly="true"><br /><br /> Secondary Link (optional): <input type="text" id="seclnk" size="40" readonly="true"><br /><br /> <input type="checkbox" id="nwwn" disabled="true">Links open in new window<br /><br /><br /> <input type="button" value="Generate quiz code" onclick="makeCode()" id="gencode"><br><br /><span style="font-weight:bold;">Quiz Code:</span><br /><textarea readonly="true" id="code"></textarea><br /></span>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com2tag:blogger.com,1999:blog-2800835365312821409.post-9235848171227986362010-11-06T12:00:00.000-07:002011-06-18T17:04:33.345-07:00Nim Strategy Calculator<style type='text/css'>#givestrat, #mgivestrat, #ngivestrat, #wgivestrat { width: 520px; height: 60px; } </style><script type='text/javascript'>//<![CDATA[ $(function(){ $('#givestrat').autoResizable({ maxHeight: 1000 }); $('#mgivestrat').autoResizable({ maxHeight: 1250 }); $('#ngivestrat').autoResizable(); $('#wgivestrat').autoResizable({ maxHeight: 1000 }); $("#pile4").css("display","none"); $("#pile5").css("display","none"); $("#pile6").css("display","none"); $("#pile7").css("display","none"); $("#pile8").css("display","none"); $("#pile9").css("display","none"); $("#pilen4").css("display","none"); $("#pilen5").css("display","none"); $("#pilen6").css("display","none"); $("#pilen7").css("display","none"); $("#pilen8").css("display","none"); $("#pilen9").css("display","none"); $("#mpiles").change(function() { var i = $("#mpiles").val(); var j = Number(i); var k = 1; var ck = ""; var ckt = ""; for (k=1;k<=j;k++) { ckt="#mpile" + k.toString(); $(ckt).val(""); ck="#pile" + k.toString(); $(ck).show(); }; if (j != 9) { for (k=(j+1);k<=9;k++) { ck="#pile" + k.toString(); $(ck).hide(); }; }; $("#mgivestrat").val(""); }); $("#npiles").change(function() { var i = $("#npiles").val(); var j = Number(i); var k = 1; var ck = ""; var ckt = ""; for (k=1;k<=j;k++) { ckt="#npile" + k.toString(); $(ckt).val(""); ck="#pilen" + k.toString(); $(ck).show(); }; if (j != 9) { for (k=(j+1);k<=9;k++) { ck="#pilen" + k.toString(); $(ck).hide(); }; }; $("#ngivestrat").val(""); }); $("#nimstrat").click(function() { var stdmis = $(".losswin:checked").val(); var numobj = $("#startobj").val(); var dwnup = $(".downorup:checked").val(); var eachmove = $("#maxobj").val(); //alert("Last to move is " + stdmis + ", object limit=" + numobj + ", game direction is " + dwnup + ", objects usable per turn range from 1 to " + eachmove); var totalobj = Number(numobj); var moveobj = Number(eachmove); var mdlo = moveobj + 1; var extra = totalobj%mdlo; var winplays = new Array(); var fillblank = ""; var msg = "The rules for this particular version of the game of Nim are as follows:\n* There are two players.\n* The players alternate taking turns.\n* The game starts out with "; if (dwnup == "down") { msg = msg + totalobj.toString() + " objects.\n* On a given player's turn, they must remove anywhere from 1 to " + moveobj.toString() + " objects.\n* Neither player is allowed to remove 0 objects."; } else { msg = msg + "0 objects.\n* On a given player's turn, they must add anywhere from 1 to " + moveobj.toString() + " objects.\n* Neither player is allowed to add 0 objects.\n* Neither player is allowed to add an amount that would result in a total of more than " + totalobj.toString() + " objects."; }; msg = msg + "\n* The last person to make a move is the " + stdmis + ".\n\n\nThe Scam: Although seemingly fair, you can rig this game in your favor.\n\nFor this particular version of Nim, "; var x = 1; while ((mdlo * (x-1)) <= totalobj) { winplays[x] = (mdlo * (x-1)); //assume that last move is winner and that the game is played down to 0 if ((stdmis == "loser") && (dwnup == "down")) { //If last move is loser and game is played down to 0 then winplays[x] = winplays[x] + 1; //increase winning numbers by 1, since you're trying to leave 1 for the other person }; if (dwnup == "up") { //If game is being played up to limit (instead of down to 0) and assuming the last move wins winplays[x] = winplays[x] + extra; //increase each of the mdlo numbers by extra if (stdmis == "loser") { //But if the last move is the loser winplays[x] = winplays[x] - 1; //decrease that adjusted amount by 1 }; }; x = x + 1; }; var y = x - 1; //upper limit of x for later var strtr = ""; //variable listing who should go first if ((totalobj == winplays[y]) && (dwnup == "down")) { msg = msg + "the other person should go first. This will ensure that you can always leave certain key numbers of objects on each turn that will guarantee your win.\n\n"; strtr = "other"; }; if ((totalobj != winplays[y]) && (dwnup == "down")) { msg = msg + "you should go first. This will ensure that you can always leave certain key numbers of objects on each turn that will guarantee your win.\n\n"; strtr = "you"; }; if (((mdlo == winplays[1]) || (mdlo == winplays[2])) && (dwnup == "up")) { msg = msg + "the other person should go first. This will ensure that you can always attain certain key numbers of objects at the end of each of your turns, which will guarantee your win.\n\n"; strtr = "other"; }; if (((mdlo != winplays[1]) && (mdlo != winplays[2])) && (dwnup == "up")) { msg = msg + "you should go first. This will ensure that you can always leave certain key numbers of objects at the end of each of your turns, which will guarantee your win.\n\n"; strtr = "you"; }; msg = msg + "The key numbers of objects you need to "; fillblank = "leave"; if (dwnup == "up") { fillblank = "attain"; }; msg = msg + fillblank + " on each turn, in order to safely win the game, are as follows:\n\n"; fillblank = ""; //display winning plays in decreasing order if played down to 0, otherwise in increasing order if (dwnup == "down") { x = x - 1; while (x > 0) { if ((winplays[x] > 0) && (winplays[x] < totalobj)) { fillblank = fillblank + winplays[x].toString(); if ((winplays[x] == 1) && (stdmis == "loser")) { fillblank = fillblank + " (of course)"; }; fillblank = fillblank + "\n"; }; x = x - 1; }; } else { x = 1; while (x <= y) { if ((winplays[x] > 0) && (winplays[x] <= totalobj)) { fillblank = fillblank + winplays[x].toString(); if ((winplays[x] == totalobj) && (stdmis == "winner")) { fillblank = fillblank + " (of course)"; }; fillblank = fillblank + "\n"; }; x = x + 1; }; }; msg = msg + fillblank + "\n\nTips:\n\n* You don't have to hit every key number. Just make sure you get to one of the above key numbers before the goal is reached, and you'll always be able to win the game from there.\n\n* "; if (strtr == "other") { msg = msg + "If it's decided that you must go first, and your opponent isn't wise to the ways of Nim, it's still possible for you to win. Only play small amounts of objects on your turns, until you get an opportunity to reach a key number."; } else { msg = msg + "If it's decided that the other person will go first, and your opponent isn't wise to the ways of Nim, it's still possible for you to win. Just keep looking for an opportunity to get to one of your key numbers. You can play only small amounts of objects on your turn if you can't reach a key number."; }; msg = msg + "\n\n* Instead of playing single-pile Nim with physical objects, you can often just state the numbers verbally, or even use a calculator."; //optional extra tips for special cases if (totalobj == 100) { msg = msg + "\n\n* Since you're using 100, you could keep track of the score using 100-sided dice from a role-playing game."; }; if (totalobj == 88) { msg = msg + "\n\n* Since you're using 88 objects, you might try playing this game using piano keys."; }; if (totalobj == 78) { msg = msg + "\n\n* Since you're using 78 objects, you might try using a standard deck of tarot cards as counters."; }; if (totalobj == 64) { msg = msg + "\n\n* Since you're using 64 objects, you might try playing this on a chessboard."; }; if (totalobj == 54) { msg = msg + "\n\n* Since you're using 54 objects, you might try using a standard deck of playing cards, including both jokers, as counters, ignoring their suits and values."; }; if (totalobj == 52) { msg = msg + "\n\n* Since you're using 52 objects, you might try using a standard deck of playing cards as counters, ignoring their suits and values. You also might play this game using the weeks in a year, or even just the white keys on a piano."; }; if (totalobj == 50) { msg = msg + "\n\n* Since you're using 50 objects, you might try using US states."; }; if (totalobj == 48) { msg = msg + "\n\n* Since you're using 48 objects, you might try using a deck of Pinochle playing cards as counters, ignoring their suits and values."; }; if (totalobj == 42) { msg = msg + "\n\n* Douglas Adams fans will especially enjoy Nim with 42 objects."; }; if (totalobj == 36) { msg = msg + "\n\n* Since you're using 36 objects, you might try playing this version with inch marks on a yardstick, or even just the black keys on a standard piano."; }; if (totalobj == 31) { msg = msg + "\n\n* Since you're using 31 objects, you might try playing this version with a calendar page showing a 31-day month."; }; if (totalobj == 30) { msg = msg + "\n\n* Since you're using 30 objects, you might try playing this version with a calendar page showing a 30-day month (September, April, June, or November)."; }; if (totalobj == 29) { msg = msg + "\n\n* Since you're using 29 objects, you might try playing this version with a calendar page showing a leap-year February."; }; if (totalobj == 28) { msg = msg + "\n\n* Since you're using 28 objects, you might try playing this version with a calendar page showing a non-leap-year February."; }; if (totalobj == 27) { msg = msg + "\n\n* Since you're using 27 objects, you might try playing this version with amendments to the US Constitution."; }; if (totalobj == 26) { msg = msg + "\n\n* Since you're using 26 objects, you might try playing this version with letters of the alphabet."; }; if (totalobj == 24) { msg = msg + "\n\n* Since you're using 24 objects, you might try playing this version with a case of beer bottles, or all the face cards (jacks, queens, and kings) from a deck of Pinochle playing cards."; }; if (totalobj == 20) { msg = msg + "\n\n* Since you're using 20 objects, you could keep track of the score using 20-sided dice from a role-playing game, cigarettes in a standard pack, or matches in a matchbook."; }; if (totalobj == 18) { msg = msg + "\n\n* Since you're using 18 objects, you could try playing this by referencing the 18 holes on a golf course."; }; if (totalobj == 16) { msg = msg + "\n\n* Since you're using 16 objects, you could try playing this with digits on a credit card."; }; if (totalobj == 12) { msg = msg + "\n\n* Since you're using 12 objects, you could try playing this with such varied things as hours on a clock, eggs in a carton, all the face cards (jacks, queens, and kings) from a standard deck of playing cards, inch marks on a foot-long ruler, signs of the zodiac, or months of the year."; }; if (mdlo == 5) { msg = msg + "\n\n* Try playing this with 4-sided dice from a role-playing game, letting people choose their numbers instead of rolling them."; }; if (mdlo == 7) { msg = msg + "\n\n* Try playing this with standard 6-sided dice, letting people choose their numbers instead of rolling them."; }; if (mdlo == 9) { msg = msg + "\n\n* Try playing this with 8-sided dice from a role-playing game, letting people choose their numbers instead of rolling them."; }; if (mdlo == 11) { msg = msg + "\n\n* Try playing this with 10-sided dice from a role-playing game, letting people choose their numbers instead of rolling them."; }; if (mdlo == 13) { msg = msg + "\n\n* Try playing this with 12-sided dice from a role-playing game, letting people choose their numbers instead of rolling them."; }; if (mdlo == 21) { msg = msg + "\n\n* Try playing this with 20-sided dice from a role-playing game, letting people choose their numbers instead of rolling them."; }; if (mdlo == 101) { msg = msg + "\n\n* Try playing this with 100-sided dice from a role-playing game, letting people choose their numbers instead of rolling them."; }; $("#givestrat").val(msg); $('#givestrat').focus(); //multiples of mdlo must include 0 * mdlo, and go up to and including totalobj //Last to move is winner and game direction is down formula: safe numbers to leave are multiples of mdlo //Last to move is loser and game direction is down formula: safe numbers to leave are 1 greater than each of the multiples of mdlo (because you're trying to leave 1) //Last to move is winner and game direction is up formula: safe numbers to attain are extra greater than each of the multiples of mdlo //Last to move is loser and game direction is up formula: safe numbers to attain are extra-1 greater than each of the multiples of mdlo (because you're trying to have them take the last 1) }); function sortNumber(a,b) { return b - a; }; $("#mnimstrat").click(function() { var mstdmis = $(".mlosswin:checked").val(); var i = $("#mpiles").val(); var j = Number(i); var k = 1; var l = 1; var temp = 0; var safe = 0; var trnsnm = 0; var cmpr = 0; var cnthgh = 0; var mstrtr = ""; var ck = ""; var mmsg = "The rules for this particular version of the game of Nim are as follows:\n* There are two players.\n* The game starts out with " + i + " piles, consisting of "; var objpiles = new Array(); var ckarrng = new Array(); var dplck = new Array(); var pssbl = new Array(); var sfpiles = new Array(); for (k=0;k<=8;k++) { ckarrng[k] = 0; dplck[k] = 0; sfpiles[k + 1] = (k + 1).toString() + " piles\n----------\n"; }; for (k=0;k<j;k++) { ck = "#mpile" + (k + 1).toString(); objpiles[k] = Number($(ck).val()); if (k == (j - 1)) { mmsg = mmsg + "and "; }; mmsg = mmsg + objpiles[k].toString(); if (k == (j - 1)) { mmsg = mmsg + " objects, respectively.\n* "; } else { mmsg = mmsg + ", "; }; }; objpiles = objpiles.sort(sortNumber); //sort into descending order mmsg = mmsg + "The players alternate taking turns.\n* A turn consists of removing 1 or more objects from any single pile.\n* Neither player may take 0 objects on their respective turn.\n* Neither player may remove objects from more than 1 pile on their respective turn.\n* The last person to remove an object is the " + mstdmis + ".\n\n\nThe Scam: Although seemingly fair, you can rig this game in your favor.\n\nFor this particular version of Nim, "; safe = objpiles[0]; for (k=1;k<j;k++) { safe = safe ^ objpiles[k]; //^ is bitwise xor operator used in determining if opening arrangement is already safe }; if (safe == 0) { mmsg = mmsg + "the other person should go first. "; //if opening move is already safe recommend other person go first mstrtr = "other"; } else { mmsg = mmsg + "you should go first. "; //otherwise you go first and make opening arrangement safe mstrtr = "you"; }; mmsg = mmsg + "This will ensure that you can always leave certain safe pile arrangements at the end of each of your turns, which will guarantee your win.\n\nThe key arrangements of piles you can safely leave, in descending order, organized by descending number of piles, are as follows:\n\n"; for (k=0;k<j;k++) { pssbl[k] = 1; for (l=k;l<j;l++) { pssbl[k] = pssbl[k] * (objpiles[l] + 1); }; }; pssbl[0] = pssbl[0] - 2; for (k=pssbl[0];k>=0;k--) { trnsnm = k; for (l=2;l<=j;l++) { ckarrng[l - 2] = Math.floor(trnsnm/pssbl[l - 1]); trnsnm = trnsnm - (ckarrng[l - 2] * pssbl[l - 1]); }; ckarrng[j - 1] = trnsnm; for (l=0;l<=8;l++) { dplck[l] = ckarrng[l]; }; ckarrng = ckarrng.sort(sortNumber); if (ckarrng[2] != 0) { // Make sure that there at least 3 non-zero numbers in the arrangement cmpr = 0; cnthgh = 0; for (l=0;l<=8;l++) { // Count number similarities between sorted and unsorted arrangement arrays (prevents checking of duplicates) if (ckarrng[l] == dplck[l]) { cmpr = cmpr + 1; if (ckarrng[l] > 1) { cnthgh = cnthgh + 1; // Count how many numbers in array are 2 or greater to avoid checking arrays of all 1s and 0s later }; }; }; if (cmpr == 9) { // If there are 9 similarities (nothing has changed), then pass arrangement array to be checked if (cnthgh != 0) { // is there at least 1 number that isn't a 1 or a 0? safe = ckarrng[0] ^ ckarrng[1] ^ ckarrng[2] ^ ckarrng[3] ^ ckarrng[4] ^ ckarrng[5] ^ ckarrng[6] ^ ckarrng[7] ^ ckarrng[8]; //^ is bitwise xor operator used in determining if currently checked arrangement is safe if (safe == 0) { temp = 0; for (l=0;l<=8;l++) { // Determine number many piles the current safe arrangement contains if (ckarrng[l] != 0) { temp = l; }; }; for (l=0;l<=temp;l++) { sfpiles[temp + 1] = sfpiles[temp + 1] + ckarrng[l]; if (l < temp) { sfpiles[temp + 1] = sfpiles[temp + 1] + ", "; }; }; sfpiles[temp + 1] = sfpiles[temp + 1] + "\n"; }; }; }; }; }; for (k=j;k>=3;k--) { mmsg = mmsg + sfpiles[k]; if (((k/2) != (Math.floor(k/2))) && (mstdmis == "loser")) { //If current pile number is odd and misere nim is being played add arrangements of 3 ones/5 ones etc. for (l=k;l>=1;l--) { mmsg = mmsg + "1"; if (l != 1) { mmsg = mmsg + ", "; } else { mmsg = mmsg + "\n"; }; }; }; if (((k/2) == (Math.floor(k/2))) && (mstdmis == "winner")) { //If current pile number is even and standard nim is being played add arrangements of 4 ones/6 ones etc. for (l=k;l>=1;l--) { mmsg = mmsg + "1"; if (l != 1) { mmsg = mmsg + ", "; } else { mmsg = mmsg + "\n"; }; }; }; mmsg = mmsg + "\n"; }; mmsg = mmsg + "2 piles\n----------\n2 equal piles\n"; mmsg = mmsg + "\n\nTips:\n\n* The exact order of the safe arrangements above is irrelevant. Leaving an arrangent of 3, 2, 1 is the same as leaving an arrangement of:\n1, 2, 3\n1, 3, 2\n2, 1, 3\n2, 3, 1\n3, 1, 2"; if (mstrtr == "other") { mmsg = mmsg + "\n\n* If it's decided that you must go first, and your opponent isn't wise to the ways of Nim, it's still possible for you to win. Only take small amounts of objects on your turns, until you get an opportunity to reach a safe arrangement."; } else { mmsg = mmsg + "\n\n* If it's decided that the other person will go first, and your opponent isn't wise to the ways of Nim, it's still possible for you to win. Only take small amounts of objects on your turns, until you get an opportunity to reach a safe arrangement."; }; if ((j == 4) && (objpiles[0] == 7) && (objpiles[1] == 5) && (objpiles[2] == 3) && (objpiles[3] == 1) && (mstdmis == "loser")) { mmsg = mmsg + "\n\n* The particular version you've entered is often known as " + String.fromCharCode(34) + "Marienbad Nim" + String.fromCharCode(34) + ", or simply " + String.fromCharCode(34) + "Marienbad" + String.fromCharCode(34) + ", as it was featured in the 1961 French film, " + String.fromCharCode(34) + "Last Year in Marienbad" + String.fromCharCode(34) + "."; }; mmsg = mmsg + "\n\n* Memorizing the combinations may seem daunting, but there are easy to memorize patterns. For example:\n-Piles consisting of all the same number (such as 1, 1, 1)\n-Two equal piles\n-" + String.fromCharCode(34) + "Paired piles" + String.fromCharCode(34) + " (such as 2, 2, 1, 1)\n-" + String.fromCharCode(34) + "Addition" + String.fromCharCode(34) + " (such as 1, 2, 3, since 1+2=3, or 1, 4, 5, since 1+4=5)\n-Arrangements that only have 1 fewer object than the starting arrangement\n-Any pattern or mnemonic you develop that makes it easy for you to remember them"; mmsg = mmsg + "\n\n* Still can't memorize the patterns you need? Try making a crib sheet which is easily hidden or disguised."; mmsg = mmsg + "\n\n* If there's too many patterns for memorizing or crib sheets, try setting up a simpler game, with fewer arrangements to memorize."; mmsg = mmsg + "\n\n* Once you leave 2 equal rows, you simply mirror (copy) the other person's last move"; if (mstdmis == "loser") { mmsg = mmsg + ". When you get to the point where one of the two piles only has 1 object in it, simply remove all the items in the other pile to win the game."; } else { mmsg = mmsg + ", which will automatically win you the game."; }; mmsg = mmsg + "\n\n* A similar mirroring strategy will also work with paired piles (defined above). In the case of paired piles, the purpose of the mirroring should be to get down to 2 equal rows."; $("#mgivestrat").val(mmsg); $("#mgivestrat").focus(); }); $("#nnimstrat").click(function() { var fstmv = $("#fmove:checked").val(); var nstdmis = $(".nlosswin:checked").val(); var i = $("#npiles").val(); var j = Number(i); var k = 1; var l = 1; var m = 1; var safe = 0; var sfck = 0; var cnthgh = 0; var cntone = 0; var mmsg = ""; var objpiles = new Array(); for (k=0;k<j;k++) { ck = "#npile" + (k + 1).toString(); objpiles[k] = Number($(ck).val()); }; safe = objpiles[0]; for (k=1;k<j;k++) { safe = safe ^ objpiles[k]; //^ is bitwise xor operator used in determining if opening arrangement is already safe }; if (safe == 0) { if (fstmv == "first") { mmsg = mmsg + "Since this position is already safe, the other person should go first.\n\nIf you must go first, try taking a small amount of objects from 1 row, and hope for a mistake by your opponent."; } else { mmsg = mmsg + "Unfortunately, this position is already safe, so you have no good moves from here.\n\nTry taking a small amount of objects from 1 row, and hope for a mistake by your opponent."; }; } else { mmsg = mmsg + "Here are the plays you can make on this turn, in order to insure a win at the end:\n\n"; for (k=0;k<j;k++) { for (l=1;l<=objpiles[k];l++) { cnthgh = 0; cntone = 0; sfck = objpiles[k] - l; if (sfck > 1) { cnthgh = cnthgh + 1; }; if (sfck == 1) { cntone = cntone + 1; }; for (m=0;m<j;m++) { if (m != k) { sfck = sfck ^ objpiles[m]; if (objpiles[m] > 1) { cnthgh = cnthgh + 1; }; if (objpiles[m] == 1) { cntone = cntone + 1; }; }; }; if ((nstdmis == "winner") || (cnthgh != 0)) { if (sfck == 0) { for (m=0;m<j;m++) { if (m != k) { mmsg = mmsg + objpiles[m].toString(); } else { mmsg = mmsg + (objpiles[k] - l).toString(); }; if (m == (j-1)) { mmsg = mmsg + " (" + objpiles[k].toString() + "-object pile: Remove " + l.toString() + ")\n"; } else { mmsg = mmsg + ", "; }; }; }; } else { if ((cntone/2) != (Math.floor(cntone/2))) { for (m=0;m<j;m++) { if (m != k) { mmsg = mmsg + objpiles[m].toString(); } else { mmsg = mmsg + (objpiles[k] - l).toString(); }; if (m == (j-1)) { mmsg = mmsg + " (" + objpiles[k].toString() + "-object pile: Remove " + l.toString() + ")\n"; } else { mmsg = mmsg + ", "; }; }; }; }; }; }; }; $("#ngivestrat").val(mmsg); $("#ngivestrat").focus(); }); function isPrime(num) { var prime = num != 1; // Everything but 1 can be prime for (var i = 2; i < num; i++) { if (num % i == 0) { prime = false; break; }; }; return prime; }; $("#wnimstrat").click(function() { var stdmis = $(".wlosswin:checked").val(); var i = $("#wstartobj").val(); var j = Number(i); var pmck = false; var wmsg = ""; var fctra = 0; var fctrb = 0; var fctrc = new Array(); var fctrd = new Array(); var extr = new Array(); var frstmv = 0; var dff = 99999; var rnk = 0; var k = 0; //loop variable var l = 0; //array index variable var m = 1; //number used to adjust for standard or misere games var n = 0; //secondary loop variable var o = 0; //secondary array index variable if (stdmis == "loser") { m = 1; } else { m = 0; }; pmck = isPrime((j-m)); if (pmck == true) { wmsg = "Unfortunately, using " + j.toString() + " objects, in a game where the person who removes the last object is the " + stdmis + ", will not work for Wise-Guy Nim. Please either choose another number, or change the goal of the game."; } else { for (k = 2; k < ((j - m) - 1); k++) { //generate the closest factor pairs of j minus m var inn = Math.round((j - m) / k); var outt = ((j - m) / k); if (inn == outt) { if ((k - ((j - m) / k)) >= 0) { fctra = k; fctrb = ((j - m) / k); break; }; }; }; for (n = 1; n < (j - m); n++) { //Find all factor pairs of numbers up to j minus m minus 1 for (k = 2; k < ((j - m - n) - 1); k++) { var inn = Math.round((j - m - n) / k); var outt = ((j - m - n) / k); if (inn == outt) { if ((k - ((j - m - n) / k)) >= 0) { fctrc[o] = k; fctrd[o] = ((j - m - n) / k); extr[o] = n; o = o + 1; }; }; }; }; for (k = 0; k < o; k++) { //Search the fctrc array for the closest number - except for exact match - to fctra that appears highest on the list if (((Math.abs(fctrc[k] - fctra)) < dff) && ((fctrc[k] - fctra) != 0)) { rnk = k; dff = Math.abs(fctrc[k] - fctra); if (dff == 1) { break; }; }; }; wmsg = wmsg + "If you're going to play single-pile Nim against an opponent who understands the game's winning strategies, it's still possible to rig the game against them.\n\nExplain that, as a quick refresher, you'll go over the rules of Nim, so that there are no surprises. At first, state only these rules:\n* There are two players.\n* The players alternate taking turns.\n* Neither player is allowed to remove 0 objects.\n* The person who takes the last object is the " + stdmis + ".\n\n\n"; wmsg = wmsg + "The Scam: At this point, ask if the other player wants to go first themselves, or if they want you to go first. Their decision determines which set of rules you state:\n\n* If they decide that YOU should go first, state that, on each turn, you're each allowed to take any amount of objects in the range from 1 to " + (fctrc[rnk] - 1).toString() + " objects.\n\n* If they decide THEY'RE going first, state that, on each turn, you're each allowed to take any amount of objects in the range from 1 to " + (fctra - 1).toString() + ".\n\n"; wmsg = wmsg + "Either way, don't forget to mention that there are a total of " + j.toString() + " objects in the pile.\n\n\n"; wmsg = wmsg + "So, how do you win Wise-Guy Nim? That also depends on who goes first:\n\n* If YOU'RE going first, always take " + extr[rnk].toString() + " on your first move. From that point on, you watch how many objects they take, and you take " + (fctrc[rnk]).toString() + " minus the number of objects they took. (If they took 1 object, you take " + (fctrc[rnk] - 1).toString() + " objects. If they took 2 objects, you take " + (fctrc[rnk] - 2).toString() + " objects, and so on.)\n\n"; wmsg = wmsg + "* If THEY'RE going first, you watch how many objects they take, and then you take " + fctra.toString() + " minus whatever they took. (If they took 1 object, you take " + (fctra - 1).toString() + " objects. If they took 2 objects, you take " + (fctra - 2).toString() + " objects, and so on.)\n\n\n"; wmsg = wmsg + "Tips:\n\n* Since you're dealing with two possible strategies, make sure you practice, so you can be sure of which strategy to use in what situation!\n\n* Until the other player decides who is going first, do not mention the total number of objects, or the amounts they're allowed to remove."; wmsg = wmsg + "\n\n* If you're concerned that the numbers in the above strategy may seem strange to your audience, you might want to try a different total amount and/or goal. Experiment and see what works best for you!"; wmsg = wmsg + "\n\n* Instead of playing single-pile Nim with physical objects, you can often just state the numbers verbally, or even use a calculator."; //optional extra tips for special cases if (j == 100) { wmsg = wmsg + "\n\n* Since you're using 100, you could keep track of the score using 100-sided dice from a role-playing game."; }; if (j == 88) { wmsg = wmsg + "\n\n* Since you're using 88 objects, you might try playing this game using piano keys."; }; if (j == 78) { wmsg = wmsg + "\n\n* Since you're using 78 objects, you might try using a standard deck of tarot cards as counters."; }; if (j == 64) { wmsg = wmsg + "\n\n* Since you're using 64 objects, you might try playing this on a chessboard."; }; if (j == 54) { wmsg = wmsg + "\n\n* Since you're using 54 objects, you might try using a standard deck of playing cards, including both jokers, as counters, ignoring their suits and values."; }; if (j == 52) { wmsg = wmsg + "\n\n* Since you're using 52 objects, you might try using a standard deck of playing cards as counters, ignoring their suits and values. You also might play this game using the weeks in a year, or even just the white keys on a piano."; }; if (j == 50) { wmsg = wmsg + "\n\n* Since you're using 50 objects, you might try using US states."; }; if (j == 48) { wmsg = wmsg + "\n\n* Since you're using 48 objects, you might try using a deck of Pinochle playing cards as counters, ignoring their suits and values."; }; if (j == 42) { wmsg = wmsg + "\n\n* Douglas Adams fans will especially enjoy Nim with 42 objects."; }; if (j == 36) { wmsg = wmsg + "\n\n* Since you're using 36 objects, you might try playing this version with inch marks on a yardstick, or even just the black keys on a standard piano."; }; if (j == 31) { wmsg = wmsg + "\n\n* Since you're using 31 objects, you might try playing this version with a calendar page showing a 31-day month."; }; if (j == 30) { wmsg = wmsg + "\n\n* Since you're using 30 objects, you might try playing this version with a calendar page showing a 30-day month (September, April, June, or November)."; }; if (j == 29) { wmsg = wmsg + "\n\n* Since you're using 29 objects, you might try playing this version with a calendar page showing a leap-year February."; }; if (j == 28) { wmsg = wmsg + "\n\n* Since you're using 28 objects, you might try playing this version with a calendar page showing a non-leap-year February."; }; if (j == 27) { wmsg = wmsg + "\n\n* Since you're using 27 objects, you might try playing this version with amendments to the US Constitution."; }; if (j == 26) { wmsg = wmsg + "\n\n* Since you're using 26 objects, you might try playing this version with letters of the alphabet."; }; if (j == 24) { wmsg = wmsg + "\n\n* Since you're using 24 objects, you might try playing this version with a case of beer bottles, or all the face cards (jacks, queens, and kings) from a deck of Pinochle playing cards."; }; if (j == 20) { wmsg = wmsg + "\n\n* Since you're using 20 objects, you could keep track of the score using 20-sided dice from a role-playing game, cigarettes in a standard pack, or matches in a matchbook."; }; if (j == 18) { wmsg = wmsg + "\n\n* Since you're using 18 objects, you could try playing this by referencing the 18 holes on a golf course."; }; if (j == 16) { wmsg = wmsg + "\n\n* Since you're using 16 objects, you could try playing this with digits on a credit card."; }; if (j == 12) { wmsg = wmsg + "\n\n* Since you're using 12 objects, you could try playing this with such varied things as hours on a clock, eggs in a carton, all the face cards (jacks, queens, and kings) from a standard deck of playing cards, inch marks on a foot-long ruler, signs of the zodiac, or months of the year."; }; if (j < 10) { wmsg = "Wise-Guy nim doesn't really work well with less than 10 objects. Please choose 10 or more objects."; }; }; $("#wgivestrat").val(wmsg); $("#wgivestrat").focus(); }); }); //]]></script>To learn how to use the Nim Strategy Calculator, see <a href="http://headinside.blogspot.com/2010/08/nim-strategy-calculator.html">my <span style="font-style:italic">Nim Strategy Calculator</span> post</a>.<br /><br />To learn more about the game of Nim, see <a href="http://headinside.blogspot.com/search/label/nim">my <span style="font-style:italic">Secrets of Nim</span> series of posts</a>.<br /><ul id="tabs"><span id="fullpost"><li><a id="nm1" href="#nmsingle">Single-Pile Nim</a></li><li><a id="nm2" href="#nmmulti">Multi-Pile Nim</a></li><li><a id="nm3" href="#nmnextmove" class="s">Next Move?</a></li><li><a id="nm4" href="#nmwise">Wise-Guy Nim</a></li></span></ul><div class="panes"><div><span id="fullpost"><h2>Single-Pile Nim Strategy Calculator</h2><br />Player who makes the last move is the: <input type="radio" name="winloss" class="losswin" value="winner" checked=true /> Winner <input type="radio" name="winloss" class="losswin" value="loser" /> Loser<br /><br />Maximum number of objects (limit): <input type="text" id="startobj" maxlength="4" class="numeric" /><br /><br />Nim Game is played: <input type="radio" name="upordown" class="downorup" value="down" checked=true /> down to 0 <input type="radio" name="upordown" class="downorup" value="up" /> up to limit<br /><br />Number of objects used per turn ranges from 1 to: <input type="text" id="maxobj" maxlength="4" class="numeric" /><br /><br /><input style="display:block;margin-left:auto;margin-right:auto;" type="button" value="Calculate Nim Strategy" id="nimstrat" /><br /><br /><br /><textarea style="display:block;margin-left:auto;margin-right:auto;" readonly="true" id="givestrat"></textarea></span></div><div><h2>Multi-Pile Nim Strategy Calculator</h2><br />Player who makes removes the last object is the: <input type="radio" name="mwinloss" class="mlosswin" value="winner" checked=true /> Winner <input type="radio" name="mwinloss" class="mlosswin" value="loser" /> Loser<br /><br />Number of piles: <select name="slctr" id="mpiles"><br /><option selected="selected">3</option><br /><option>4</option><br /><option>5</option><br /><option>6</option><br /><option>7</option><br /><option>8</option><br /><option>9</option><br /></select><br /><br /><span id="pile1">Number of objects in pile #1: <input type="text" maxlength="2" name="mnpile1" id="mpile1" class="numeric" /></span><br /><span id="pile2">Number of objects in pile #2: <input type="text" maxlength="2" name="mnpile2" id="mpile2" class="numeric" /></span><br /><span id="pile3">Number of objects in pile #3: <input type="text" maxlength="2" name="mnpile3" id="mpile3" class="numeric" /></span><br /><span id="pile4">Number of objects in pile #4: <input type="text" maxlength="2" name="mnpile4" id="mpile4" class="numeric" /></span><br /><span id="pile5">Number of objects in pile #5: <input type="text" maxlength="2" name="mnpile5" id="mpile5" class="numeric" /></span><br /><span id="pile6">Number of objects in pile #6: <input type="text" maxlength="2" name="mnpile6" id="mpile6" class="numeric" /></span><br /><span id="pile7">Number of objects in pile #7: <input type="text" maxlength="2" name="mnpile7" id="mpile7" class="numeric" /></span><br /><span id="pile8">Number of objects in pile #8: <input type="text" maxlength="2" name="mnpile8" id="mpile8" class="numeric" /></span><br /><span id="pile9">Number of objects in pile #9: <input type="text" maxlength="2" name="mnpile9" id="mpile9" class="numeric" /></span><br /><br /><input style="display:block;margin-left:auto;margin-right:auto;" type="button" value="Calculate Nim Strategy" id="mnimstrat" /><br /><br /><br /><textarea style="display:block;margin-left:auto;margin-right:auto;" readonly="true" id="mgivestrat"></textarea><br /></div><div><h2>Multi-Pile Nim Next Move Calculator</h2><br />Player who makes removes the last object is the: <input type="radio" name="nwinloss" class="nlosswin" value="winner" checked=true /> Winner <input type="radio" name="nwinloss" class="nlosswin" value="loser" /> Loser<br /><br />First move of the game: <input type="checkbox" name="fm" id="fmove" value="first" /><br /><br />Number of piles: <select name="slctr" id="npiles"><br /><option selected="selected">3</option><br /><option>4</option><br /><option>5</option><br /><option>6</option><br /><option>7</option><br /><option>8</option><br /><option>9</option><br /></select><br /><br /><span id="pilen1">Number of objects in pile #1: <input type="text" maxlength="2" name="nnpile1" id="npile1" class="numeric" /></span><br /><span id="pilen2">Number of objects in pile #2: <input type="text" maxlength="2" name="nnpile2" id="npile2" class="numeric" /></span><br /><span id="pilen3">Number of objects in pile #3: <input type="text" maxlength="2" name="nnpile3" id="npile3" class="numeric" /></span><br /><span id="pilen4">Number of objects in pile #4: <input type="text" maxlength="2" name="nnpile4" id="npile4" class="numeric" /></span><br /><span id="pilen5">Number of objects in pile #5: <input type="text" maxlength="2" name="nnpile5" id="npile5" class="numeric" /></span><br /><span id="pilen6">Number of objects in pile #6: <input type="text" maxlength="2" name="nnpile6" id="npile6" class="numeric" /></span><br /><span id="pilen7">Number of objects in pile #7: <input type="text" maxlength="2" name="nnpile7" id="npile7" class="numeric" /></span><br /><span id="pilen8">Number of objects in pile #8: <input type="text" maxlength="2" name="nnpile8" id="npile8" class="numeric" /></span><br /><span id="pilen9">Number of objects in pile #9: <input type="text" maxlength="2" name="nnpile9" id="npile9" class="numeric" /></span><br /><br /><input style="display:block;margin-left:auto;margin-right:auto;" type="button" value="Calculate Next Move" id="nnimstrat" /><br /><br /><br /><textarea style="display:block;margin-left:auto;margin-right:auto;" readonly="true" id="ngivestrat"></textarea><br /></div><div><h2>Single-Pile Wise-Guy Nim Strategy Calculator</h2><br />Before using this particular Nim strategy calculator, please see <a href="http://headinside.blogspot.com/2010/09/secrets-of-nim-wise-guy-nim.html">my <span style="font-style:italic">Wise-Guy Nim</span> post</a>.<br /><br />Player who removes the last object is the: <input type="radio" name="wwinloss" class="wlosswin" value="winner" checked=true /> Winner <input type="radio" name="wwinloss" class="wlosswin" value="loser" /> Loser<br /><br />Maximum number of objects (limit): <input type="text" id="wstartobj" maxlength="4" class="numeric" /><br /><br /><input style="display:block;margin-left:auto;margin-right:auto;" type="button" value="Calculate Nim Strategy" id="wnimstrat" /><br /><br /><br /><textarea style="display:block;margin-left:auto;margin-right:auto;" readonly="true" id="wgivestrat"></textarea><br /></div></div>Pi Guyhttp://www.blogger.com/profile/09760001560356969164noreply@blogger.com0