-
Notifications
You must be signed in to change notification settings - Fork 1
/
numbrix.html
144 lines (130 loc) · 4.01 KB
/
numbrix.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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>Numbrix</title>
</head>
<style>
table, th, td {
padding: 4px;
text-align: center;
border: 1px solid black;
border-collapse: collapse;
}
svg {
display: block;
margin: auto ;
border: 1px solid black;
}
.centered {
text-align: center;
}
</style>
</head>
<script src="js/evnts.js"></script> <!-- required for callback registration-->
<script src="js/bldrs.js"></script> <!-- required for html/svg building -->
<script src="js/chess_base.js"></script>
<script src="js/puzzles.js"></script>
<script src="js/solver.js"></script>
<script>
function loadBoard() {
game = new Numbrix();
game.init();
var fixer = new Fixer(game);
fixer.fix();
return htmlForBoard(game.getBoard());
};
$(document).ready(function(){
$("#refresh").on("click", function(event){
console.log("refresh button clicked");
$("#boardDisplay").html(loadBoard());
game.start();
});
});
/*
* The page registers callbacks to have its elements
* refreshed when things change. These pull what they
* require from the gameDisplay object.
*/
$(document).ready(function(){
evnts.addCallback("refreshMap", function() {
$("#mapDisplay").html(gameDisplay.map);
});
evnts.addCallback("refreshStatus", function() {
$("#finish").html(gameDisplay.statusMessage);
});
evnts.addCallback("refreshSteps", function() {
$("#missteps").html(gameDisplay.missteps);
});
//after callbacks are registered, we start the game
$("#boardDisplay").html(loadBoard());
game.start();
});
</script>
<nav class="navbar navbar-default" style="margin-bottom:0px">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="..">
<img src="imgs/github_badge1.png" style="max-width:100%;max-height:100%" >
</a>
<p class="navbar-text navbar-right">
<a href=".." class="navbar-link">dmackinnon1.github.io</a>
</p>
</div>
</div>
</nav>
<br>
<div class="centered">
<div class="btn-group btn-group-md " role="group">
<a class="btn btn-default" href=".">Kixote</a>
<a class="btn btn-default" href="./hidato.html">Hidato</a>
<a class="btn btn-primary" href="./numbrix.html">Numbrix</a>
<a class="btn btn-default" href="./tourist.html">Tourist</a>
</div>
</div>
<div class="container-fluid">
<div class='row'>
<div class='col-sm-1'>
</div>
<div class='col-sm-10'>
<div class="page-header">
<h1>Numbrix</h1>
</div>
<button type='button' class='btn btn-info' data-toggle='collapse' data-target='#full'>
About </button>
<div id='full' class='collapse '>
<br><hr>
<div class="media">
<a class="media-left media-middle" href="#">
<img class="media-object" src="imgs/5_5.png" alt="5x5 chess board" width="150" height="150">
</a>
<div class="media-body">
<h4 class="media-heading">Numbrix Puzzles</h4>
The puzzles on this page present a variation of Numbrix-style puzzles, originally created by <a href="https://en.wikipedia.org/wiki/Marilyn_vos_Savant">Marylin vos Savant</a>.
Like other path puzzles (such as <a href=".">Kixote</a> and <a href="./hidato.html">Hidato</a>), your goal is to trace a path over the whole board, touching each cell only once.
In Numbrix puzzles, you are restricted to moving only up, down, left, and right - as in a <a href="./hidato.html">Hidato</a> puzzle without the diagonal moves.
</div>
</div>
<br>
<hr><br>
</div>
<button id="refresh" class="btn btn-default">New Puzzle</button>
<div id="finish" style="text-align=center"></div>
<hr>
<h3><div id="boardDisplay" style="text-align=center">
</div>
</h3>
<hr>
<div id="missteps" style="text-align=center"></div>
<hr>
<div id="mapDisplay" style="text-align=center"></div>
<hr>
</div>
<div class='col-sm-1'>
</div>
</body>
</html>