Difference between revisions of "Zener"

From Ingmar de Boer
Jump to: navigation, search
Line 1: Line 1:
* [http://localhost/zener.html Zener test]
+
<html>
 +
 
 +
<H2>Simple Zener Test</H2>
 +
 
 +
<SCRIPT language="JavaScript" type="text/javascript">
 +
 
 +
guess=0;
 +
correct = 0;
 +
incorrect = 0;
 +
answer = Math.floor(Math.random()*5) + 1;
 +
 
 +
function FormatNumber(num, decimalNum, bolLeadingZero, bolParens)
 +
/* IN - num:            the number to be formatted
 +
decimalNum:    the number of decimals after the digit
 +
bolLeadingZero: true / false to use leading zero
 +
bolParens:      true / false to use parenthesis for - num
 +
 
 +
RETVAL - formatted number
 +
*/
 +
{
 +
var tmpNum = num;
 +
 
 +
// Return the right number of decimal places
 +
tmpNum *= Math.pow(10,decimalNum);
 +
tmpNum = Math.floor(tmpNum);
 +
tmpNum /= Math.pow(10,decimalNum);
 +
 
 +
var tmpStr = new String(tmpNum);
 +
 
 +
// See if we need to hack off a leading zero or not
 +
if (!bolLeadingZero && num < 1 && num > -1 && num !=0)
 +
  if (num > 0) {
 +
  tmpStr = tmpStr.substring(1,tmpStr.length);}
 +
  else {
 +
  // Take out the minus sign out (start at 2)
 +
  tmpStr = "-" + tmpStr.substring(2,tmpStr.length);
 +
}
 +
 
 +
// See if we need to put parenthesis around the number
 +
if (bolParens && num < 0) {
 +
  tmpStr = "(" + tmpStr.substring(1,tmpStr.length) + ")";
 +
}
 +
 
 +
return tmpStr;
 +
}
 +
 
 +
function generateRandomNumber(name) {     
 +
  if(answer == name) {
 +
    correct++;
 +
  guess++;
 +
  shape = new Array('Star','Square','Waves','Cross','Circle')
 +
    now = "Right, the answer was "+ shape[answer - 1];             
 +
  document.fname.report.value =guess;
 +
  document.fname.report3.value = now;
 +
  document.fname.report4.value = correct;
 +
  document.fname.report6.value =Math.floor(correct/guess * 100) +"%";
 +
  } else {
 +
  incorrect++;
 +
  guess++;
 +
  shape = new Array('Star','Square','Waves','Cross','Circle')
 +
    now = "Wrong, the answer was "+ shape[answer - 1];
 +
        document.fname.report.value =guess;
 +
  document.fname.report3.value = now;
 +
  document.fname.report4.value = correct;
 +
  document.fname.report6.value =Math.floor(correct/guess * 100) +"%";   
 +
}
 +
answer = Math.floor(Math.random()*5) + 1;
 +
}
 +
 
 +
function psychic() {
 +
a = .16 * guess;
 +
b = Math.sqrt(a);
 +
c = guess * .2 ;
 +
d = correct - c ;
 +
e =(d/b) ;
 +
f = Math.abs(e);
 +
g = FormatNumber(f,2,true,false)
 +
  if( f <= 1.96) {
 +
    document.fname.tell.value = g + ": You are not paranormally gifted.";
 +
  } if( f > 1.96 && f <= 2.58) {
 +
  document.fname.tell.value = g + ": You are possibly somewhat paranormally gifted." ;
 +
}
 +
if( f > 2.58 && f <= 3.00) {
 +
  document.fname.tell.value = g + ": You are clearly paranormally gifted." ;
 +
  if( f > 3.00) {
 +
    document.fname.tell.value = g + ": You are very highly paranormally gifted." ;
 +
  }
 +
}
 +
}
 +
 
 +
</SCRIPT>
 +
     
 +
  <FORM name="fname" id="fname">
 +
    <TABLE width="80%" cellpadding="5" cellspacing="0" border="0">
 +
      <TR>
 +
        <TD width="15%" valign="top" align="center">
 +
            <IMG src="star.gif" alt="" onclick="generateRandomNumber(1)" style="cursor: hand;">
 +
        </TD>
 +
        <TD width="15%" valign="top" align="center">
 +
            <IMG src="square.gif" alt="" onclick="generateRandomNumber(2)" style="cursor: hand;">
 +
        </TD>
 +
        <TD width="15%" valign="top" align="center">
 +
            <IMG src="waves.gif" alt="" onclick="generateRandomNumber(3)" style="cursor: hand;">
 +
        </TD>
 +
        <TD width="15%" valign="top" align="center">
 +
            <IMG src="cross.gif" alt="" onclick="generateRandomNumber(4)" style="cursor: hand;">
 +
        </TD>
 +
        <TD width="15%" valign="top" align="center">
 +
            <IMG src="circle.gif" alt="" onclick="generateRandomNumber(5)" style="cursor: hand;">
 +
        </TD>
 +
      </TR>
 +
      <TR>
 +
        <TD colspan="5">
 +
          <p class="threelines">
 +
          <DIV align="center">
 +
              <TABLE border="0" cellpadding="5" cellspacing="0">
 +
                <TR>
 +
                  <TD width="223">
 +
                  <FONT face="Arial" size="2"><STRONG>Right/wrong</STRONG></FONT>
 +
                  </TD>
 +
                  <TD width="379">
 +
                    <INPUT type="text" size="41" name="report3">
 +
                  </TD>
 +
                </TR>
 +
                <TR>
 +
                  <TD width="223">
 +
                    <FONT face="Arial" size="2"><STRONG>Number of tries</STRONG></FONT>
 +
                  </TD>
 +
                  <TD width="379">
 +
                    <INPUT type="text" size="10" name="report">
 +
                  </TD>
 +
                </TR>
 +
                <TR>
 +
                  <TD width="223">
 +
                    <FONT face="Arial" size="2"><STRONG>Number correct</STRONG></FONT>
 +
                  </TD>
 +
                  <TD width="379">
 +
                    <INPUT type="text" size="10" name="report4">
 +
                  </TD>
 +
                </TR>
 +
                <TR>
 +
                  <TD width="223">
 +
                    <FONT face="Arial" size="2"><STRONG>Percentage correct</STRONG></FONT>
 +
                  </TD>
 +
                  <TD width="379">
 +
                    <INPUT type="text" size="10" name="report6">
 +
                  </TD>
 +
                </TR>
 +
                <TR>
 +
                  <TD width="223">
 +
                    <INPUT type="button" name="pbutton" value="Score" onclick="psychic();">
 +
                  </TD>
 +
                  <TD width="379">                                               
 +
                    <INPUT type="text" size="64" name="tell">
 +
                  </TD>
 +
                </TR>
 +
                <TR>
 +
                  <TD colspan="2" width="614">
 +
                      <INPUT type="Reset" value="Again" onclick=" javascript: correct = 0; guess = 0; answer = Math.floor(Math.random()*5) + 1;">
 +
                  </TD>
 +
                </TR>
 +
              </TABLE>
 +
          </DIV>
 +
        </TD>
 +
      </TR>
 +
    </TABLE>
 +
  </FORM>
 +
 
 +
</html>

Revision as of 22:44, 1 April 2016

Simple Zener Test

Right/wrong
Number of tries
Number correct
Percentage correct