File tree 5 files changed +47
-12
lines changed
algorithm/sandbox/sandbox/sandbox
5 files changed +47
-12
lines changed Original file line number Diff line number Diff line change 1
- var logger = new LogTracer ( ) ;
Original file line number Diff line number Diff line change @@ -131,12 +131,16 @@ <h3>
131
131
< div >
132
132
< div >
133
133
# of Rows:
134
- < input id ="numRows " type ="number " value ="0 ">
134
+ < input id ="numRows " type ="number " value ="5 ">
135
135
</ div >
136
136
137
137
< div >
138
138
# of Columns:
139
- < input id ="numColumns " type ="number " value ="0 ">
139
+ < input id ="numColumns " type ="number " value ="5 ">
140
+ </ div >
141
+
142
+ < div >
143
+ < button id ="button-2DMatrix "> Create 2DMatrix</ button >
140
144
</ div >
141
145
</ div >
142
146
</ div >
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- var sandbox = require ( './sb ' ) ;
3
+ const modules = require ( '../module ' ) ;
4
4
5
- const CAT = ( ) => {
6
- console . log ( "DOG" ) ;
5
+ const getNumRows = ( ) => {
6
+ var row_field = document . getElementById ( "numRows" ) ;
7
+ return row_field . value ;
7
8
} ;
8
9
10
+ const getNumColumns = ( ) => {
11
+ var column_field = document . getElementById ( "numColumns" ) ;
12
+ return column_field . value ;
13
+ } ;
14
+
15
+ const fauxData = ( r , c ) => {
16
+ var arr = new Array ( r ) ;
17
+ for ( var i = 0 ; i < c ; i ++ ) {
18
+ arr [ i ] = new Array ( c ) ;
19
+ }
20
+
21
+ for ( var i = 0 ; i < r ; i ++ ) {
22
+ for ( var j = 0 ; j < c ; j ++ ) {
23
+ arr [ i ] [ j ] = 0 ;
24
+ }
25
+ }
26
+ return arr ;
27
+ } ;
28
+
29
+ const setupButtons = ( ) => {
30
+
31
+ var button_2DMatrix = document . getElementById ( "button-2DMatrix" ) ;
32
+ button_2DMatrix . addEventListener ( 'click' , function ( ) {
33
+ var arr2DTracer = new modules . Array2DTracer ( ) ;
34
+ var numRows = getNumRows ( ) ;
35
+ var numColumns = getNumColumns ( ) ;
36
+ var data = fauxData ( numRows , numColumns ) ;
37
+ console . log ( data ) ;
38
+ arr2DTracer . setData ( data ) ;
39
+ } , false ) ;
40
+ } ;
9
41
10
42
module . exports = {
11
- CAT
12
- }
43
+ setupButtons
44
+ } ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- const PRINT = ( ) => {
4
- console . log ( "hiya" ) ;
5
- } ;
6
3
7
4
module . exports = {
8
- PRINT
5
+
9
6
} ;
Original file line number Diff line number Diff line change @@ -73,6 +73,9 @@ $(() => {
73
73
} else {
74
74
DOM . showFirstAlgorithm ( ) ;
75
75
}
76
+
77
+ Sandbox . setupButtons ( ) ;
78
+
76
79
} ) ;
77
80
78
81
Server . loadWikiList ( ) . then ( ( data ) => {
You can’t perform that action at this time.
0 commit comments