Update dependencies

This commit is contained in:
Florine W. Dekker 2021-02-25 10:29:53 +01:00
parent 57b06d38bf
commit 7541898fe5
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
4 changed files with 19 additions and 17 deletions

BIN
package-lock.json generated

Binary file not shown.

View File

@ -1,6 +1,6 @@
{
"name": "minesweeper",
"version": "0.82.4",
"version": "0.82.5",
"description": "Just Minesweeper!",
"author": "Felix W. Dekker",
"browser": "dist/bundle.js",
@ -18,12 +18,12 @@
"dependencies": {
"@fwdekker/template": "^0.0.21",
"alea": "^1.0.0",
"canvas-confetti": "^1.3.1",
"canvas-confetti": "^1.3.3",
"fork-awesome": "^1.1.7"
},
"devDependencies": {
"css-loader": "^5.0.0",
"file-loader": "^6.1.1",
"css-loader": "^5.0.2",
"file-loader": "^6.2.0",
"grunt": "^1.3.0",
"grunt-cli": "^1.3.2",
"grunt-contrib-clean": "^2.0.0",
@ -33,10 +33,10 @@
"grunt-text-replace": "^0.4.0",
"grunt-webpack": "^4.0.2",
"style-loader": "^2.0.0",
"ts-loader": "^8.0.6",
"ts-node": "^9.0.0",
"typescript": "^4.0.3",
"webpack": "^5.1.3",
"webpack-cli": "^4.1.0"
"ts-loader": "^8.0.17",
"ts-node": "^9.1.1",
"typescript": "^4.2.2",
"webpack": "^5.24.2",
"webpack-cli": "^4.5.0"
}
}

View File

@ -70,6 +70,7 @@ export class Field {
* @param solvable whether the field must be solvable
* @param seed the seed to generate the field with
* @param statistics the statistics tracker, or `null` if statistics should not be tracked
* @param highScores the tracker to store new scores in
*/
constructor(width: number, height: number, mineCount: number, solvable: boolean, seed: number,
statistics: Statistics, highScores: HighScores) {

View File

@ -67,7 +67,7 @@ export class Solver {
*/
getHint(field: Field): Square | null {
if (!field.hasStarted || field.hasWon || field.hasLost) return null;
const knowns = this.getKnowns(field);
const knowns = Solver.getKnowns(field);
const candidate = knowns.find(square =>
// Can chord
@ -118,6 +118,7 @@ export class Solver {
return true;
this.stepAllSquares(field);
// noinspection RedundantIfStatementJS // Makes it easier to add more steps
if (field.hasWon || field.flagCount !== flagCount || field.coveredNonMineCount !== coveredCount)
return true;
@ -134,7 +135,7 @@ export class Solver {
* @private
*/
private stepSingleSquares(field: Field): void {
this.getKnowns(field)
Solver.getKnowns(field)
.forEach(square => {
field.chord(square);
if (square.getNeighborCount(it => it.isCovered) === square.getNeighborCount(it => it.hasMine))
@ -155,9 +156,9 @@ export class Solver {
* @private
*/
private stepNeighboringSquares(field: Field): void {
const knowns = this.getKnowns(field);
const knowns = Solver.getKnowns(field);
knowns.forEach(known => {
this.applySolution(
Solver.applySolution(
field,
this.matrixSolve(field, known.neighbors.filter(it => !it.isCovered).concat(known), true)
);
@ -176,8 +177,8 @@ export class Solver {
private stepAllSquares(field: Field): void {
if (!field.hasStarted || field.hasWon || field.hasLost) return;
const knowns = this.getKnowns(field);
this.applySolution(
const knowns = Solver.getKnowns(field);
Solver.applySolution(
field,
this.matrixSolve(field, knowns, false)
);
@ -231,7 +232,7 @@ export class Solver {
* @returns all uncovered squares that have at least one covered unflagged neighbor
* @private
*/
private getKnowns(field: Field): Square[] {
private static getKnowns(field: Field): Square[] {
return field.squareList
.filter(it => !it.isCovered)
.filter(it => it.getNeighborCount(it => it.isCovered && !it.hasFlag) > 0);
@ -244,7 +245,7 @@ export class Solver {
* @param solution the solution to apply
* @private
*/
private applySolution(field: Field, solution: Solution): void {
private static applySolution(field: Field, solution: Solution): void {
solution.forEach(target => {
if (target === undefined) return;