File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,12 @@ function App() {
141
141
setWidth ( width ) ;
142
142
setHeight ( height ) ;
143
143
setAmount ( width * height ) ;
144
+ setStartPoint ( 0 ) ;
145
+ setEndPoint ( ( width * height ) - 1 ) ;
146
+ for ( let i = 0 ; i < width ; i ++ ) {
147
+ const d = Math . floor ( Math . random ( ) * ( ( width * height ) - 3 ) ) + 1 ;
148
+ setDisabledCells ( new Set ( disabledCells . add ( d ) ) ) ;
149
+ }
144
150
} ;
145
151
146
152
addEventListener ( 'resize' , resize ) ;
@@ -161,6 +167,15 @@ function App() {
161
167
setWidth ( width ) ;
162
168
setHeight ( height ) ;
163
169
setAmount ( width * height ) ;
170
+ setStartPoint ( 0 ) ;
171
+ setEndPoint ( ( width * height ) - 1 ) ;
172
+ for ( let i = 0 ; i < width / 2 ; i ++ ) {
173
+ const d = Math . floor ( Math . random ( ) * ( ( width * height ) - 3 ) ) + 1 ;
174
+ disabledCells . add ( d ) ;
175
+ disabledCells . add ( d + width ) ;
176
+ disabledCells . add ( d + ( width * 2 ) ) ;
177
+ setDisabledCells ( new Set ( disabledCells ) ) ;
178
+ }
164
179
} , [ windowRef , fieldRef ] ) ;
165
180
166
181
useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments