File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 152152 } ;
153153 stmt . object = getXapiObject ( ) ;
154154 var responses = [ ] ;
155+ var allRight = true ;
155156 for ( var i = 0 ; i < 8 ; i ++ ) {
157+ allRight = allRight && ( active [ i ] === solution [ i ] ) ;
156158 if ( active [ i ] ) {
157159 responses . push ( Math . pow ( 2 , ( 7 - i ) ) . toString ( ) ) ;
158160 }
159161 }
160162 stmt . result = {
161163 response : responses . reduce ( function ( acc , e ) {
162164 return ( acc . length > 0 && e . length > 0 ) ? acc + "[,]" + e : acc . length > 0 ? acc : e ;
163- } , "" )
165+ } , "" ) ,
166+ success : allRight
164167 } ;
165168 sendStatement ( stmt ) ;
166169 }
169172 // may be called on init()
170173
171174 binaryString = window . data . number . toString ( 2 ) ;
175+ binaryString = "00000000" . substr ( 0 , 8 - binaryString . length ) . concat ( binaryString ) ;
172176 solution = binaryString . split ( '' ) . map ( function ( c ) {
173177 return c === "1"
174178 } ) ;
313317 var isShowingSolution = false ;
314318 draw ( ) ;
315319 canvas . addEventListener ( 'click' , onCanvasClicked ) ;
316- // updateLayout();
320+ updateLayout ( ) ;
317321</ script >
318322<!-- END OF EXAMPLE CODE -->
319323</ body >
You can’t perform that action at this time.
0 commit comments