-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
35 lines (32 loc) · 1.29 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!doctype html>
<html>
<head>
<title>McMahon's 24 Color Squares in JavaScript</title>
<script src="./canvashelper.js"></script>
<script src="./squares24.js"></script>
</head>
<body>
<div style="text-align:center">
<h1>McMahon's 24 Color Squares</h1>
<!-- <div>For CodeAbbey problem <a href="http://www.codeabbey.com/index/task_view/hard-life">Hard Life</a></div>--><br/><br/>
<div>Drag squares to swap them, click to rotate.<br/>
Goal is to make all the border "triangles" of
the same color,<br/>while pairs of inner "triangles" should match when they touch the same edge.</div><br/>
<span style="font-weight:bold" id="matches"></span>
<br/>
<canvas id="demo" width="600" height="400" style="border:5px solid #888;border-radius: 5px;background: black;"></canvas>
<br/>
<input type="button" onclick="squares.shuffleAndDraw()" value="Shuffle"/>
</div>
<script>
window.onload = function() {
function info(score) {
document.getElementById('matches').innerHTML = 'Matches: ' + score + ' of 58';
if (score == 58) {
alert('Congratulations!\n\nYou have found one of 10000+ solutions :)');
}
}
squares = new Squares24({size: 120, infoCallback: info});
}
</script>
</body>