Skip to content

Commit 222851c

Browse files
committed
Add default placement
1 parent a6b64cd commit 222851c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/App.tsx

+15
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ function App() {
141141
setWidth(width);
142142
setHeight(height);
143143
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+
}
144150
};
145151

146152
addEventListener('resize', resize);
@@ -161,6 +167,15 @@ function App() {
161167
setWidth(width);
162168
setHeight(height);
163169
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+
}
164179
}, [windowRef, fieldRef]);
165180

166181
useEffect(() => {

0 commit comments

Comments
 (0)