backend extended
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { BoardGenerationService } from './src/Application/Game/BoardGenerationService';
|
||||
|
||||
async function testPatternBasedGeneration() {
|
||||
const service = new BoardGenerationService();
|
||||
|
||||
console.log('Testing pattern-based board generation...');
|
||||
const startTime = Date.now();
|
||||
|
||||
try {
|
||||
const board = await service.generateBoard(3, 2, 1); // 3 positive, 2 negative, 1 luck
|
||||
const endTime = Date.now();
|
||||
|
||||
console.log(`✅ Board generated successfully in ${endTime - startTime}ms`);
|
||||
|
||||
// Count special fields
|
||||
const specialFields = board.fields.filter(f => f.type !== 'regular');
|
||||
console.log(`Special fields: ${specialFields.length}`);
|
||||
console.log(`- Positive: ${board.fields.filter(f => f.type === 'positive').length}`);
|
||||
console.log(`- Negative: ${board.fields.filter(f => f.type === 'negative').length}`);
|
||||
console.log(`- Luck: ${board.fields.filter(f => f.type === 'luck').length}`);
|
||||
|
||||
// Check validation results for a few fields
|
||||
const validationEntries = Object.entries(board.validationResults);
|
||||
console.log(`\nValidation results for ${validationEntries.length} special fields:`);
|
||||
|
||||
validationEntries.slice(0, 3).forEach(([position, outcomes]) => {
|
||||
const field = board.fields.find(f => f.position === parseInt(position));
|
||||
console.log(`Position ${position} (${field?.type}, step ${field?.stepValue}): [${outcomes.join(', ')}]`);
|
||||
});
|
||||
|
||||
console.log('\n✅ Pattern-based generation test completed successfully!');
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Test failed:', error);
|
||||
}
|
||||
}
|
||||
|
||||
testPatternBasedGeneration();
|
||||
Reference in New Issue
Block a user