@@ -20,6 +20,7 @@ digraph { ${string_list.join("\n")} }
20
20
21
21
const tbody = document . getElementById ( "input_area" ) ;
22
22
const number_key_pad_tbody = document . getElementById ( "number_key_pad_tbody" ) ;
23
+ const user_conole = document . getElementById ( "user_console" ) ;
23
24
24
25
console . log ( tbody ) ;
25
26
console . log ( number_key_pad_tbody ) ;
@@ -141,6 +142,32 @@ function getSudokuArr(width,height){
141
142
return rarr ;
142
143
}
143
144
145
+
146
+ /**
147
+ * # user console
148
+ * ## out
149
+ * @param {HTMLElement } target
150
+ * @param {String } text
151
+ */
152
+ function user_console_out ( target , text ) {
153
+ let text_elem = document . createElement ( "p" ) ;
154
+ text_elem . textContent = text ;
155
+ target . appendChild ( text_elem ) ;
156
+ }
157
+
158
+ /**
159
+ * # user console
160
+ * ## clear
161
+ * @param {HTMLElement } target
162
+ */
163
+ function user_console_clear ( target ) {
164
+ while ( target . firstChild ) {
165
+ target . removeChild ( target . firstChild ) ;
166
+ }
167
+ }
168
+
169
+
170
+
144
171
// setting
145
172
settingBoxes ( tbody , 9 , 9 ) ;
146
173
settingNumberKeypad (
@@ -169,14 +196,16 @@ console.log("開始します")
169
196
init ( ) . then ( ( ) => {
170
197
let solve_button = document . getElementById ( "solve_button" ) ;
171
198
solve_button . addEventListener ( "click" , function ( event ) {
172
- console . log ( "数独を解いています" ) ;
199
+ user_console_clear ( user_conole ) ;
200
+ user_console_out ( user_conole , "solving sudoku..." ) ;
173
201
let q_arr = getSudokuArr ( 9 , 9 ) ;
202
+ const startTime = performance . now ( ) ; // 開始時間
174
203
let data = JSON . parse ( sudoku ( q_arr ) ) ;
175
- console . log ( "数独を解き終わりました" ) ;
176
- console . log ( "再帰構造をレンダリングしています" )
177
-
204
+ const endTime = performance . now ( ) ; // 終了時間
205
+ user_console_out ( user_conole , `have solved sudoku ${ endTime - startTime } ms` ) ;
206
+ user_console_out ( user_conole , "rendering sudoku recursion structure..." ) ;
178
207
draw_viz ( data . slice ( 0 , 3100 ) ) ;
179
- console . log ( "レンダリングを終了しました" )
208
+ user_console_out ( user_conole , "coming soon to show ,please wait for a minutes." ) ;
180
209
} )
181
210
} ) ;
182
211
0 commit comments