Created
November 1, 2011 00:52
-
-
Save ataka/1329550 to your computer and use it in GitHub Desktop.
GDD2011 DevQuiz Web Game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GDD2011 DevQuiz Web Game | |
ルール | |
シンプルな神経衰弱ゲームです。カードはクリックすることでめくることができます。全 64 セットを解くことで問題クリアとなります。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "ChromeExtensionSolverHint", | |
"version": "1.1", | |
"description": "Clear Nervous Breakdown Game (GDD2011).", | |
"content_scripts": [ | |
{ | |
"matches": [ | |
"http://gdd-2011-quiz-japan.appspot.com/webgame/problem*" | |
], | |
"js": [ | |
"solver.js" | |
] | |
} | |
], | |
"permissions": [ | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cards = new Array(); | |
var color = new Array(); | |
var i = 0; | |
while(1) | |
{ | |
cards[i] = document.getElementById('card' + i); | |
if (cards[i] == null) { | |
break; | |
} else { | |
click_card(i); | |
color[i] = cards[i].style.backgroundColor; | |
i += 1; | |
cards[i] = document.getElementById('card' + i); | |
click_card(i); | |
color[i] = cards[i].style.backgroundColor; | |
i += 1; | |
check_card(i-2); | |
check_card(i-1); | |
} | |
} | |
function click_card(j) | |
{ | |
var myevent = document.createEvent('MouseEvents'); | |
myevent.initEvent('click', false, true); | |
cards[j].dispatchEvent(myevent); | |
} | |
function check_card(j) | |
{ | |
for(var n=j-1; n>=0; n--) | |
{ | |
if (color[n] === color[j]) | |
{ | |
click_card(n); | |
click_card(j); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment