-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpuz106.html
162 lines (157 loc) · 7.21 KB
/
puz106.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!-- v1.02 Added grid and bumbled through the text box formatting -->
<!-- 24/3/21, Nev - added grunt code to fill the text boxes - just to get it working -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>v1.06 Binary Puzzle 6x6</title>
<script type='text/javascript'>
// 21/4/21, Nev - 3 x 36 element test arrays
var G1 = [1, null, 0, null, 0, 0, null, 1, null, 0, 0, null, null, null, null, null, null, 0, 0, null, null, 1, null, null, 1, 0, null, 1, 1, null, null, 0, null, null, 1, 1];
var G2 = [null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null];
var G3 = [null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null];
var G4 = [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];
function loadGrid(G) { // load 6x6 test games
var Row = 6; // declare # of rows
var Col = 6; // declare # of columns
var Grid = []; // declare Grid as an array
for (let j = 0; j < Col; j++) {
for (let i = 0; i < Row; i++) {
document.getElementById('B' + (i + 1) + (j + 1)).value = G[j*Col+i]; // 0*Col
}
}
//for (let i = 0; i < Row; i++) {
// document.getElementById('B' + (i + 1) + '2').value = G[Col + i]; // 1*Col
//}
//for (let i = 0; i < Row; i++) {
// document.getElementById('B' + (i + 1) + '3').value = G[2 * Col + i]; // 2*Col
//}
//for (let i = 0; i < Row; i++) {
// document.getElementById('B' + (i + 1) + '4').value = G[3 * Col + i]; // 3*Col
//}
//for (let i = 0; i < Row; i++) {
// document.getElementById('B' + (i + 1) + '5').value = G[4 * Col + i]; // 4*Col
//}
//for (let i = 0; i < Row; i++) {
// document.getElementById('B' + (i + 1) + '6').value = G[5 * Col + i]; // 5*Col
//}
}
</script>
<style type="text/css">
/* 30/7/19 Rain Holloway (2020 student) - to eliminate double lines */
* {
padding: 0;
border-collapse: collapse;
}
/* 27/7/19 Nev - for formatting of the table cells */
.gameboard {
width: 40px;
height: 40px;
font-size: 30px;
color: #0B1AB8;
vertical-align: middle;
text-align: center;
border-collapse: collapse;
border-spacing: 0;
border: 1px solid #ED2428;
}
</style>
</head>
<body onload="loadGrid(G4)">
<!-- 21/4/21 Now loading the variable "G1" which is a 36 element array -->
<form id="input">
<h1>v1.06 Binary Puzzle Game (6x6)</h1>
<h2>v1.06: Create the 2 nested loops to load the grid.</h2>
<p>Return to <a href="index.html">home</a>:</p>
<p> </p>
<!-- set up the board as a table with a textbox in each cell -->
<table class="gameboard">
<tr>
<td>
<input id="B11" type="text" class="gameboard" /></td>
<td>
<input id="B21" type="text" class="gameboard" /></td>
<td>
<input id="B31" type="text" class="gameboard" /></td>
<td>
<input id="B41" type="text" class="gameboard" /></td>
<td>
<input id="B51" type="text" class="gameboard" /></td>
<td>
<input id="B61" type="text" class="gameboard" /></td>
</tr>
<tr>
<td>
<input id="B12" type="text" class="gameboard" /></td>
<td>
<input id="B22" type="text" class="gameboard" /></td>
<td>
<input id="B32" type="text" class="gameboard" /></td>
<td>
<input id="B42" type="text" class="gameboard" /></td>
<td>
<input id="B52" type="text" class="gameboard" /></td>
<td>
<input id="B62" type="text" class="gameboard" /></td>
</tr>
<tr>
<td>
<input id="B13" type="text" class="gameboard" /></td>
<td>
<input id="B23" type="text" class="gameboard" /></td>
<td>
<input id="B33" type="text" class="gameboard" /></td>
<td>
<input id="B43" type="text" class="gameboard" /></td>
<td>
<input id="B53" type="text" class="gameboard" /></td>
<td>
<input id="B63" type="text" class="gameboard" /></td>
</tr>
<tr>
<td>
<input id="B14" type="text" class="gameboard" /></td>
<td>
<input id="B24" type="text" class="gameboard" /></td>
<td>
<input id="B34" type="text" class="gameboard" /></td>
<td>
<input id="B44" type="text" class="gameboard" /></td>
<td>
<input id="B54" type="text" class="gameboard" /></td>
<td>
<input id="B64" type="text" class="gameboard" /></td>
</tr>
<tr>
<td>
<input id="B15" type="text" class="gameboard" /></td>
<td>
<input id="B25" type="text" class="gameboard" /></td>
<td>
<input id="B35" type="text" class="gameboard" /></td>
<td>
<input id="B45" type="text" class="gameboard" /></td>
<td>
<input id="B55" type="text" class="gameboard" /></td>
<td>
<input id="B65" type="text" class="gameboard" /></td>
</tr>
<tr>
<td>
<input id="B16" type="text" class="gameboard" /></td>
<td>
<input id="B26" type="text" class="gameboard" /></td>
<td>
<input id="B36" type="text" class="gameboard" /></td>
<td>
<input id="B46" type="text" class="gameboard" /></td>
<td>
<input id="B56" type="text" class="gameboard" /></td>
<td>
<input id="B66" type="text" class="gameboard" /></td>
</tr>
</table>
<br />
</form>
</body>
</html>