Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let value1 = 0;
- let flip = 0;
- let picture1, picture2;
- let ary = new Array(17);
- for (i = 0; i < ary.length; i++) {
- ary[i] = [];
- ary[i][1] = 0;
- }
- for (i = 1; i < 9; i++) {
- ary[i][0] = i;
- }
- for (i = 1; i < 9; i++) {
- ary[i + 8][0] = i;
- }
- function memory(ns) {
- if (ary[ns][1] == 0 && ary[ns][1] == 0) {
- if (value1 == 0) {
- picture1 = ns;
- } else {
- picture2 = ns;
- }
- if (value1 < 2) {
- document.images[ns].src = 'imgPK/' + ns + '.png';
- }
- value1 = value1 + 1
- if (value1 == 2) {
- let temp = setTimeout("proof()", 500);
- value1 = 0;
- }
- }
- }
- function proof() {
- counter();
- if (ary[picture1][0] == ary[picture2][0]) {
- ary[picture1][1] = 1;
- ary[picture2][1] = 1;
- } else {
- close(picture1);
- close(picture2);
- }
- }
- function close(s) {
- document.images[s].src = 'imgPK/Logo.png';
- }
- function counter() {
- flip = flip + 1;
- document.getElementById('Flipper').innerHTML = 'Flip: ' + flip;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement