-
Notifications
You must be signed in to change notification settings - Fork 1
/
174.php
60 lines (52 loc) · 1.17 KB
/
174.php
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
// MONDRIAN PUZZLE
require __DIR__ . '/inc.bootstrap.php';
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<? include 'tpl.onerror.php' ?>
<script src="<?= html_asset('js/rjs-custom.js') ?>"></script>
<script src="<?= html_asset('gridgame.js') ?>"></script>
<script src="<?= html_asset('mondrian.js') ?>"></script>
<title>MONDRIAN PUZZLE</title>
<style>
html, body {
margin: 0;
padding: 0;
}
body {
margin: 5px;
}
canvas {
outline: solid 1px black;
max-width: calc(100vw - 10px);
max-height: calc(100vh - 10px);
max-width: 100%;
touch-action: none;
}
.complete {
font-weight: bold;
color: green;
}
</style>
</head>
<body>
<canvas></canvas>
<p>
Click & drag rectangles to fill the board.
Size: <select id="size"><?= do_html_options(array_combine(range(4, 9), range(4, 9))) ?></select>
<button id="reset">Reset</button>
<button id="undo">Undo</button>
</p>
<p>Score: <code id="score">?</code> (the lower the better)</p>
<script>
objGame = new Mondrian(document.querySelector('canvas'));
objGame.listenControls();
objGame.startGame();
objGame.startPainting();
</script>
</body>
</html>