finetuning

This commit is contained in:
Martijn de Boer 2020-02-24 23:00:48 +01:00
parent 1835a94af9
commit c2c7ccf57a
3 changed files with 10 additions and 3 deletions

View file

@ -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"
}
]
}

View file

@ -12,5 +12,6 @@ export class App {
this.puzzles.computePuzzle( 0 );
this.puzzles.computePuzzle( 1 );
this.puzzles.computePuzzle( 2 );
}
}

View file

@ -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 + ")" + "<br>");
document.write( this.parts.join( " " ) + "<br><br>" );
}
}