File tree Expand file tree Collapse file tree 5 files changed +47
-12
lines changed
algorithm/sandbox/sandbox/sandbox Expand file tree Collapse file tree 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>
131131 < div >
132132 < div >
133133 # of Rows:
134- < input id ="numRows " type ="number " value ="0 ">
134+ < input id ="numRows " type ="number " value ="5 ">
135135 </ div >
136136
137137 < div >
138138 # 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 >
140144 </ div >
141145 </ div >
142146 </ div >
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- var sandbox = require ( './sb ' ) ;
3+ const modules = require ( '../module ' ) ;
44
5- const CAT = ( ) => {
6- console . log ( "DOG" ) ;
5+ const getNumRows = ( ) => {
6+ var row_field = document . getElementById ( "numRows" ) ;
7+ return row_field . value ;
78} ;
89
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+ } ;
941
1042module . exports = {
11- CAT
12- }
43+ setupButtons
44+ } ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const PRINT = ( ) => {
4- console . log ( "hiya" ) ;
5- } ;
63
74module . exports = {
8- PRINT
5+
96} ;
Original file line number Diff line number Diff line change @@ -73,6 +73,9 @@ $(() => {
7373 } else {
7474 DOM . showFirstAlgorithm ( ) ;
7575 }
76+
77+ Sandbox . setupButtons ( ) ;
78+
7679 } ) ;
7780
7881 Server . loadWikiList ( ) . then ( ( data ) => {
You can’t perform that action at this time.
0 commit comments