Advertisement
Guest User

Untitled

a guest
May 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. let value1 = 0;
  2. let flip = 0;
  3. let picture1, picture2;
  4. let ary = new Array(17);
  5.  
  6. for (i = 0; i < ary.length; i++) {
  7. ary[i] = [];
  8. ary[i][1] = 0;
  9. }
  10. for (i = 1; i < 9; i++) {
  11. ary[i][0] = i;
  12. }
  13. for (i = 1; i < 9; i++) {
  14. ary[i + 8][0] = i;
  15. }
  16.  
  17. function memory(ns) {
  18. if (ary[ns][1] == 0 && ary[ns][1] == 0) {
  19. if (value1 == 0) {
  20. picture1 = ns;
  21.  
  22. } else {
  23. picture2 = ns;
  24. }
  25. if (value1 < 2) {
  26. document.images[ns].src = 'imgPK/' + ns + '.png';
  27. }
  28. value1 = value1 + 1
  29. if (value1 == 2) {
  30. let temp = setTimeout("proof()", 500);
  31. value1 = 0;
  32. }
  33. }
  34. }
  35.  
  36. function proof() {
  37. counter();
  38. if (ary[picture1][0] == ary[picture2][0]) {
  39. ary[picture1][1] = 1;
  40. ary[picture2][1] = 1;
  41.  
  42. } else {
  43. close(picture1);
  44. close(picture2);
  45. }
  46. }
  47.  
  48. function close(s) {
  49. document.images[s].src = 'imgPK/Logo.png';
  50. }
  51.  
  52. function counter() {
  53. flip = flip + 1;
  54. document.getElementById('Flipper').innerHTML = 'Flip: ' + flip;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement