Add objectives, stage config, and GameEngine session core
Sealed Objective types (clearGems/reachScore/clearLines) with JSON round-trip; StageConfig with preset cells and star thresholds; GameEngine orchestrating placement -> clear -> scoring -> objectives with stuck detection, one-shot rescue (continue / +5 moves), and deterministic per-attempt RNG. 100-game headless stress test and pure-Dart architecture guard. 76 tests green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
/// The game engine must stay pure Dart: unit-testable headless, reusable by
|
||||
/// the stage generator CLI, and free of widget-layer coupling.
|
||||
void main() {
|
||||
test('lib/game and lib/core never import Flutter', () {
|
||||
final dirs = [Directory('lib/game'), Directory('lib/core')];
|
||||
final violations = <String>[];
|
||||
for (final dir in dirs) {
|
||||
for (final entity in dir.listSync(recursive: true)) {
|
||||
if (entity is! File || !entity.path.endsWith('.dart')) continue;
|
||||
final source = entity.readAsStringSync();
|
||||
if (source.contains("import 'package:flutter") ||
|
||||
source.contains('import "package:flutter')) {
|
||||
violations.add(entity.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
expect(violations, isEmpty,
|
||||
reason: 'Flutter imports found in pure-Dart layers: $violations');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user