-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
102 lines (94 loc) · 3.92 KB
/
Copy pathindex.html
File metadata and controls
102 lines (94 loc) · 3.92 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sudoku solver</title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="./vendor-libs/buefy.min.css">
<script src="./vendor-libs/vue.js"></script>
<script src="./vendor-libs/buefy.min.js"></script>
<style>
.container .subtitle {
margin-bottom: 0px;
}
.container .subtitle.is-6 {
margin-bottom: 5px;
}
</style>
</head>
<body>
<section class="hero is-primary is-bold">
<div class="hero-body">
<div class="container">
<div class="columns">
<div class="column is-one-fifth"></div>
<div class="column">
<h1 class="title">Sudoku Solver</h1>
<h2 class="subtitle">Using Backtracking Algorithm</h2>
<h2 class="subtitle is-6">(with Most Constrained Square Selection)</h2>
<a class="button is-small is-link is-inverted" href="https://github.com/rajasharan/sudoku-solver">
<span>View on GitHub</span>
</a>
</div>
</div>
</div>
</div>
</section>
<section id="sudoku" class="section">
<div class="columns">
<div class="column is-one-fifth"></div>
<div class="column is-narrow">
<svg width="320" height="320" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<defs>
<pattern id="smallGrid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="gray" stroke-width="0.5" />
</pattern>
<pattern id="grid" width="96" height="96" patternUnits="userSpaceOnUse">
<rect width="96" height="96" fill="url(#smallGrid)" />
<path d="M 96 0 L 0 0 0 96" fill="none" stroke="gray" stroke-width="1.5" />
</pattern>
</defs>
<svg:style>
.txt { font-size: 2.5em; font-family: monospace; cursor: pointer }
.none { fill-opacity: 0.02 }
.default { fill: orange }
.new { fill: black; fill-opacity: 0.6 }
</svg:style>
<rect width="289" height="289" fill="url(#grid)" />
<text
class="txt"
v-for="item in itemsHelper"
:key="item.id"
:x="item.x"
:y="item.y"
:class="{ none: fill(item.i, item.j) === 'none', default: fill(item.i, item.j) === 'default', new: fill(item.i, item.j) === 'new' }"
@click="update($event, item.i, item.j)">
{{item.num}}
</text>
</svg>
<div class="buttons">
<button class="button is-success" @click="solve" v-bind:disabled="inprogress">Solve</button>
<button class="button is-danger" @click="reset" v-bind:disabled="inprogress">Reset</button>
</div>
<div class="columns">
<div class="column">
<b-field label="Delay (ms)">
<b-slider class="slider" v-model="speed" :step="1" :min="0" :max="300" @change="speedChanged">
<template v-for="val in [50, 150, 250]">
<b-slider-tick :value="val" :key="val">{{val}}</b-slider-tick>
</template>
</b-slider>
</b-field>
</div>
</div>
</div>
<div class="column" v-if="steps">
<p>Total Steps: {{steps}}</p>
<p v-if="msg">{{msg}}</p>
</div>
</div>
</section>
<script src="./app.js"></script>
</body>
</html>