Просмотр файла games/chisla/index.html

Размер файла: 2.63Kb
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
  2. <HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD>
  3.  
  4. <TITLE> Развлекательный Клуб </TITLE>
  5.  
  6. <LINK
  7. href="favicon.ico" type=image/x-icon rel=icon><LINK href="../css.css" type=text/css
  8. rel=stylesheet>
  9.  
  10.  
  11. <BODY>
  12. <DIV class=title><B>Зрительная память на числа</B></DIV>
  13. <DIV class=kat><STRONG>
  14.  
  15. <script>
  16. function loadgame() {
  17. v = -1; g = 0; tries = 0; total = 0
  18. for(var i = 0; i < 6; i++) {
  19. for(var j = 0; j < 6; j++) {
  20. v++
  21. document.write("<input type='button' value='????' style=\"width:70; height:60; font-size: 18pt; font-family: Verdana; font-weight: bold\" "+
  22. "OnClick='button(" +v+ ")'>")
  23. }
  24. document.write("<br>")
  25. }
  26. }
  27.  
  28. function setBoard() {
  29. v = -1; g = 0; tries = 0; total = 0
  30. document.mem.start.value = "Старт"
  31. for(i=0; i<18; i++) {
  32. Array[i] = i; Array[i+18] = i
  33. }
  34. shuffle();
  35. }
  36.  
  37. function shuffle() {
  38. for(i=0; i < (rand(300)+200); i++) {
  39. x = 0; y = 0
  40. while(x == y) {
  41. x = rand(36); y = rand(36)
  42. }
  43. temp = Array[x]; Array[x] = Array[y]; Array[y] = temp
  44. }
  45. show(0)
  46. }
  47.  
  48. function rand(n) {
  49. return Math.floor(Math.random()*n)
  50. }
  51.  
  52. function show(n) {
  53. if((n && confirm("Вы уверены? ")) || !n) {
  54. for(i=0; i<36; i++) {
  55. document.mem.elements[i].value = Array[i]
  56. }
  57. }
  58. }
  59.  
  60. function blank() {
  61. for(i=0; i<36; i++) {
  62. document.mem.elements[i].value = ""
  63. }
  64. }
  65.  
  66. function button(x) {
  67. test = "" +Array[x]
  68. if(test.charAt(0) == "[") return
  69. document.mem.elements[x].value = Array[x]
  70. if(g == 0) {
  71. first = Array[x]
  72. firstx = x;
  73. g++
  74. return
  75. }
  76. if(g == 1) {
  77. second = Array[x]
  78. secondx = x
  79. tries++
  80. g = 0
  81. if(first == second) {
  82. Array[firstx] = "[" +Array[firstx]+ "]"
  83. Array[secondx] = "[" +Array[secondx]+ "]"
  84. total++
  85. document.mem.start.value = "попаданий: "+total+""
  86. if(total == 18) alert("Вы открыли все числа после "+tries+" попыток(попытки)!")
  87. return
  88. }
  89. }
  90. setTimeout("document.mem.elements[firstx].value = ''", 500)
  91. setTimeout("document.mem.elements[secondx].value = ''", 500)
  92. }
  93. </script>
  94.  
  95. <body OnLoad="setBoard()">
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109. <center>
  110. <table border="3" bgcolor="#808080">
  111. <tr><td bgcolor="#808080">
  112. <form name="mem">
  113. <script>
  114. loadgame()
  115. </script>
  116. <p><center>
  117. <input type="button" value="Старт" style="width:100" name="start" OnClick="blank()">
  118. <input type="button" value="Новая игра" OnClick="setBoard()">
  119. <input type="button" value="Сдаюсь!" OnClick="show(1)">
  120. </center></form>
  121. </table>
  122. <hr><p>
  123. <center>
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. <a href="../">В развлекательный клуб</a>
  132. <BR><BR>
  133. <a href=../../index.html>На главную</a>
  134. <DIV class=end>
  135.  
  136.  
  137. <BR></CENTER></DIV></BODY></HTML>
  138.