diff --git a/src/data/puzzles.json b/src/data/puzzles.json index d22bd88..37662ca 100644 --- a/src/data/puzzles.json +++ b/src/data/puzzles.json @@ -13,6 +13,12 @@ "type": "SequencePuzzle", "seed": 1582571877, "dateEntered": "2020-02-24 19:17:57" + }, + { + "id": "hj3h5h3j5hj", + "type": "SequencePuzzle", + "seed": 1582581414, + "dateEntered": "2020-02-24 22:56:54" } ] } \ No newline at end of file diff --git a/src/js/app.js b/src/js/app.js index af9a1aa..cd91e70 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -12,5 +12,6 @@ export class App { this.puzzles.computePuzzle( 0 ); this.puzzles.computePuzzle( 1 ); + this.puzzles.computePuzzle( 2 ); } } \ No newline at end of file diff --git a/src/js/puzzles/sequencepuzzle.js b/src/js/puzzles/sequencepuzzle.js index 7152f78..d5498c0 100644 --- a/src/js/puzzles/sequencepuzzle.js +++ b/src/js/puzzles/sequencepuzzle.js @@ -9,7 +9,7 @@ export class SequencePuzzle { "ADD" ]; - this.length = Math.round( this.mersennetwister.randomRange( 30, 70 ) / 10 ); + this.length = Math.max( Math.round( this.mersennetwister.randomRange( 30, 70 ) / 10 ), 5); this.answerposition = ( Math.floor( this.mersennetwister.randomRange( 15, this.length * 500 ) / 10 ) - 1 ) % this.length; this.operator = this.operators[ ( Math.floor( this.mersennetwister.randomRange( 15, this.length * 500 ) / 10 ) - 1 ) % this.operators.length ]; this.factor = Math.round( this.mersennetwister.randomRange( 10, 100 ) / 10 ); @@ -25,7 +25,7 @@ export class SequencePuzzle { this.answer = this.parts[ this.answerposition ]; this.parts[ this.answerposition ] = "?"; - console.log( "Puzzle id: " + this.puzzleData.id + " (seed: " + this.puzzleData.seed + ")" ); - console.log( this.parts.join( " " ) ); + document.write( "Puzzle id: " + this.puzzleData.id + " (seed: " + this.puzzleData.seed + ")" + "
"); + document.write( this.parts.join( " " ) + "

" ); } } \ No newline at end of file