chg: pkg: make a massive refactor to the backend and remove all unnecessary deps - and make small refactors for the frontend too #4
This commit is contained in:
@@ -24,11 +24,7 @@ class Grid extends React.Component {
|
||||
|
||||
createSet(obj) {
|
||||
for (let i = 0, j = this.state.row * this.state.col; i < j; i++) {
|
||||
obj.push(
|
||||
0 < this.state.mines
|
||||
? 'm'
|
||||
: 'w',
|
||||
);
|
||||
obj.push(0 < this.state.mines ? 'm' : 'w');
|
||||
this.state.mines--;
|
||||
}
|
||||
|
||||
@@ -61,15 +57,8 @@ class Grid extends React.Component {
|
||||
return grid;
|
||||
}
|
||||
|
||||
checkMine(field, i, j) {
|
||||
return 'undefined' !== typeof field[i] && 'undefined' !== typeof field[i][j] && 'm' === field[i][j];
|
||||
}
|
||||
|
||||
isThereMine(obj, row, col) {
|
||||
if (this.checkMine(obj, row, col)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return 'm' === obj?.[row]?.[col] ? 1 : 0;
|
||||
}
|
||||
|
||||
numberingGrid(obj) {
|
||||
|
||||
Reference in New Issue
Block a user